簡體   English   中英

添加滑動依賴項時出現問題

[英]issue while adding glide dependencies

我在android中用java編寫了一個程序,當我添加Glide依賴項時

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

我的 android studio 開始給我這個錯誤:

“錯誤:無法解決:支持片段受影響的模塊:應用程序

錯誤:無法解決:動畫矢量繪制受影響的模塊:應用程序”

這是我的應用程序 bulid.gradle,顯示錯誤

過去一周我尋找任何類似的答案並嘗試所有答案,但我無法解決這個問題,當我刪除 Glide 依賴項時,一切又恢復正常。

這是我的應用模塊 build.gradle:

    apply plugin: 'com.android.application'

android {
compileSdkVersion 28
defaultConfig {
    applicationId "com.example.mohammad.kahgle"
    minSdkVersion 21
    targetSdkVersion 28
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    vectorDrawables.useSupportLibrary = true

}
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:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.github.armcha:ElasticView:0.1.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.google.android.gms:play-services-maps:16.1.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.nightonke:boommenu:2.1.1'
implementation 'com.ramotion.foldingcell:folding-cell:1.2.2'
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
implementation "com.android.support:support-core-utils:28.0.0"
implementation 'com.github.bumptech.glide:glide:4.9.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'

testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

我遇到了這個問題。 如果您不使用帶有 glide 的動畫矢量可繪制,請使用此代碼來排除無用的依賴項:

implementation ("com.github.bumptech.glide:glide:4.9.0"){
    exclude group: 'androidx.vectordrawable', module: 'vectordrawable-animated'
}

快樂編碼:)

使用以下庫在 minsdkversion 21 和 targetsdkversion 29 中解決此問題:

將這些添加到依賴項中:

implementation 'androidx.fragment:fragment:1.2.0-rc04'
implementation 'androidx.vectordrawable:vectordrawable:1.1.0'

並將滑翔版本降級到 4.8.0

implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.10.0'

將此添加到您的 build.gradle 文件中。 有關詳細信息,請參閱Glide 的下載部分

repositories {
  mavenCentral()
  google()
}

在您的應用程序模塊中啟用 vectorDrawables useSupportLibrary

android {
    compileSdkVersion 27
    defaultConfig {
        ....
        vectorDrawables.useSupportLibrary = true
    }
}

然后在依賴項中添加這個

dependencies {
    implementation 'com.android.support:support-vector-drawable:27.1.1'
}

用這個 :

 implementation 'com.github.bumptech.glide:glide:4.9.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
implementation group: 'androidx.fragment', name: 'fragment', version: '1.1.0'
implementation group: 'androidx.vectordrawable', name: 'vectordrawable-animated', version: '1.1.0'

解決辦法是刪除~/.gradle里面的caches文件夾,重新下載依賴。

添加:

 implementation 'androidx.fragment:fragment:1.2.0-alpha04' 
 implementation 'androidx.vectordrawable:vectordrawable:1.1.0' 
 implementation 'androidx.vectordrawable:vectordrawable-animated:1.1.0' 

app/gradle

暫無
暫無

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

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