-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android support #2
Comments
I wrote most of the docs for love-android-sdl2; if there's anything I can help with, please tell me. |
Well I see that you update the version by default... that is not a good idea always. You should leave that to the user. You should check that the .love version is as new as the love-android version (if love is 0.8 there would be lots of errors) Icons are a good thing to have but I dont know how you implemented that in other versions (I think that it is similar to the debian package but you dont take part in the icon process there because they are easily changed as files in a zip... something imposible with apks) I think the rest is rather good and it should compile I'll help when I have time and linux in my machine. |
Well... Here is how I intend to do it. We check if love-android-sld2 has already been downloaded:
Then, we copy the love file in I also think it is better to parse the Manifest rather than use a predefined one, but that was a first try. I have noticed a thing that intriguated me in the docs.
It's not For the icons, it is a great problem. I think it requires another issue, we'll see later. I'd like to get this thing working first. |
if you are going to clone the As for the file location, thanks; I've updated to docs. The apk should be located here: And assuming you use |
Well your idea is not bad... to answer some questions, yeah the files are generated every time you compile, yes it s To parse the manifest I think that grep could work with -i -w -n and some processing in the output (I dont know how to use awk) |
1 similar comment
Well your idea is not bad... to answer some questions, yeah the files are generated every time you compile, yes it s To parse the manifest I think that grep could work with -i -w -n and some processing in the output (I dont know how to use awk) |
I had forget the
|
ndk build can take hours... I dont want to run ndk build every single time I compile an apk Your error seems to be a problem with android-sdk tools... someone had a similar issue wait a bit and I'll search |
No ! With this snippet, if it can't find the repo in the cache, it just clones the repo and then run the ndk-build, otherwise it checks if the repo is up-to-date. If it is not, git pull then it runs again the ndk-build. If the repo has already been downloaded, there is no need to run ndk-build, and only ant will be run later. if [ -d "$LOVE_ANDROID_DIR" ]; then
cd "$LOVE_ANDROID_DIR"
git checkout -- .
rm -rf src/com
LOCAL=$(git rev-parse @)
REMOTE=$(git rev-parse @{u})
BASE=$(git merge-base @ @{u})
if [ $LOCAL = $REMOTE ]; then
:
elif [ $LOCAL = $BASE ]; then
git pull
ndk-build --jobs $(( $(nproc) + 1))
fi
cd "$RELEASE_DIR"
else
cd "$CACHE_DIR"
git clone https://bitbucket.org/MartinFelis/love-android-sdl2.git
cd "$LOVE_ANDROID_DIR"
ndk-build --jobs $(( $(nproc) + 1))
cd "$RELEASE_DIR"
fi For the error, it must be someting I'm doing wrong with the AndroidManifest... IBM says it's because the XML is not valid. Need to check that. |
Okay ! It's done ! The build was failing because I left a new line at the beginning of the XML file. Now it should perfectely work. Still, if you could test it with differents projects, make sure it's working. |
Mmmm yeah that would work. What about parsing the xml? |
It's not really parsing, I guess, it's merely replacing strings... <application
android:label="LÖVE for Android" >
<activity
android:label="LÖVE for Android" > should go to <application
android:label="ProjectName ProjectVersion" >
<activity
android:label="ProjectName" > Maybe if I ask for a non-greedy search it will stop at the first occurence found and then I re-launch it to replace the second "LÖVE for Android". At the exception of this point, it should be easy to do. But for now it'll have to wait a couple of hours. And should I keep the |
I have erased the predefined AndroidManifest, and replaced it with this: MAINTAINER_USERNAME=${MAINTAINER_NAME// /_}
ACTIVITY=${PROJECT_NAME// /_}Activity
ANDROID_VERSION=$(grep -Eo -m 1 "[0-9]+.[0-9]+.[0-9]+[a-z]*" "$LOVE_ANDROID_DIR"/AndroidManifest.xml)
ANDROID_LOVE_VERSION=$(echo $ANDROID_VERSION | grep -Eo "[0-9]+.[0-9]+.[0-9]+")
if [ "$LOVE_VERSION" != "$ANDROID_LOVE_VERSION" ]; then
echo "Love version ($LOVE_VERSION) differs from love-android-sdl2 version ($ANDROID_LOVE_VERSION)."
else
mkdir -p "$LOVE_ANDROID_DIR"/assets
cp "$PROJECT_NAME".love "$LOVE_ANDROID_DIR"/assets/game.love
cd "$LOVE_ANDROID_DIR"
sed -i "s/org.love2d.android/com.${MAINTAINER_USERNAME}.${PACKAGE_NAME}/" AndroidManifest.xml
sed -i "s/$ANDROID_VERSION/${ANDROID_VERSION}-${PACKAGE_NAME}-v${PROJECT_VERSION}/" AndroidManifest.xml
sed -i "0,/LÖVE for Android/s//$PROJECT_NAME $PROJECT_VERSION/" AndroidManifest.xml
sed -i "s/LÖVE for Android/$PROJECT_NAME/" AndroidManifest.xml
sed -i "s/GameActivity/$ACTIVITY/" AndroidManifest.xml
# ...
fi |
Okay... I think it's done. An android package must be released alone, it is not possible to make at the same time a release for (by example) Windows or another Debian package. Just to prevent some ugly things that could happen. OPERATING SYSTEMS
ANDROIDNote that every argument passed to the options should be alphanumerical, with eventual underscores (i.e. [a-zA-Z0-9_]), otherwise you'll get errors. Now I have to merge the changes, and there are a few things that needs to be rewritten in the whole script. I am going to open #3 about icons support. Thanks ! |
I am trying to make the script support the Löve port to android, but it doesn't work yet. See the branch love-release/tree/android.
Try it with command
-a
(might be temporary).It requires that you have a working Android NDK installed, see Building LÖVE for Android, and also Git and Ant must be installed.
I'm trying to reproduce and automates the steps described in Game packaging.
Any advices or contributions of any kind would be helpful.
The text was updated successfully, but these errors were encountered: