Skip to content Skip to sidebar Skip to footer

Building The New App-bundle For Android Dex Errors At Runtime

I'm building the new android app-bundle following the instructions at https://developer.android.com/guide/app-bundle/build but I'm getting an error when installing from the play st

Solution 1:

It looks like the class io.org.app.ui.loading.LoadingFragment is loaded by reflection, but your proguard file doesn't prevent that class from being obfuscated, so it has been renamed which explains why it can't be found.

I imagine you should get the same error when you deploy the release version of your app locally.

Try tweaking the proguard file to prevent the renaming of that class.


Solution 2:

I have same problem. Check that you add:

apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'

in your build.gradle files.


Solution 3:

Solved it. None of the above works. Cause it's compilerOptions error.

  compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

Solution 4:

Below I'm listing possible solutions, try this steps one by one:

  • 1 Delete app on device and Clean Project

  • 2 Disable minifyEnabled in debug mode

go to build.gradle(Module: app) in debug block and disable minifyEnabled:

buildTypes {

    debug {
        minifyEnabled false

     }
}
  • 3 Setting dataBinding to true in application's gradle file

In my case, I was including another layout <include layout="@layout/attached_layout" /> to my activity's layout and this solved it.

    android {
    ...
    ...
    ...

    dataBinding {
        enabled = true
    }

    }
  • 4 Check the relative path of your activities in manifest

eg:

<activity android:name="com.myExactPackageName.MyActivity"
  • 5 Check the package names in your custom views

    <com.myExactPackageName.MyCustomView
        android:id="@+id/myview"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="16dp"
        android:layout_marginRight="16dp" />
    
  • 6 Try disabling pre-dexing in the app build.gradle:

    dexOptions {
     preDexLibraries false
    }
    
  • 7 Disable Instant Run

    Go to File -> Settings -> Build,Execution, Deployment -> Instant Run -> Uncheck the checkbox for instant run

  • 8 Try MultiDexApplication

And this in build.gradle(Module:app)

android { 

defaultConfig {
      ...
      multiDexEnabled true
}

dependencies {
     ... 
    implementation 'androidx.multidex:multidex:2.0.1'
}


}

if you are using application class you have to extend it with MultiDexApplication instead of Application and add it to application tag in AndroidManifest.xml

<application
    android:name="com.myPackageName.MyApplication"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name">

else add MultiDexApplication class path from library as name

<application
    android:name="androidx.multidex.MultiDexApplication"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name">

Post a Comment for "Building The New App-bundle For Android Dex Errors At Runtime"