简体   繁体   English

添加滑行依赖关系搞砸了appcompat

[英]Adding glide dependencies messed appcompat

I added 我加了

implementation 'com.github.bumptech.glide:glide:4.4.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.4.0'

so now I have 所以现在我有

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'

with android studio complaining. 与android studio抱怨。

All com.android.support libraries must use the exact same version specification. 所有com.android.support库都必须使用完全相同的版本规范。

I am not sure what to do with this as my understanding is that glide should not interfere with appcompt 我不确定该怎么做,因为我的理解是滑行不会干扰appcompt

In Gradle library support version mismatching with your project versions. 在Gradle库中,支持版本与您的项目版本不匹配。 Try with glide 3.7.0 instead. 请尝试使用滑行3.7.0。

Unfortunately when you get into the support libraries you hit all sorts of issues. 不幸的是,当您进入支持库时,会遇到各种各样的问题。

You can set transitive=false to make sure you don't bring down Glide dependencies and see if that fixes your issues. 您可以设置transitive = false,以确保您不降低Glide依赖项并查看是否可以解决您的问题。

Otherwise you can make sure you that you control the version all the way through. 否则,您可以确保完全控制版本。

So start by making sure you are using a gradle version that works for your needs as late of version as possible obviously. 因此,首先要确保使用的Gradle版本显然可以满足您的最新版本。

Then you want to add in the google maven repo if you are building for 26 or later. 然后,如果要构建26或更高版本,则要添加google maven存储库。

allprojects {
repositories {
    jcenter()
    maven(){ url "https://maven.google.com" } //as of 26 must include for google dependencies
    }
}

If you have conflicting gms VERSIONs which is common, simply add 如果您遇到通用的通用GMS版本冲突,只需添加

  <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"
               tools:replace="android:value" />

into your Application tag, exactly the way I pasted above. 完全按照我上面粘贴的方式放入您的Application标签。 there is not pseduo or replace values, just use exactly as pasted. 没有pseduo或替换值,仅使用粘贴时的值即可。

Next I typically define my versions at the top of my build file. 接下来,我通常在构建文件的顶部定义版本。

def gmsVersion = '11.2.2'
def googleSupportVersion = '-v7:'
def googleDesignVersion = '26.1.0'
def googleBuildTools = "26.0.1"
def firebaseVersion = "11.2.2"

These are a bit outdated as this project is a few months old now, but you can do latest. 这些项目已经过了几个月,所以有些过时了,但是您可以做最新的。

Then i reference all my supports and push like: 然后,我引用我所有的支持并按如下方式推送:

   // [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]

Also if you need to exclude one because of mismatch issues, you can do: 另外,如果由于不匹配问题而需要排除一个,则可以执行以下操作:

// 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'
}

then for Glide I use 然后我用滑翔机

  compile 'com.github.bumptech.glide:glide:3.7.0'

If you are going to use the newer version of Glide which is fine, but if you are then you need to make sure you override or match or exclude all it's transitive dependencies. 如果您打算使用较新版本的Glide,这很好,但是如果您要使用Glide,则需要确保覆盖,匹配或排除所有它的传递依赖项。

Also pull out your gradle window and run Android Dependencies to see the cycle of what pulls in what dependencies, it will help you find out what versions are being pulled down. 另外,拉出gradle窗口并运行Android Dependencies,以查看引入了哪些依赖关系的周期,这将帮助您找出要下拉的版本。

Don't take the above versions as literal, adjust for your project needs, but make sure they are consistent across. 请勿将以上版本当作文字,请根据您的项目需求进行调整,但请确保它们之间的一致性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM