【发布时间】:2020-06-07 20:09:37
【问题描述】:
我在两个项目中使用这个版本的 Glide
compile 'com.github.bumptech.glide:glide:3.7.0'
我不知道如何以及为什么,但 Android Studio 无法解析符号“asBitmap() 和 GlideAnimation
Glide.with(this).load(path).asBitmap().override(200, 200).into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(Bitmap resource, GlideAnimation glideAnimation) {
RoundedBitmapDrawable circularBitmapDrawable = RoundedBitmapDrawableFactory.create(getResources(), resource);
circularBitmapDrawable.setCircular(true);
mImageViewProfilePic.setImageDrawable(circularBitmapDrawable);
}
@Override
public void onLoadFailed(Exception e, Drawable errorDrawable) {
// Do something.
mImageViewProfilePic.setImageDrawable(getResources().getDrawable(R.drawable.placeholder_photo_profile));
}
});
现在它要求我像在版本 4+ 中一样使用它?
public void onResourceReady(Bitmap resource, Transition<? super Bitmap> transition) {
即使在那之后它也无法解决这个方法....
然后我尝试删除 Glide 库,但项目仍然找到导入(“import com.bumptech.glide.request.animation.GlideAnimation”除外)
我清理、重建、使缓存无效....我有与我的其他项目相同的东西,它运行良好。
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 27
buildToolsVersion "27.0.2"
useLibrary 'org.apache.http.legacy'
dexOptions {
javaMaxHeapSize "4g"
jumboMode true
}
defaultConfig {
applicationId "fr.my.app"
minSdkVersion 17
targetSdkVersion 27
versionCode 6
versionName "2.1"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
}
buildTypes {
debug {
buildConfigField "boolean", "PRE_PROD", "false"
applicationIdSuffix '.debug'
versionNameSuffix '.D'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
}
ext.ANDROID_SUPPORT_LIBRARY_VERSION = "27.0.2"
ext.GOOGLE_PLAY_VERSION = "11.8.0"
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:' + ANDROID_SUPPORT_LIBRARY_VERSION
implementation 'com.android.support:support-v4:' + ANDROID_SUPPORT_LIBRARY_VERSION
implementation 'com.android.support:design:' + ANDROID_SUPPORT_LIBRARY_VERSION
implementation 'com.android.support:cardview-v7:' + ANDROID_SUPPORT_LIBRARY_VERSION
implementation 'com.google.android.gms:play-services-location:' + GOOGLE_PLAY_VERSION
implementation 'com.google.android.gms:play-services-places:' + GOOGLE_PLAY_VERSION
implementation 'com.google.android.gms:play-services:' + GOOGLE_PLAY_VERSION
implementation 'com.google.maps.android:android-maps-utils:0.5'
// Graph Lib
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
// Android NetWorking Retrofit
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.4.1'
implementation 'com.squareup.okhttp3:okhttp:3.4.1'
implementation 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
implementation 'com.squareup.okio:okio:1.13.0'
// JSON Parsing
implementation 'com.google.code.gson:gson:2.6.1'
implementation 'com.squareup.retrofit2:converter-gson:2.1.0'
//The string required for Firebase integration
implementation 'com.google.firebase:firebase-core:' + GOOGLE_PLAY_VERSION
implementation 'com.google.firebase:firebase-messaging:' + GOOGLE_PLAY_VERSION
implementation('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
transitive = true;
}
//SMOOCH
implementation 'io.smooch:core:latest.release'
implementation 'io.smooch:ui:latest.release'
implementation 'uk.co.chrisjenx:calligraphy:2.1.0'
implementation 'com.aurelhubert:ahbottomnavigation:2.1.0'
// AWESOOOOOOME TOAST LIB
implementation 'com.irozon.sneaker:sneaker:1.0.2'
// PHONE NUMBER LIB
implementation('com.lamudi.phonefield:phone-field:0.1.3@aar') {
transitive = true
}
implementation 'de.greenrobot:eventbus:2.4.0'
implementation 'com.android.support:multidex:1.0.1'
implementation 'com.facebook.android:facebook-login:[4,5)'
// PHOTO LOADER
implementation'com.github.bumptech.glide:glide:3.7.0'
}
apply plugin: 'com.google.gms.google-services'
更新 1
我在我的外部库中看到 gradle 正在构建版本 4.6.1
我试图删除 .iml 和 .idea 文件夹...没有变化 Glide 仍然是 bug,即使我删除了 lib,仍然存在。
更新 2
compile group: 'com.github.bumptech.glide', name: 'glide', version: '4.6.1'
然后我在我的代码中更新了 Glide 的方法,现在我收到了这条消息:
Multiple dex files define Lcom/google/android/gms/internal/zzcms
我尝试将 GOOGLE_PLAY_VERSION 更改为 gms 并将 firebase 更改为相同但没有更改。
【问题讨论】:
-
尝试使用最新版本,看看它是否有效。最新版本是4.7.0
标签: android android-glide