程序将正常运行。 但是通过删除错误标记,我想防止潜在的危险。
我的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
}
答案 0 :(得分:0)
使你的build.gradle(模块:项目)像下面的代码......
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'
}