gpt4 book ai didi

android - 无法同时添加 Google Play 服务和 Appcompat-v7 依赖项

转载 作者:搜寻专家 更新时间:2023-11-01 08:44:54 24 4
gpt4 key购买 nike

我正在尝试清理和更新项目中的库。作为其中的一部分,我从使用经典库文件夹依赖项转移到通过 gradle 来使用 Google Play 服务。编译调试时我开始收到 dexDebug 错误(请参阅 Android Studio - UNEXPECTED TOP-LEVEL EXCEPTION: )。据我了解,如果您以某种方式存在双重依赖,则会出现此错误。

下面是我的 gradle 文件的依赖项部分。如果我完全注释掉 appcompat-v7,一切正常。 play-services 是否已经依赖于 appcompatv7 并自动引入它或者发生了什么?

dependencies {
compile 'com.google.android.gms:play-services:7.0.0'
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.google.maps.android:android-maps-utils:0.3'

//compile files('libs/commons-codec-1.8-sources.jar')
compile files('libs/engine.io-client-0.2.3.jar')
compile files('libs/ffmpeg.jar')
compile files('libs/Java-WebSocket-1.3.0.jar')
compile files('libs/socket.io-client-0.1.3.jar')
//compile files('libs/javacpp.jar')
compile files('libs/javacv.jar')
compile files('libs/json-simple-1.1.1.jar')
compile files('libs/opencv.jar')
//compile files('libs/twitter4j-async-4.0.2.jar')
compile files('libs/twitter4j-core-4.0.2.jar')
//compile files('libs/twitter4j-media-support-4.0.2.jar')
//compile files('libs/twitter4j-stream-4.0.2.jar')

最佳答案

事实证明这个问题有一个完全重复的问题:

After update of AS to 1.0, getting "method ID not in [0, 0xffff]: 65536" error in project

我通过添加修复了它(仅此一项就可以修复原始问题):

defaultConfig {
...
multiDexEnabled true
}

并通过减少大量的 Google Play 服务,并仅使用它的子集(仅此一项也将解决原始问题):

dependencies {
//compile 'com.google.android.gms:play-services:7.0.0'
compile 'com.google.android.gms:play-services-maps:7.0.0'
compile 'com.google.android.gms:play-services-location:7.0.0'
compile 'com.google.android.gms:play-services-gcm:7.0.0'
compile 'com.google.android.gms:play-services-plus:7.0.0'
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.google.maps.android:android-maps-utils:0.3+'

compile files('libs/engine.io-client-0.2.3.jar')
compile files('libs/ffmpeg.jar')
compile files('libs/Java-WebSocket-1.3.0.jar')
compile files('libs/socket.io-client-0.1.3.jar')
compile files('libs/javacv.jar')
compile files('libs/json-simple-1.1.1.jar')
compile files('libs/opencv.jar')
compile files('libs/twitter4j-core-4.0.2.jar')

关于android - 无法同时添加 Google Play 服务和 Appcompat-v7 依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29405592/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com