簡體   English   中英

添加滑行依賴關系搞砸了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 studio抱怨。

所有com.android.support庫都必須使用完全相同的版本規范。

我不確定該怎么做,因為我的理解是滑行不會干擾appcompt

在Gradle庫中,支持版本與您的項目版本不匹配。 請嘗試使用滑行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" />

完全按照我上面粘貼的方式放入您的Application標簽。 沒有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'
}

然后我用滑翔機

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

如果您打算使用較新版本的Glide,這很好,但是如果您要使用Glide,則需要確保覆蓋,匹配或排除所有它的傳遞依賴項。

另外,拉出gradle窗口並運行Android Dependencies,以查看引入了哪些依賴關系的周期,這將幫助您找出要下拉的版本。

請勿將以上版本當作文字,請根據您的項目需求進行調整,但請確保它們之間的一致性。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM