1

This is what my build.gradle(Module:app) file looks like

apply plugin: 'com.android.application'
android {
    compileSdkVersion 23
    buildToolsVersion '23.0.0'
    packagingOptions {
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
    }
    defaultConfig {
        applicationId "com.ryde.chris.ryde"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.0.0'
    compile 'com.android.support:design:23.0.0'
    compile 'com.android.support:recyclerview-v7:23.0.0'
    compile 'com.melnykov:floatingactionbutton:1.3.0'
    compile 'com.google.android.gms:play-services:8.4.0'
    compile 'com.parse.bolts:bolts-android:1.+'
    compile 'com.parse:parse-android:1.+'
    compile 'com.firebase:firebase-client-android:2.0.3+'
}

When I tried building the app and deploying it to a GenyMotion emulator, I get this exception(with stack trace)

java.lang.NoClassDefFoundError: com.google.android.gms.R$string
at com.google.android.gms.measurement.zza.<init>(Unknown Source)
at com.google.android.gms.measurement.zza.zzaR(Unknown Source)
at com.google.android.gms.measurement.internal.zzn.zziJ(Unknown Source)
at com.google.android.gms.measurement.internal.zzz.zza(Unknown Source)
at com.google.android.gms.measurement.internal.zzw.<init>(Unknown Source)
at com.google.android.gms.measurement.internal.zzaa.zzDj(Unknown Source)
at com.google.android.gms.measurement.internal.zzw.zzaT(Unknown Source)
at com.google.android.gms.measurement.AppMeasurementContentProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1591)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1562)
at android.app.ActivityThread.installProvider(ActivityThread.java:4774)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4369)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4309)
at android.app.ActivityThread.access$1500(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)

I tried building/deploying the app multiple times to different emulators to make sure that this wasn't a one time thing or a single emulator thing.

From looking at the stack trace, I saw that it had nothing to do with any of the code I wrote so I am assuming this is some build/gradle issue.

One thing I found regarding this issue on StackOverflow was this but that had to do with rstyleable not being defined, not Rstring. The solution to that issue was to include a dependency to Google Play Services library which I have done in my build.gradle.

Another thing I found was this. In this case com.google.android.gms.R$string was missing but that user's stack trace looks different than mine(that one has more lines with GooglePlayServices in it). The proposed solution in that thread was again to make sure you included the GooglePlayServices dependency. Unlike that stack trace, my stack trace gave no indication that any Google Play Services resource file was missing.

Does anyone know what the issue is or how I could fix this?

Community
  • 1
  • 1
committedandroider
  • 8,711
  • 14
  • 71
  • 126

0 Answers0