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 Export : 'Use Custom Build' option DOES NOT USE 'Custom Template' setttings, for android_debug.apk and android_release.apk #43817

Closed
ginobean opened this issue Nov 24, 2020 · 13 comments

Comments

@ginobean
Copy link

Godot version:

3.2.3.stable

OS/device including version:

Linux, Android, GLES2.

Issue description:

I enabled the Android export option: 'Use Custom Build'. I also specified custom templates, for both the debug and release versions, as I wanted to use script encryption.

When I built and deployed the resulting app, on my Android device, it was UNABLE to read the encrypted scripts.

As a check, I unset the 'Use Custom Build' option only, and then was able to run my app fine, which indicates that the custom templates I had built, to use scrip encryption, were working fine.

Looking into this matter, it looks like the custom build option, instead of using the custom build templates (<custom_location>/android_debug.apk and <custom_location>/android_release.apk), were actually using .aar files from
the project's local
android/build/libs/debug/godot-lib.debug.aar
and android/build/libs/release/godot-lib.release.aar

As a further test and workaround, I copied my custom built godot engine's .aar files (which incorporated the script encryption) to the aforementioned locations, and was able to get my app to run successfully..

Ideally, the 'Use Custom Build' option should be able to pick up the custom templates and use them, if they are specified.

As it is now, the combo of 'Use Combo Build' and custom templates, for Android export, doesn't really work as one would expect..

@Calinou
Copy link
Member

Calinou commented Nov 24, 2020

When you use a custom Android build, you won't be using pre-built APK files as they will be built during the export process (using Gradle). Therefore, the Custom Template section simply can't be made to work in this case.

Now, I wonder what we should do:

  • Add custom Android build fields where you can specify AAR files to use. More versatile and less confusing, but requires adding two new fields.
  • Change the existing Custom Template fields to accept AAR files to use when Use Custom Build is enabled.

@ginobean
Copy link
Author

I'm not all that familiar with AAR files, but couldn't you dynamically generate suitable AAR files from the custom apk templates?
Then, it would effectively work as users would expect it to work..

@m4gr3d
Copy link
Contributor

m4gr3d commented Feb 17, 2021

I'm not all that familiar with AAR files, but couldn't you dynamically generate suitable AAR files from the custom apk templates?

@ginobean At build time, the aar files are unpacked within the apk, so once you have the final apk, it's not possible to retrieve the aar from it.

@kristijandraca
Copy link

Documentation should be more clear about this. There is no mention that you can't mix android build templates with custom apks

@Calinou
Copy link
Member

Calinou commented Mar 1, 2021

@kristijandraca Feel free to open a pull request to update the documentation 🙂

@serogbp
Copy link

serogbp commented May 26, 2021

Hi, I have a Godot Android project (Godot 3.3.2.stable) with NativeLib and some plugins.
I wanted to use script encryption but I can't get it to work (with custom export templates and the encryption key).

I was about to open a new issue.

If I understand correctly, does this issue mean that you can't use script encryption and plugins together?

Thanks in advance

@kristijandraca
Copy link

@serogbp try to build a custom export template for debug and release, and instead of using them, just replace android/build/libs aar files with ones that you generated with custom export.

@serogbp
Copy link

serogbp commented May 27, 2021

Thank you so much @kristijandraca, it worked!

@blurrred
Copy link

Thank you so much @kristijandraca. I have been struggling with this for weeks and it was the only thing keeping me from releasing my app. Thank you, thank you, thank you.

@randazzle
Copy link

I believe the mentioned issue exists in 3.4 stable as well, since I've been trying to get it to work as well.

Also thank you @kristijandraca . Your solution worked for me as well!

@Calinou
Copy link
Member

Calinou commented Dec 8, 2022

@randazzle Feel free to open a pull request to update the documentation 🙂

@WoodShack
Copy link

@serogbp try to build a custom export template for debug and release, and instead of using them, just replace android/build/libs aar files with ones that you generated with custom export.

THANK YOU!!!

@m4gr3d
Copy link
Contributor

m4gr3d commented May 30, 2023

Custom Build has been renamed to Gradle Build in Godot 4.x, which should resolve the confusion about assuming it's related to Custom templates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants