Skip to content
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 build standup #24674

Merged
merged 5 commits into from Sep 9, 2018

Conversation

Projects
None yet
5 participants
@a1studmuffin
Copy link
Contributor

commented Aug 7, 2018

Hey team, I've spent the last few weeks burning the midnight oil standing up the Android build in mainline. With this PR you can now compile and run Cataclysm DDA on an Android device. See my additions to COMPILING.md for an overview and instructions on how to build an Android APK under Linux.

There is a new folder in the root of the repository android/ which contains the Android project files.

The rest of the changes are to game C++ files in src/ (as well as an Android.mk file). Almost all of the C++ changes are guarded for __ANDROID__ so they won't affect other platforms, with the exception of one or two minor additions.

I'd appreciate if anyone wants to skim over the changes and offer feedback. If you're attempting to get this running under Windows with Android Studio (I've got it building under Ubuntu and Windows here), ensure your git supports creation of symlinks.

Most of the C++ changes to random game files are just setting up input_contexts specifically for Android, often with manually registered buttons + descriptions to match the existing UI code. This is so that the Android quick shortcuts along the bottom of the touchscreen work even in cases where the game's UI code hasn't been refactored to use an input_context yet. I considered rewriting each of these UI screens to use input_contexts for all platforms, but that's a reasonably big job and I was hoping we could tackle it later on.

There's also a big hunk of Android-specific code sitting in sdltiles.cpp. Let me know if this is unpalatable and I can look at merging some of it into a separate C++ file containing Android-specific code, perhaps android.cpp/h.

Things that are still outstanding (but can happen after this PR):

  • Crash reporting (would be very useful to improve game reliability across devices)
  • Release APK signing with a keystore (though this shouldn't live in the public repository anyway)
  • Gradle project build steps for auto-generation of version.h and catabindings.cpp
  • SDL software renderer is still unreliable on a lot of devices
  • No Android-specific welcome screen. In my original port (https://github.com/a1studmuffin/Cataclysm-DDA-Android) I had a welcome screen explaining the Android touch controls. I've removed this to minimize C++ changes, but we may want to add something like this back in.
  • Custom data folder support (allowing more flexible user-control over save game locations, syncing with desktop versions via Dropbox/Google Drive synced folders on their device etc.)

Completed:

  • APKs can be thinned out as they currently contain lang files other than lang/mo (which aren't needed and take up about 25% of APK size) (175fc2d25d03c46cca95c5043f7217c93e2740e9)
@Inglonias

This comment has been minimized.

Copy link
Contributor

commented Aug 7, 2018

I'm a little confused as to what this PR does. Does this add an automagical Android build of the game whenever it updates, or just provide instructions for compiling my own APK and the resources to do so?

@a1studmuffin

This comment has been minimized.

Copy link
Contributor Author

commented Aug 7, 2018

@a1studmuffin a1studmuffin force-pushed the a1studmuffin:android-build-standup branch Aug 15, 2018

@ZhilkinSerg

This comment has been minimized.

Copy link
Contributor

commented Aug 25, 2018

Sorry for waiting for too long in the PR queue. I have Linux VM ready now, so I will try to compile this next week.

a1studmuffin added some commits Jul 16, 2018

Initial Android build standup. Merged all Cataclysm-DDA-Android code …
…with minor improvements and external dependencies for CleverRaven repo. Updated Android project to gradle. Updated COMPILING.md with Android instructions.
Replaced Android assets lang symlink with a more specific lang/mo sym…
…link. Reduces APK size by ~13MB and installed data files by ~53MB.

@a1studmuffin a1studmuffin force-pushed the a1studmuffin:android-build-standup branch to dd27233 Aug 26, 2018

@a1studmuffin

This comment has been minimized.

Copy link
Contributor Author

commented Aug 26, 2018

No problem at all, it's a decent chunk of code so I figured it'd be a while before someone had the time to check it out - thanks for having a look! I'll continue keeping the PR updated to latest to ensure there's no merge conflicts. Let me know if you run into any issues.

@a1studmuffin a1studmuffin changed the title [WIP] Android build standup Android build standup Aug 26, 2018

wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
unzip sdk-tools-linux-4333796.zip -d ~/android-sdk
rm sdk-tools-linux-4333796.zip
~/android-sdk/tools/bin/sdkmanager --update

This comment has been minimized.

Copy link
@ZhilkinSerg

ZhilkinSerg Aug 27, 2018

Contributor
zhilkin@ubuntu:~$ ~/android-sdk/tools/bin/sdkmanager --update
Warning: File /home/zhilkin/.android/repositories.cfg could not be loaded.      
[=======================================] 100% Computing updates...             

This comment has been minimized.

Copy link
@a1studmuffin

a1studmuffin Aug 28, 2018

Author Contributor

I believe this warning is "normal" for this Android toolchain version. It appears if the file it's looking for doesn't exist locally, but doesn't impact anything after that: https://askubuntu.com/questions/885658/android-sdk-repositories-cfg-could-not-be-loaded

@ZhilkinSerg

This comment has been minimized.

Copy link
Contributor

commented Aug 27, 2018

I guess it is working, but my VM hung up on 53% :(

image

export PATH=$PATH:$ANDROID_SDK_ROOT/tools
export PATH=$PATH:$ANDROID_NDK_ROOT

Install custom Android dependencies. From the root folder of the CDDA repository run:

This comment has been minimized.

Copy link
@ZhilkinSerg

ZhilkinSerg Aug 27, 2018

Contributor

I believe we should switch to Cataclysm-DDA folder before cloning.

This comment has been minimized.

Copy link
@a1studmuffin

a1studmuffin Aug 28, 2018

Author Contributor

Ah thanks, that's what I meant to say with "From the root folder of the CDDA repository run:". I've updated it in 583c4b6.

@ZhilkinSerg

This comment has been minimized.

Copy link
Contributor

commented Aug 27, 2018

Should I make Linux version with languages first?

image

@ZhilkinSerg

This comment has been minimized.

Copy link
Contributor

commented Aug 27, 2018

Didn't test it on the phone yet, but apk was built:

image

Updated COMPILING.md based on feedback
Gave a clearer explanation of which folder to change into before executing commands.
@Dyrewulfe

This comment has been minimized.

Copy link
Contributor

commented Aug 28, 2018

@a1studmuffin

I've built a branch off of this PR that uses precompiled dependencies(easier end user builds, and likely easier for the CI machinery to deal with), and adds some per build type flags for optimization. I'll PR it at your repo once I've finished testing everything out, if you're interested?(I felt I should say something early, before you rebase again.)

Show resolved Hide resolved COMPILING.md
@ZhilkinSerg

This comment has been minimized.

Copy link
Contributor

commented Aug 29, 2018

Successfully created, installed and run Release version. Initially had some troubles with signing apk, but read the instructions and everything went smooth.

@Dyrewulfe

This comment has been minimized.

Copy link
Contributor

commented Aug 30, 2018

@a1studmuffin
Sent ya a PR. a1studmuffin#1

Turns the build process into a one step operation(build environment not included.)

@kevingranade kevingranade merged commit 583c4b6 into CleverRaven:master Sep 9, 2018

4 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage decreased (-0.9%) to 23.401%
Details
gorgon-ghprb Build finished.
Details
@a1studmuffin

This comment has been minimized.

Copy link
Contributor Author

commented Sep 9, 2018

Woohoo! Thanks to everyone who tested this out, much appreciated.

@a1studmuffin a1studmuffin deleted the a1studmuffin:android-build-standup branch Sep 10, 2018

@AMurkin AMurkin referenced this pull request Sep 27, 2018

Closed

Launch issue #25876

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.