dependencies {
...
compile 'com.google.android.gms:play-services-ads:8.3.0'
compile 'com.github.AndroidDeveloperLB:MaterialPreferenceLibrary:5'
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.google.android.gms:play-services-identity:8.1.0'
compile 'com.google.android.gms:play-services-gcm:8.1.0'
compile 'com.onesignal:OneSignal:2.+@aar'
compile 'com.google.android.gms:play-services-analytics:8.1.0'
compile 'com.google.android.gms:play-services-location:8.1.0'
}
错误:
所有com.google.android.gms库必须使用完全相同的版本规范(混合版本可能导致运行时崩溃)。发现 版本8.3.0,8.1.0。例子包括 com.google.android.gms:play-services-ads:8.3.0和 com.google.android.gms:播放服务:8.1.0
答案 0 :(得分:3)
错误很明显:您使用的是两种不同版本的Google服务。
这是8.3.0:
compile 'com.google.android.gms:play-services-ads:8.3.0'
这些是8.1.0:
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.google.android.gms:play-services-identity:8.1.0'
compile 'com.google.android.gms:play-services-gcm:8.1.0'
compile 'com.google.android.gms:play-services-analytics:8.1.0'
compile 'com.google.android.gms:play-services-location:8.1.0'
使它们完全相同,并且可以使用。
请注意,8.1.0和8.3.0都很旧;将光标放在每一行上,单击Alt + Enter,Android Studio将建议您使用最新版本:
答案 1 :(得分:2)
用你的gradle尝试这个
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:support-v4:23.1.0'
compile 'com.android.support:recyclerview-v7:23.1.0'
compile 'com.google.android.gms:play-services-ads:8.3.0'
compile('com.mikepenz:materialdrawer:4.4.6@aar') {
transitive = true
}
testCompile 'junit:junit:4.12'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.github.mrengineer13:snackbar:1.2.0'
compile 'com.marshalchen.ultimaterecyclerview:library:0.3.18'
compile 'com.lsjwzh:materialloadingprogressbar:0.5.8-RELEASE'
compile 'com.mikepenz:google-material-typeface:2.1.2.1@aar'
compile 'com.github.AndroidDeveloperLB:MaterialPreferenceLibrary:5'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.google.android.gms:play-services-identity:8.3.0'
compile 'com.google.android.gms:play-services-gcm:8.3.0'
compile 'com.onesignal:OneSignal:2.+@aar'
compile 'com.google.android.gms:play-services-analytics:8.3.0'
compile 'com.google.android.gms:play-services-location:8.3.0'
}