繁体   English   中英

应用(9.2)和第三方库(8.4)中不同Google Play服务版本之间的冲突

[英]Conflicts between different Google Play Services versions in an app (9.2) and a third party library (8.4)

我正在使用Android Studio的Android项目中工作。

该项目是一个使用某些第三方库的应用程序。 其中一个使用Google Play Services 8.4.0,但我的应用程序使用Google Play Services 9.2.0,我需要将此版本用于该应用程序的某些特定功能。

当我使用此依赖项编译和执行应用程序时

编译'com.google.android.gms:play-services-gcm:9.2.0'compile'c​​om.google.android.gms:play-services-location:9.2.0'

当我执行应用程序并执行第三部分库的代码时,我得到此错误(总结):

致命异常:主要进程:com.example.app,PID:507 java.lang.NoClassDefFoundError:失败的解析:Lcom / google / android / gms / maps / model / LatLng; 引起:java.lang.ClassNotFoundException:在路径上找不到类“com.google.android.gms.maps.model.LatLng”:DexPathList

如果我将Google Play服务版本降级到8.4.0就可以了,问题是我必须从应用中删除我的应用Google Play Services 9.2.0功能。

有没有办法强制第三方图书馆使用自己的Google Play Services Library版本并允许我的应用使用上一个Google Play服务版本?

更新到9.xx版本时,有很多关于Google Play服务的问题/问题截至目前,我认为它仍然存在一些bug问题

现在,对于收到java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.maps.model.LatLng" on path: DexPathList的错误java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.maps.model.LatLng" on path: DexPathList 这是您用于谷歌地图API的jar文件的问题。 检查罐子或下载适当的罐子。 您可以反编译jar并查看有关类的信息。 类文件不存在,因为它在日志中提到。

您还可以尝试其他解决方案是这个SO问题:

在项目build.gradle中使用它

 dependencies {
    classpath 'com.android.tools.build:gradle:2.1.2'
    classpath 'com.google.gms:google-services:3.0.0'
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

并在你的app build.gradle中使用它

repositories {
    mavenCentral()
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'

    compile 'com.android.support:appcompat-v7:24.0.0'
    compile 'com.android.support:design:24.0.0'
    compile 'com.google.android.gms:play-services-auth:9.2.0'
    compile 'com.android.support:cardview-v7:24.0.0'
    compile 'com.android.support:support-v4:24.0.0'
    compile 'com.mcxiaoke.volley:library-aar:1.0.0'

}
apply plugin: 'com.google.gms.google-services'

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM