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

后端 未结 8 1415
借酒劲吻你
借酒劲吻你 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:45

    I look into my code many time, and I look at each library I am using and I was able to fix it.

    First, like @BrainMiz said mutiDexEnabled should set it off. I just comment it instead of set it as false.

    defaultConfig {
         applicationId "com.package.name"
         minSdkVersion 16
         targetSdkVersion 23
         versionCode 1
         versionName "1.0"
         //multiDexEnabled true
    }
    

    Second, it is the dependencies. Since I don't have any jar in my libs folder I remove

      compile fileTree(dir: 'libs', include: ['*.jar'])
    

    also remove all not being used gms library, only add the one that being used. I have to give some credits to @Radix because I did found some error in my code regarding to the code that where I check if the device has google play store.

    dependencies {
        //compile fileTree(dir: 'libs', include: ['*.jar'])
        testCompile 'junit:junit:4.12'
    
        compile 'org.twitter4j:twitter4j-core:4.0.2'
        compile 'com.android.support:multidex:1.0.1'
        compile 'com.android.support:appcompat-v7:23.1.1'
        //compile 'com.google.android.gms:play-services:8.4.0'
        compile 'com.android.support:design:23.1.1'
        compile 'com.squareup.okhttp:okhttp:2.5.0'
        //compile 'com.android.support:support-v4:23.1.1'
        compile 'com.squareup.picasso:picasso:2.5.2'
        compile 'com.isseiaoki:simplecropview:1.0.8'
        compile 'com.qozix:tileview:2.0.7'
        compile 'com.android.support:cardview-v7:23.1.1'
        compile 'com.google.android.gms:play-services-gcm:8.4.0'
    }
    

提交回复
热议问题