How to build OF 0.9.8 for android 64bit

Cannot upload apk to google play store with 32 bit .so file. How to build .so file for 64 bit android.

This thread might have some info.

This is what I’ve been struggling with for the past 9 days or so.
I almost solved it today, with the help of @mkrebs in the end of this other thread.

The summary seems to be that mainly we need the recently-added 64-bit support that seems to have been added after version 0.10.1, so one needs to download the latest OF from github, run the script as mentioned in the notes for OF on Android setup, and you need to use specific numbers in the project’s build.gradle and in the, and maybe be running Android Studio 3.4.1.

And then… well, I managed to build a 64-bit arm APK today, and get it accepted by the Google Play Store! BUT now for some reason none of the APK’s are running even without code-signing, and it seems to be stuck now only building 64-bit-only APKs… and I don’t know why. Still trying to figure that out tonight.

And… er, I’m not sure why I’m just seeing this thread today and didn’t notice it wasn’t new. I guess I’m pretty tired at this point.

But if either of you found any useful information on this topic, I’d love to hear it.

And I also have a bounty set on my Stack Overflow question on this topic.

Did you upload the 32bit and 64bit build?

You have to upload first the 32bit apk, then the 64bit apk (it only works in this order).
You also have to increase the versionCode in the gradle file, after creating the 32bit apk and before the 64bit apk.

Thanks! I deduced those points the hard way yesterday, but it’s great to have confirmation!
Yeah, when I uploaded the 64-bit version first, the web site responded by getting stuck saying “Processing” forever.

I was able to upload them. It took some minutes before they were really live in the Play Store.

And then I discovered I had some other problem, I think with the libraries, which I am in the process of trying to resolve now:

What I am now seeing, is that ever since I built a 64-bit codesigned (but immediately crashing) APK yesterday, Android Studio 3.4.1 now seems to be stuck building only 64-bit APKs.

So after trying many things, I deleted all my non-OF libraries, and then ran the download_libraries script, and then created just a new blank OF project using (the pre-built OF 0.10.1’s) Android OF project generator for Windows. And it’s still showing the same problem. If I do a gradle sync or Rebuild All, Gradle shows it has built. But when I try to Run, I get a new issue that appeared after I did the 64-bit codesign yesterday, where it says the APK is 64-bit but the test device is 32-bit.

That was never an issue before.

I tried to use Android Studio to build only a codesigned 32-bit APK, and to say I wanted 32-bit APKs, but these (the only ways I think I know how to specify what platform to build for) have no effect, as seen in this screenshot:

I can build a 32-bit codesigned APK with the Generate Signed APK function, but Run or Debug still blocks running saying “the” APK only supports Arm 64-bit.

And, if I manually install the 32-bit APK by downloading it to a phone and installing it, it also just crashes immediately.

Before yesterday afternoon, it used to be able to run just fine.

After trying a bunch of things, evidently my problem is my OF/library versions, somehow. Maybe I didn’t install them correctly, or got a bad version somehow. Guess I need to re-try… or is there a known good version I can use that includes 64-bit Android support?

Oh… I think I see what I messed up. Will resume head-bonking later tonight.
… Argh, maybe not. I carefully re-did practically everything.
Deleted and restored from download Android Studio 3.4.1
Deleted and downloaded current nightly build zip of OF for Android.
Ran the project generator in the new OF and made a new blank project with no addons.
Typed in the ndk path.
Imported the new blank project. (got some zero-description IDE error from Android Studio)
Gradle said it loaded ok.
Tried to Make Project and got "Linker failed while linking
Tried to Make Project again and got the same thing.
Tried Clean and Rebuild and they didn’t get Gradle to do anything.
Tried Invalidate Cache and Restart.
Tried to Make Project again and again Linker failed while linking

I modified the project’s build.gradle numbers to what i had before.
Did Sync Project With Gradle Files and it said that completed successfully.
Tried to Make Project again and it says it completed successfully!
Ok… so I guess Project Generator doesn’t set up the build.gradle with numbers that work in Android Studio 3.4.1… ok…
If I try to Run, it not longer has the 65-bit APK thing, but it does say my minSdKApi(23) is greater than the deviceSDK(21)… I guess that means the phone I’m trying to test on. Ok, so I’d want it be lower… let’s see.
I set minSdkVersion.apiLevel = 21 in the project’s build.grade and Sync with Gradle. Says it worked.
Make Project … OK.

Ok, so NOW I’m back to that same situation with the screenshot above… for some reason “APK only supports arm64-v8a”.

It didn’t work before, but I try Select Build Variant and say Arm7 for both OF and the project, try to Make Project again… try to Run…


Hey, it actually ran… lovely do-nothing grey screen appears on phone…

Ok, now to do all the hullaballoo to get my actual project in and see if I can get it codesigned and onto the Play Store… wish me luck…

huh… ok… So, I eventually managed to get back to where I was at some point yesterday… I can build and run an Arm7 build, but it “unfortunately has stopped” even before the debugger gets started. I guess in theory now I can start trying removing things from my code to see if I can get it to work at all. Hmm.

Ok, so I managed to move my actual project’s code into the empty project, and get it to build and run again there.

I have learned several more things about the Android Studio UI. It has several problematic behaviors which seem to require an awful lot of things like:

  • Import from Gradle rather than Open a previous project when moving from one project to another, or both will load and sync at once.
  • Needing to tell it to re-sync with Gradle whenever anything changes in a Gradle file.
  • Needing to use the clear cache and restart function when changing some things.
  • Needing to Make Clean and rebuild after making some changes.
  • Use Task Manager to shut down multiple instances of adb.exe that get running and stuck.

Otherwise, things can happen where Android Studio may do things like disable the Select Build Variant option, or other complaints and malfunctions.

But it’s finally running again…
… tomorrow I’ll try to re-do the remaining steps to get a project that both builds AND has all the bits filled in for Android Studio, and see that it code-signs etc.

Ok, I finally got everything to work.
Project builds for 32-bit and 64-bit Arm.
Project codesigns.
Project still runs correctly using both codesigned APKs.
Project got set up and accepted and tested installing from Google App Store, still runs correctly on actual devices, etc.

I posted notes on what I did that worked here:

1 Like