• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Problems with multidexing in Air 25

Contributor ,
Apr 12, 2017 Apr 12, 2017

Copy link to clipboard

Copied

Hi,

I left a comment on this ticket: Tracker​ , but it looks like it's maybe considered resolved now because nobody responded. Multidexing support is not working for us.

What we are seeing is that any classes moved to classes2.dex are not available at runtime ( listed using dexdump classes2.dex | grep 'Class descriptor' ). So for example an ANE referencing classes that get put in the secondary dexfile will crash the app with Fatal Exception: java.lang.NoClassDefFoundError.

Does anyone out there have an app that uses multidexing and doesn't have this issue?

TOPICS
Air beta

Views

1.9K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Apr 12, 2017 Apr 12, 2017

Copy link to clipboard

Copied

Just an update:

I tried putting just the class referenced by the NoClassDefFoundError in the keepfile (no others) and it actually caused the build to only use one dexfile, which also took care of the crash. I don't know why or how this happened but I guess it will be fine for now.

I'm thinking you might want to tell people that starting with this version of AIR, rather than failing the build, if their app has >65k functions in it, AIR will quietly switch to multidex mode which means they'll have to add lines to that keep file to avoid crashing. You should probably also provide a way to disable multidex (or document it if one already exists). Since it seems like all classes in ANEs need to be in the main dexfile, why not have the packager handle that automatically? It's awkward that we have to modify a file in the AIR SDK directory to do this, and it's time-consuming to figure out which classes need to be included in it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Apr 17, 2017 Apr 17, 2017

Copy link to clipboard

Copied

Hey,

Is it possible for you to share the project? We will be able to give you better suggestions after looking at the project.

We can't add all the ANEs to the main dex file in the package, as it might again cause the main dex file to cross the limit of 64k.

Thanks,

Rohit

Adobe AIR Team

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Apr 17, 2017 Apr 17, 2017

Copy link to clipboard

Copied

My post detailed the way I was able to solve our problem for the time being, and suggested that you guys provide more complete documentation of how to use this feature - for example, how to add classes from an ANE to the secondary dexfile and still have it work properly - as well as a way to disable it in the build if desired. Not quite sure how sending you our source code is related to those things, and in any case I can't, any more than you can send me the source code to the closed-source portions of AIR/Flash.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 19, 2017 Apr 19, 2017

Copy link to clipboard

Copied

Could it be that you are testing on a device with an Android version < 5.0 ?

We've made the experience, that it works fine on Android 5.0+, but not on older version.

It may have to do with with the fact that Android < 5.0 requires a support library to be able to run multidex builds (see https://developer.android.com/studio/build/multidex.html

(especially the paragraph "Multidex support prior to Android 5.0")

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Apr 19, 2017 Apr 19, 2017

Copy link to clipboard

Copied

Hm no this was with 5.1, although if this could break in other ways on android 4.x then it shouldn't be listed as supported in the system requirements. Like I said, adding the one class mentioned in the class-not-found error to the keepfile fixed it. But I don't know why, and I don't know what was wrong with that class being in the secondary file in the first place. It was totally trial and error. I'd rather have documentation about how to correctly use this feature, and the ability to disable it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jul 24, 2017 Jul 24, 2017

Copy link to clipboard

Copied

I think we finally have a solution to this multidex issue on Android < 5. It's actually turned out to be a lot simpler than we had first approached it and would appreciate if everyone could double check our findings.

Firstly make sure you are using AIR 25+ (recommend using 26).

Then change the manifest additions for the application tag to match the following and use the MultiDexApplication:

<manifest android:installLocation="auto">

    <!-- PERMISSIONS -->

    <application android:name="android.support.multidex.MultiDexApplication">

        <!-- ACTIVITIES / RECEIVERS / SERVICES -->

    </application>

</manifest>

air native extensions // https://airnativeextensions.com

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 15, 2018 Mar 15, 2018

Copy link to clipboard

Copied

LATEST

A bit of a delayed reply...

I tried adding android:name="android.support.multidex.MultiDexApplication" to the application tag. This does indeed fix the problems we were having with Multidex builds on Android < 5. (I'm using AIR SDK 29 beta at the moment)

That is a great help! Thanks a lot!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines