首页 文章

所有com.android.support库必须使用完全相同的版本规范(混合版本可能导致运行时崩溃)

提问于
浏览
0

我已经将android studio更新为2.3 . 我已经搜索并应用了此论坛上提供的所有解决方案,但我的问题仍未解决 . 编译'com.android.support:appcompat-v7:25.3.0'此库依赖项显示错误

//Here is my build.gradle file

    apply plugin: 'com.android.application'

    android {
        compileSdkVersion 25
        buildToolsVersion "25.0.2"

        defaultConfig {
            applicationId "com.compass.islamicdirection"
            minSdkVersion 14
            targetSdkVersion 25
            versionCode 1
            versionName "1.0"
            multiDexEnabled true
        }
        dexOptions {
            javaMaxHeapSize "4g"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }

    dependencies {
        compile fileTree(include: ['*.jar'], dir: 'libs')
        compile 'com.android.support:appcompat-v7:25.3.0'
        compile 'com.google.android.gms:play-services:10.2.0'
        compile 'com.android.support:multidex:1.0.1'
        compile files('libs/StartAppInApp-3.5.2.jar')
    }

2 回答

  • 2

    该错误是因为 compile 'com.google.android.gms:play-services:10.2.0'

    首先,您需要检查您的SDK Manager是否在extras文件夹中安装了所有最新的Google软件包 . 然后,如果仍然发生错误,则再次构建项目,然后仅使用您需要的那些播放服务,如位置,广告等 .

    如果您只想使用位置api,请不要使用完整的Google Play服务 . 此外,几个不同的库会出现此问题 .

  • -2

    我有同样的问题,更改版本'com.android.support:appcompat-v7:25.3.0'

    对此:'com.android.support:appcompat-v7:25.0.2'

    25.0.2是你的buildToolsVersion .

相关问题