0

程序将正常运行。但是通过删除错误标记,我想防止潜在的危险。

我的 targetSdkVersion 是 26。所以我将所有 Gradle 版本统一为 26。但是,Android 工作室警告说 25.2.0 仍然存在,并且它是混合版本。但是,无论怎么看,我都没有看到25.2.0。

All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). 
Found versions 26.1.0, 25.2.0. Examples include com.android.support:animated-vector-drawable:26.1.0 and com.android.support:mediarouter-v7:25.2.0

There are some combinations of libraries, or tools and libraries, that are incompatible, or can lead to bugs. One such incompatibility is compiling with a version of the Android support libraries that is not the latest version(or in particular, a version lower than your targetSdkVersion.)

在此处输入图像描述


无论我如何搜索,我都找不到“Gradle Version 25”。而且我在警告中找不到“com.android.support:mediarouter-v7:25.2.0”。为什么会出现这句话?

(错误弹出:实现'com.android.support:appcompat-v7:26.1.0')


apply plugin: 'com.android.application'

android {

    signingConfigs {
        release {
            keyAlias 'key'
            keyPassword 'abcde'
            storeFile file('C:/Users/aaaa/.AndroidStudio2.3/key.jks')
            storePassword 'aaaaaaa'
        }
    }


    compileSdkVersion 26

    defaultConfig {

        applicationId "com.example.aaaaa.abcde"
        minSdkVersion 16
        targetSdkVersion 26
        versionCode 1
        multiDexEnabled true
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    buildToolsVersion '26.0.2'


    productFlavors {
    }
}

dependencies {
    compile 'com.android.support:multidex:1.0.1'
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.android.support:support-v4:26.1.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'


    // Login php Connect
    compile 'com.android.volley:volley:1.0.0'
    implementation 'com.google.android.gms:play-services:11.8.0'




    // Open source plus
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    compile group: 'com.kakao.sdk', name: 'kakaolink', version: project.KAKAO_SDK_VERSION
    compile project(':airquality-release')
    compile 'com.android.support:appcompat-v7:26.1.0'
    compile "com.github.katoro:typekit:1.0.1"  
    compile 'com.android.support:design:26.1.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:support-v4:26.1.0'
    testCompile 'junit:junit:4.12'
}

我查看了 Gradle 子文件夹中的所有其他文件,但找不到 25 跟踪。(下面除了附上的代码,还有其他文件,但我没有附上,因为大概10行短代码。)

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

// Open source plus
subprojects {
    repositories {
        mavenCentral()
        maven { url 'http://devrepo.kakao.com:8088/nexus/content/groups/public/' }
    }
}

allprojects {
    repositories {
        // Open source plus
        maven { url 'https://jitpack.io' }
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
4

1 回答 1

0

让你的 build.gradle(Module:project) 像下面的代码......

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

并使您的 build.gradle(Module:app) 像下面的代码一样,您可以添加自己有用的依赖项并删除我未使用的依赖项。

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "talent4assure.com.manageyourrestaurant"
        minSdkVersion 16
        targetSdkVersion 26
        versionCode 4
        versionName "1.0.3"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        targetCompatibility JavaVersion.VERSION_1_7
        sourceCompatibility JavaVersion.VERSION_1_7
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.android.support:support-v4:26.1.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    compile 'com.android.support:design:26.+'
    compile 'com.android.support:cardview-v7:26.+'
    compile 'com.weiwangcn.betterspinner:library-material:1.1.0'
    compile 'de.hdodenhof:circleimageview:2.2.0'
    compile 'com.squareup.retrofit2:retrofit:2.0.2'
    compile 'com.squareup.retrofit2:converter-gson:2.0.2'
    compile 'com.squareup.okhttp3:okhttp:3.5.0'
    compile 'com.github.bumptech.glide:glide:3.7.0'
    implementation 'com.karumi:dexter:4.2.0'
    compile 'id.zelory:compressor:2.1.0'
    compile 'de.hdodenhof:circleimageview:2.2.0'
}
于 2018-02-08T12:23:22.620 回答