Multidex installation failure

谁说胖子不能爱 提交于 2019-12-04 22:53:25

Try including compile 'com.android.support:multidex:1.0.1' in your build.gradle file.

check following steps this steps

1) Add dependency in your build.gradle file :

compile 'com.android.support:multidex:1.0.0'

2) Enable multidex and set heap size

defaultConfig {
    applicationId "your package name"
    minSdkVersion 19
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
    multiDexEnabled true
}

dexOptions {
    javaMaxHeapSize "4g"
}

3) In Application class add this

@Override
protected void attachBaseContext(Context base) {
    super.attachBaseContext(base);
    MultiDex.install(this);
}

4) Add this in your manifest in <application> tag :

android:name=".YourApplicationClassName"
  1. Make sure the application declared in the manifest file extends MultiDexApplication.
  2. Make sure your build.gradle file enabled multidexing and included the compile 'com.android.support:multidex:1.0.1' package dependency.
  3. Make sure your are not being trolled by Android Studio fast build. You can remove all build directories and install using the application using command line.
  4. If your application has flavours, make sure the installed flavor is using MultiDexApplication

Try this Inside your app level build.gradle file put the following line of code

android{
      //compielsdkVersion..
      //..
      //..
      vectorDrawables.useSupportLibrary = true
}

and in the Activity.java that you are using the CircularImageView put the following static block on the top of onCreate() method like this

    //...
   //....
    static {
            AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
        }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
   //...
   //...

previous solutions are ok but one missing thing MultiDexApplication

public class FireApp extends MultiDexApplication 

Add this line in your application tag in your manifest

android:name="android.support.multidex.MultiDexApplication"
hezi

On API 19 and 20, the library was trying to save "suppressed exceptions" in the loader.dexElementsSuppressedExceptions.

But the field is not there, it's in DexPathList, so the correct path is loader.pathList.dexElementsSuppressedExceptions.

Google has fixed it: https://android.googlesource.com/platform/frameworks/multidex/+/74e66b8013b5b9002f67e53825c189a18597b1e8%5E%21/#F0

You need to update multidex version to 1.0.2+.

I was facing the same problem on a Sony device running Android 4.3 (API 18) on debug build (release was ok). After trying every single solution out there and making sure to do everything right I was still not able to fix the issue.

As I was building and installing my APK using Android Studio for several devices I accidently found that if I try to build it for a Lollipop device once and then build it for an older version (below KitKat) it will run without the annoying MultiDex installation failed error.

Note that my own device which I use most often to build and test the app runs API 28.

this is a error in kitkat multidex,u can override the V19.install, cause dexElementsSuppressedExceptions is the field in dexPathList, not in loader. However, there is exception when dalvik do makeDexElements, but you get the wrong message insteadenter image description here

try including compile 'com.android.support:multidex:1.0.1' in your build.gradle file.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!