java.lang.NoClassDefFoundError: com.google.android.gms.R$string

后端 未结 8 1414
借酒劲吻你
借酒劲吻你 2021-01-18 08:00

I am having a little trouble with the complier, Same code I use on Nexus 5, no error. as Soon as I use it in Tablet, it crash right away and the error said

java.la

8条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-18 08:48

    Having same issue and was stuck for a whole day. Finally got solution.

    Add in your app level gradle.build:

    repositories {
      jcenter()
    }
    
    dependencies {
      compile 'com.google.android:multidex:0.1'
    }
    

    Then override attachBaseContext in your Application class like below:

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

    And don't forgot to enable mutlidex support as below:

    android {
        ...
        defaultConfig {
            ...
            multiDexEnabled true
        }
    }
    

提交回复
热议问题