添加 glide 依赖项搞砸了 appcompat
Adding glide dependencies messed appcompat
我加了
implementation 'com.github.bumptech.glide:glide:4.4.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.4.0'
现在我有
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.ofir.gamesuggestion"
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
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.google.firebase:firebase-database:11.8.0'
implementation 'com.google.firebase:firebase-storage:11.8.0'
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.google.android.gms:play-services-maps:11.8.0'
compile 'com.google.android.gms:play-services-location:11.8.0'
compile 'com.google.android.gms:play-services-places:11.8.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'
implementation 'com.github.bumptech.glide:glide:4.4.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.4.0'
}
apply plugin: 'com.google.gms.google-services'
android 工作室抱怨。
所有 com.android.support 库必须使用完全相同的版本规范。
我不知道该怎么办,因为我的理解是 glide 不应该干扰 appcompt
在 Gradle 中,库支持版本与您的项目版本不匹配。请尝试使用 glide 3.7.0。
不幸的是,当您进入支持库时,您会遇到各种问题。
您可以设置 transitive=false 以确保您不会降低 Glide 依赖项并查看是否可以解决您的问题。
否则你可以确保你一直控制着版本。
因此,首先要确保您使用的 gradle 版本能够满足您的需求,显然越晚越好。
然后如果您要为 26 或更高版本构建,则需要在 google maven 存储库中添加。
allprojects {
repositories {
jcenter()
maven(){ url "https://maven.google.com" } //as of 26 must include for google dependencies
}
}
如果您有冲突的 gms 版本,这很常见,只需添加
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"
tools:replace="android:value" />
到您的应用程序标签中,完全按照我上面粘贴的方式。没有 pseduo 或替换值,只需按粘贴的原样使用即可。
接下来我通常在构建文件的顶部定义我的版本。
def gmsVersion = '11.2.2'
def googleSupportVersion = '-v7:'
def googleDesignVersion = '26.1.0'
def googleBuildTools = "26.0.1"
def firebaseVersion = "11.2.2"
这些有点过时了,因为这个项目已经几个月了,但你可以做最新的。
然后我引用我所有的支持并像这样推送:
// [START google support]
compile 'com.android.support:cardview' + googleSupportVersion + googleDesignVersion
compile 'com.android.support:appcompat' + googleSupportVersion + googleDesignVersion
compile 'com.android.support:recyclerview' + googleSupportVersion + googleDesignVersion
compile 'com.android.support:design:' + googleDesignVersion
compile 'com.android.support:gridlayout'+ googleSupportVersion + googleDesignVersion
compile 'com.android.support:support-v4:' + googleDesignVersion
compile 'com.android.support.constraint:constraint-layout:1.0.2'
// [END google support]
// [START gms_compile]
compile 'com.google.android.gms:play-services-base:11.2.2'
// [END gms_compile]
// [START firebase]
compile 'com.google.firebase:firebase-core:' + firebaseVersion
compile 'com.google.android.gms:play-services-base:' + firebaseVersion
compile 'com.google.firebase:firebase-messaging:' + firebaseVersion
compile 'com.google.firebase:firebase-appindexing:' + firebaseVersion
// [END firebase]
此外,如果您因为不匹配问题需要排除一个,您可以这样做:
// Recommended
compile('com.philliphsu:bottomsheetpickers:2.4.1') {
exclude group: 'com.android.support', module: 'appcompat-v7'
exclude group: 'com.android.support', module: 'design'
exclude group: 'com.android.support', module: 'gridlayout-v7'
}
然后我使用 Glide
compile 'com.github.bumptech.glide:glide:3.7.0'
如果您打算使用较新版本的 Glide,那很好,但如果您要使用,那么您需要确保覆盖、匹配或排除所有它的传递依赖项。
也把你的gradlewindow和运行Android的依赖拉出来看看循环什么拉进什么依赖,会帮你找出是什么版本正在被拉下。
不要把上面的版本当作字面意思,根据您的项目需要进行调整,但要确保它们在整个过程中保持一致。
我加了
implementation 'com.github.bumptech.glide:glide:4.4.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.4.0'
现在我有
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.ofir.gamesuggestion"
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
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.google.firebase:firebase-database:11.8.0'
implementation 'com.google.firebase:firebase-storage:11.8.0'
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.google.android.gms:play-services-maps:11.8.0'
compile 'com.google.android.gms:play-services-location:11.8.0'
compile 'com.google.android.gms:play-services-places:11.8.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'
implementation 'com.github.bumptech.glide:glide:4.4.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.4.0'
}
apply plugin: 'com.google.gms.google-services'
android 工作室抱怨。
所有 com.android.support 库必须使用完全相同的版本规范。
我不知道该怎么办,因为我的理解是 glide 不应该干扰 appcompt
在 Gradle 中,库支持版本与您的项目版本不匹配。请尝试使用 glide 3.7.0。
不幸的是,当您进入支持库时,您会遇到各种问题。
您可以设置 transitive=false 以确保您不会降低 Glide 依赖项并查看是否可以解决您的问题。
否则你可以确保你一直控制着版本。
因此,首先要确保您使用的 gradle 版本能够满足您的需求,显然越晚越好。
然后如果您要为 26 或更高版本构建,则需要在 google maven 存储库中添加。
allprojects {
repositories {
jcenter()
maven(){ url "https://maven.google.com" } //as of 26 must include for google dependencies
}
}
如果您有冲突的 gms 版本,这很常见,只需添加
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"
tools:replace="android:value" />
到您的应用程序标签中,完全按照我上面粘贴的方式。没有 pseduo 或替换值,只需按粘贴的原样使用即可。
接下来我通常在构建文件的顶部定义我的版本。
def gmsVersion = '11.2.2'
def googleSupportVersion = '-v7:'
def googleDesignVersion = '26.1.0'
def googleBuildTools = "26.0.1"
def firebaseVersion = "11.2.2"
这些有点过时了,因为这个项目已经几个月了,但你可以做最新的。
然后我引用我所有的支持并像这样推送:
// [START google support]
compile 'com.android.support:cardview' + googleSupportVersion + googleDesignVersion
compile 'com.android.support:appcompat' + googleSupportVersion + googleDesignVersion
compile 'com.android.support:recyclerview' + googleSupportVersion + googleDesignVersion
compile 'com.android.support:design:' + googleDesignVersion
compile 'com.android.support:gridlayout'+ googleSupportVersion + googleDesignVersion
compile 'com.android.support:support-v4:' + googleDesignVersion
compile 'com.android.support.constraint:constraint-layout:1.0.2'
// [END google support]
// [START gms_compile]
compile 'com.google.android.gms:play-services-base:11.2.2'
// [END gms_compile]
// [START firebase]
compile 'com.google.firebase:firebase-core:' + firebaseVersion
compile 'com.google.android.gms:play-services-base:' + firebaseVersion
compile 'com.google.firebase:firebase-messaging:' + firebaseVersion
compile 'com.google.firebase:firebase-appindexing:' + firebaseVersion
// [END firebase]
此外,如果您因为不匹配问题需要排除一个,您可以这样做:
// Recommended
compile('com.philliphsu:bottomsheetpickers:2.4.1') {
exclude group: 'com.android.support', module: 'appcompat-v7'
exclude group: 'com.android.support', module: 'design'
exclude group: 'com.android.support', module: 'gridlayout-v7'
}
然后我使用 Glide
compile 'com.github.bumptech.glide:glide:3.7.0'
如果您打算使用较新版本的 Glide,那很好,但如果您要使用,那么您需要确保覆盖、匹配或排除所有它的传递依赖项。
也把你的gradlewindow和运行Android的依赖拉出来看看循环什么拉进什么依赖,会帮你找出是什么版本正在被拉下。
不要把上面的版本当作字面意思,根据您的项目需要进行调整,但要确保它们在整个过程中保持一致。