我使用com.google.android.gms:play-services:8.4.0
。它在Lollipop中运行良好但在 Jelly Bean 4.2 中崩溃。我的代码如下:
in gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.myapp.myapp"
minSdkVersion 10
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.1'
compile 'com.android.support:design:23.0.1'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.squareup.retrofit:retrofit:2.0.0-beta1'
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.squareup.retrofit:converter-gson:2.0.0-beta1'
compile 'io.reactivex:rxandroid:1.0.1'
// Because RxAndroid releases are few and far between, it is recommended you also
// explicitly depend on RxJava's latest version for bug fixes and new features.
compile 'io.reactivex:rxjava:1.0.14'
compile 'com.android.support:recyclerview-v7:23.+'
compile 'com.android.support:cardview-v7:23.+'
compile 'com.squareup.picasso:picasso:2.5.2'
compile project(':aFileChoosers')
//compile project(':cRops')
compile project(':ucrop')
compile ('io.nlopez.smartlocation:library:3.2.0') {
transitive = false
}
}
apply plugin: 'com.google.gms.google-services'
我收到的消息如下:
03-04 20:35:39.838 27252-27252 / com.myapp.myapp E / AndroidRuntime:FATAL 例外:主03-04 20:35:39.838 27252-27252 / com.myapp.myapp E / AndroidRuntime:java.lang.NoClassDefFoundError: com.google.android.gms.R $ string 03-04 20:35:39.838 27252-27252 / com.myapp.myapp E / AndroidRuntime:at com.google.android.gms.measurement.zza。(未知来源)03-04 20:35:39.838 27252-27252 / com.myapp.myapp E / AndroidRuntime:at com.google.android.gms.measurement.zza.zzaR(未知来源)03-04 20:35:39.838 27252-27252 / com.myapp.myapp E / AndroidRuntime:at com.google.android.gms.measurement.internal.zzn.zziJ(未知来源) 03-04 20:35:39.838 27252-27252 / com.myapp.myapp E / AndroidRuntime:
在com.google.android.gms.measurement.internal.zzz.zza(未知来源) 03-04 20:35:39.838 27252-27252 / com.myapp.myapp E / AndroidRuntime:
在com.google.android.gms.measurement.internal.zzw。(未知 来源)03-04 20:35:39.838 27252-27252 / com.myapp.myapp E / AndroidRuntime:at com.google.android.gms.measurement.internal.zzaa.zzDj(未知来源) 03-04 20:35:39.838 27252-27252 / com.myapp.myapp E / AndroidRuntime:
在com.google.android.gms.measurement.internal.zzw.zzaT(未知 来源)03-04 20:35:39.838 27252-27252 / com.myapp.myapp E / AndroidRuntime:at com.google.android.gms.measurement.AppMeasurementContentProvider.onCreate(未知 来源)03-04 20:35:39.838 27252-27252 / com.myapp.myapp E / AndroidRuntime:at android.content.ContentProvider.attachInfo(ContentProvider.java:1058) 03-04 20:35:39.838 27252-27252 / com.myapp.myapp E / AndroidRuntime:
在 android.app.ActivityThread.installProvider(ActivityThread.java:5097) 03-04 20:35:39.838 27252-27252 / com.myapp.myapp E / AndroidRuntime:
在 android.app.ActivityThread.installContentProviders(ActivityThread.java:4680) 03-04 20:35:39.838 27252-27252 / com.myapp.myapp E / AndroidRuntime:
在 android.app.ActivityThread.handleBindApplication(ActivityThread.java:4613) 03-04 20:35:39.838 27252-27252 / com.myapp.myapp E / AndroidRuntime:
在android.app.ActivityThread.access $ 1300(ActivityThread.java:162) 03-04 20:35:39.838 27252-27252 / com.myapp.myapp E / AndroidRuntime:
在 android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1424) 03-04 20:35:39.838 27252-27252 / com.myapp.myapp E / AndroidRuntime:
在android.os.Handler.dispatchMessage(Handler.java:107)03-04 20:35:39.838 27252-27252 / com.myapp.myapp E / AndroidRuntime:at android.os.Looper.loop(Looper.java:194)03-04 20:35:39.838 27252-27252 / com.myapp.myapp E / AndroidRuntime:at android.app.ActivityThread.main(ActivityThread.java:5371)03-04 20:35:39.838 27252-27252 / com.myapp.myapp E / AndroidRuntime:at java.lang.reflect.Method.invokeNative(Native Method)03-04 20:35:39.838 27252-27252 / com.myapp.myapp E / AndroidRuntime:at java.lang.reflect.Method.invoke(Method.java:525)03-04 20:35:39.838 27252-27252 / com.myapp.myapp E / AndroidRuntime:at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:833) 03-04 20:35:39.838 27252-27252 / com.myapp.myapp E / AndroidRuntime:
在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)03-04 20:35:39.838 27252-27252 / com.myapp.myapp E / AndroidRuntime:at dalvik.system.NativeStart.main(原生方法)
我该如何解决?请任何人帮助我..非常感谢
答案 0 :(得分:0)
我修好了..只需将buildToolsVersion从23.0.1更改为23.0.2 ..也许gms-play-service 8.4.0与buildToolsVersion 23.0.1不匹配