rhomobile / rhodes

The Rhodes framework is a platform for building locally executing, device-optimized mobile applications for all major smartphone devices.
http://tau-platform.com/
MIT License
1.05k stars 237 forks source link

Too many field references to fit in one dex file #1094

Closed jurinco closed 1 year ago

jurinco commented 2 years ago

I am using rhodes 7.4 and everything is Ok.

I want to use the last rhodes 7.5, but it seems that my app requires multidex support.

I am using barcode and I have a plugin that requires this libraries:

Error: trouble writing output: Too many field references to fit in one dex file: 73261; max is 65536. You may try using multi-dex. If multi-dex is enabled then the list of classes for the main dex list is too large.

How can I enable multidex support?

alex-epifanoff commented 2 years ago

@jurinco Have you tried to update your Android toolchain ( build-tools at least ).

jurinco commented 2 years ago

Yes, I have updated to build-tools version 32

alex-epifanoff commented 2 years ago

We're looking into if we can/need to enable multidex in Rhodes build system. Meanwhile did you try steps described here?

hramovnik commented 2 years ago

@jurinco could you please provide your build.yml. Basically I need your minsdk and targetsdk.

Android 5.0 (API level 21) and higher uses a runtime called ART which natively supports loading multiple DEX files from APK files. ART performs pre-compilation at app install time which scans for classesN.dex files and compiles them into a single .oat file for execution by the Android device. Therefore, if your minSdkVersion is 21 or higher multidex is enabled by default, and you do not need the multidex library.

jurinco commented 2 years ago

@hramovnik minsdk is 23

android: minSDK: 23 targetSDK: 31

so with this minsdk using rake device:android:production multiple classesN.dex files are generated?

hramovnik commented 2 years ago

No, it's just means that it is in android sdk. Well, after some investigation, I should say that this is not a simple task to do. Multidex in android is not just as simple as put one flag. We need to change base class for activities, add some changes in proguard rules, add some dependencies in maven. It take a lot of time and we haven't got it. Also it potentially can broke some our code... so, I gess the better way out is removing some dependencies. Also, please try to check if it still creates this kind of problem in our last eversion from master branch (use build tools v32 of android, and remove 33 if it installed).

alex-epifanoff commented 1 year ago

@jurinco were you able to workaround this?

jurinco commented 1 year ago

yes, thanks for the help.

alex-epifanoff commented 3 months ago

@jurinco FWIF, a patch for the issue was provided. Pending for the stable build.

jurinco commented 3 months ago

It is very interesting to support multidex, when will it be integrated into the master code? I have also had problems with https, version 7.7.0 mentions some changes in this regard? Is it in the master now?