+2 votes

How to works android export? As i think it unpack template android_debug(release).apk, filling sections, parameters, place there assets (from pck zip) and native libs and then pack it again in apk and signs.
Where is directory which godot make these export manipulations? Or export script which do it?

asked Dec 11, 2019 in Engine by Nikas (36 points)
edited Dec 11, 2019 by Nikas

I don't think you would be able to edit the code in Android Studio, because I doubt that your game code is converted into Java/Kotlin at any stage. Would be interested to know if that's true though. Hopefully someone with an understanding of that process can offer some insight.

2 Answers

0 votes

AFAIK the game is never compiled to Android code. The export templates all work by putting all the assets (including scripts) into a .pck file that can be used by the templates. The export templates just read the pck files to run the game, similar to how Unity executables work. If you want custom Android code in your app, you'll need to compile the export templates yourself.

answered Dec 11, 2019 by andersmmg (418 points)

I don't need edit godot's code in android studio) And, of course, the game can't be convered to java)) But the android src's may be needed for customizing build result apk. For example, change build.gradle or create android app bundle (*.aab) to optimize size. For now I need put 2 platforms in one apk: arm64-v8a and armeabi-v7a - that make apk size x 2

But the Custom Build or compiling another android template isn't enough for creating aab, because the android template can't be opened in android studio to make ".aab" there.
I need filled or completed template for it, but android export doesn't produce it.

I see a way to fill the Custom Build template by "hands" putting into the template libs, parameters, godo pck in assets and change build.gradle and AndroidManifest.xml
or another way is to modify the GODOT_SRC/godot/platform/android/export/export.cpp which make filling the android template so it save resulting template after filing all sections and parameters

While more convenient, using AAB isn't a strict requirement to upload per-architecture APKs to Google Play. See Multiple APK support in the Android developer documentation.

I tryed upload 3 apk with different platforms: arm64-v8a, armeabi-v7a, x86 but Google Play don't publish it with a error about arm64-v8a requirement.
After several attempts, I came to the conclusion that it needed a platform arm64-v8a in each apk. So it seems multiple apk don't support anymore. Or i something done wrong.

0 votes

I found that GODOT_SRC/godot/platform/android/export/export.cpp transforms the android template to resulting apk. And it use godot cache directory for it: ~/.cache/godot but it makes all operations in memory and never save filled template on disk.

answered Dec 12, 2019 by Nikas (36 points)
edited Dec 12, 2019 by Nikas

Hi could you create the .aab file to upload play store?

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.