缺少 gms.maps.GoogleMap 由于潜在的 Multi-Dex 问题导致重复 Class
Missing gms.maps.GoogleMap Because of Potential Multi-Dex Issue Results In Duplicate Class
我正在向我的项目添加 GoogleMap 视图。
根据我的研究,我需要补充:
compile 'com.google.android.gms:play-services-maps:8.1.0'
到我的构建依赖项(没有它我无法导入 import com.google.android.gms.maps.OnMapReadyCallback
)。
因此,当我添加该依赖项时,class 中的一切都很好,我可以导入并使用它。
然后我去编译,我得到了一个讨厌的错误:
Error:Execution failed for task
finished with non-zero exit value 2
经过研究,我确定这意味着我现在超过了 65k 的方法限制。
快进了,我为我的应用程序添加了多 dex 支持。现在我有一个新的错误,无法找到解决方案。
Execution failed for task ':packageAllDebugClassesForMultiDex'.
java.util.zip.ZipException: duplicate entry: com/google/android/gms/common/SignInButton.class
它显然是说有 2 个 class 具有相同名称的碰撞。但我不明白的是这怎么可能。这是我的编译依赖项。我没有看到任何重复的导入或潜在的冲突。你能告诉我还有什么地方可以寻找可能导致这次碰撞的地方吗?
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile 'com.android.support:support-v4:22.0.0'
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.google.android.gms:play-services-maps:8.1.0'
compile 'com.android.support:multidex:1.0.1'
compile project(':CordovaLib')
compile project(':app-FacebookLib')
compile files('libs/universal-image-loader-1.9.3.jar')
compile files('libs/twitter4j-core-4.0.4-SNAPSHOT.jar')
}
我项目的库文件夹中添加了一个 google-play-services.jar 文件,与此冲突。删除那个 jar 修复它。
我从这个答案中找到了重复项
我正在向我的项目添加 GoogleMap 视图。
根据我的研究,我需要补充:
compile 'com.google.android.gms:play-services-maps:8.1.0'
到我的构建依赖项(没有它我无法导入 import com.google.android.gms.maps.OnMapReadyCallback
)。
因此,当我添加该依赖项时,class 中的一切都很好,我可以导入并使用它。
然后我去编译,我得到了一个讨厌的错误:
Error:Execution failed for task finished with non-zero exit value 2
经过研究,我确定这意味着我现在超过了 65k 的方法限制。
快进了,我为我的应用程序添加了多 dex 支持。现在我有一个新的错误,无法找到解决方案。
Execution failed for task ':packageAllDebugClassesForMultiDex'.
java.util.zip.ZipException: duplicate entry: com/google/android/gms/common/SignInButton.class
它显然是说有 2 个 class 具有相同名称的碰撞。但我不明白的是这怎么可能。这是我的编译依赖项。我没有看到任何重复的导入或潜在的冲突。你能告诉我还有什么地方可以寻找可能导致这次碰撞的地方吗?
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile 'com.android.support:support-v4:22.0.0'
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.google.android.gms:play-services-maps:8.1.0'
compile 'com.android.support:multidex:1.0.1'
compile project(':CordovaLib')
compile project(':app-FacebookLib')
compile files('libs/universal-image-loader-1.9.3.jar')
compile files('libs/twitter4j-core-4.0.4-SNAPSHOT.jar')
}
我项目的库文件夹中添加了一个 google-play-services.jar 文件,与此冲突。删除那个 jar 修复它。
我从这个答案中找到了重复项