Jump to content
TurboMagic

12.0 Compilation problem for Android App

Recommended Posts

Hello,

 

when compiling my app (the Hash FMX demo from this project: DelphiEncryptionCompendium) with Delphi 12 for Android 32 bit debug mode
I get this failure message, while the same thing just works in 11.3. Compiling the FMX cipher demo for Android with 12.0 works though
(I just uploaded a new aab for app store publication).

 

Looking at the failure messages I wonder where on earth I should have gotten > 65536 methods in this project?!
My 12.0 installation is a standard one with the standard SDK/NDK and Java brought by the Delphi installation.

[PAClient Fehler] Fehler: E7688 ""C:\Program Files\Eclipse Adoptium\jdk-11.0.15.10-hotspot\bin\java.exe" -cp "c:\program files (x86)\embarcadero\studio\23.0\bin\Android\r8-8.0.40.jar" com.android.tools.r8.D8 --release --min-api 19 --output "D:\Projekte\DECGitMaster\Compiled\BIN_IDExx.x_Android__Demos\Hash_FMX.classes" @"D:\Projekte\DECGitMaster\Compiled\BIN_IDExx.x_Android__Demos\dex_list.txt"" kann nicht ausgeführt werden (Fehler 1)
[PAClient Fehler] Fehler: E7688 Picked up JAVA_TOOL_OPTIONS: 
[PAClient Fehler] Fehler: E7688 Error: Cannot fit requested classes in a single dex file (# methods: 86037 > 65536). Try supplying a main-dex list
[PAClient Fehler] Fehler: E7688 Compilation failed
[PAClient Fehler] Fehler: E7688 Exception in thread "main" java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, position: null
[PAClient Fehler] Fehler: E7688 	at com.android.tools.r8.utils.N0.a(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:119)
[PAClient Fehler] Fehler: E7688 	at com.android.tools.r8.D8.main(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:5)
[PAClient Fehler] Fehler: E7688 Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, position: null
[PAClient Fehler] Fehler: E7688 	at Version.fakeStackEntry(Version_8.0.40.java:0)
[PAClient Fehler] Fehler: E7688 	at com.android.tools.r8.utils.N0.a(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:74)
[PAClient Fehler] Fehler: E7688 	at com.android.tools.r8.utils.N0.a(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:27)
[PAClient Fehler] Fehler: E7688 	at com.android.tools.r8.utils.N0.a(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:26)
[PAClient Fehler] Fehler: E7688 	at com.android.tools.r8.utils.N0.b(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:2)
[PAClient Fehler] Fehler: E7688 	at com.android.tools.r8.D8.a(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:26)
[PAClient Fehler] Fehler: E7688 	at com.android.tools.r8.D8.b(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:13)
[PAClient Fehler] Fehler: E7688 	at com.android.tools.r8.D8.a(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:24)
[PAClient Fehler] Fehler: E7688 	at com.android.tools.r8.utils.N0.a(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:106)
[PAClient Fehler] Fehler: E7688 	... 1 more
[PAClient Fehler] Fehler: E7688 Caused by: com.android.tools.r8.utils.b: Cannot fit requested classes in a single dex file (# methods: 86037 > 65536)
[PAClient Fehler] Fehler: E7688 	at com.android.tools.r8.utils.E2.a(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:21)
[PAClient Fehler] Fehler: E7688 	at com.android.tools.r8.utils.E2.a(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:26)
[PAClient Fehler] Fehler: E7688 	at com.android.tools.r8.dex.t0.a(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:228)
[PAClient Fehler] Fehler: E7688 	at com.android.tools.r8.dex.o0.a(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:9)
[PAClient Fehler] Fehler: E7688 	at com.android.tools.r8.dex.k.a(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:51)
[PAClient Fehler] Fehler: E7688 	at com.android.tools.r8.dex.k.a(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:157)
[PAClient Fehler] Fehler: E7688 	at com.android.tools.r8.D8.d(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:152)
[PAClient Fehler] Fehler: E7688 	at com.android.tools.r8.D8.c(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:1)
[PAClient Fehler] Fehler: E7688 	at com.android.tools.r8.utils.N0.a(R8_8.0.40_1caf5950b946297b5c46a21a695cd28795208d72fd17f5129543b31a15a067c2:23)
[PAClient Fehler] Fehler: E7688 	... 6 more

 

Anybody any clue about the reason for this and how to fix it?

 

CHeers

TurboMagic

Share this post


Link to post
8 hours ago, TurboMagic said:

I get this failure message, while the same thing just works in 11.3

Check the minSdkVersion value in your projects AndroidManifest.template.xml file. If it's below 21, the packaging tools are unable to use multidex, thus the error. The > 65536 methods refers to how many methods are included in the jar files (in Project Manager, in the Libraries node under the relevant Android target), which grew substantially from Delphi 11.3 to Delphi 12.

 

If the minSdkVersion value is %minSdkVersion%, the IDE replaces it with the default supported value which is 23, in the resulting AndroidManifest.xml in the project output. If this is the case for you, there may be some other configuration issue.

 

  • Like 2

Share this post


Link to post

Another solution that also reduces the binary size is disabling unnecessary Java libraries. By default projects include all kinds of things, like Billing, FireBase, various Google Play services... and if they are not used in the application, they will just be a dead weight.  

  • Like 1
  • Thanks 1

Share this post


Link to post

i had somethling like that. Expand your target platforms, go to android 32 and 64, libraries, click with left button and select "revert system files to default"

Share this post


Link to post
On 12/10/2023 at 7:34 AM, TurboMagic said:

Could you solve it?, the same thing happens to me

 

Share this post


Link to post

Rename your AndroidManifest.tempate.xml to .old and do the same for other *tempate* files there (there are for Windows and iOS too)

Rebuild for the target platform

Deploy again from Project menu

 

then compare the .old files with the new ones created and see if you had any custom changes to the old tempates that you may wish to copy/adapt into the new ones (as said above can't go below Android SDK 21 for min target [haven't checked myself] though if you wanted to target much older devices [could build with older Delphi for them and deploy as .apk for sideloading])

 

update: maybe you can have min version <21 too with use of a library, see https://developer.android.com/build/multidex#mdex-gradle - not sure how easy is to adapt those instructions for Delphi though

 

if you change the templates try build+deploy again

Edited by George Birbilis

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×