Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Gradle 3.2.0 crashes app on launch

Discussion in 'Android' started by mboog12, Jul 19, 2019.

  1. mboog12

    mboog12

    Joined:
    Oct 4, 2011
    Posts:
    61
    Hi everyone!

    I am trying to create an app bundle for Google Play using the Build App Bundle check from BuildSettings. The bundle should contain all three architectures: x86, ARMv7 and ARM64.

    I'm using a custom mainTemplate.gradle and for building the App Bundle I have to set "com.android.tools.build:gradle" to version 3.2.0. The problem is that with this gradle version my app crashes right on launch but if I use 3.0.0 the app works fine (but the App Bundle build fails).

    Crash error from Monitor.bat :

    07-19 13:19:48.033: E/AndroidRuntime(31506): java.lang.RuntimeException: Unable to instantiate application android.support.multidex.MultiDexApplication: java.lang.ClassNotFoundException: Didn't find class "android.support.multidex.MultiDexApplication" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/<my app>-CL5QNweziJv6wfVPWDMNsg==/base.apk"],nativeLibraryDirectories=[/data/app/<my app>-CL5QNweziJv6wfVPWDMNsg==/lib/arm64, /data/app/<my app>-CL5QNweziJv6wfVPWDMNsg==/base.apk!/lib/arm64-v8a, /system/lib64]]

    07-19 13:19:48.033: E/AndroidRuntime(31506): Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.multidex.MultiDexApplication" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/<my app>-CL5QNweziJv6wfVPWDMNsg==/base.apk"],nativeLibraryDirectories=[/data/app/<my app>-CL5QNweziJv6wfVPWDMNsg==/lib/arm64, /data/app/<my app>-CL5QNweziJv6wfVPWDMNsg==/base.apk!/lib/arm64-v8a, /system/lib64]]
     
  2. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    759
    Do you have any androidx.* files in your Assets/Plugins/Android folder?
     
  3. mboog12

    mboog12

    Joined:
    Oct 4, 2011
    Posts:
    61
    No, I don't, but i have this 2 lines in my mainTemplate :
    it.setProperty("android.useAndroidX", true)
    it.setProperty("android.enableJetifier", true)

    I solved it by changing this line :
    android:name="android.support.multidex.MultiDexApplication"
    in :
    android:name="androidx.multidex.MultiDexApplication"
    in my AndroidManifest.
     
  4. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    759
    Yes, you need to change from android.support to androidx.* if you are using androidX libraries.
    As your mainTemplate is patched with androidX(by Play Services Resolver most likely), the above change should work fine.