我正在尝试为Glide实现AppGlideModule。
错误
GeneratedAppGlideModule with: []
要解决的步骤
com.android.support
从Glide中排除。annotationProcessor
而不是kapt
来编译和运行应用程序,但是仍然无法访问GlideApp
。 AppGlideModule与我尝试使用GlideApp对象的包相同。配置
实施
build.gradle(项目:carpecoin)
repositories {
google()
jcenter()
mavenCentral()
maven { url 'https://maven.google.com' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0-alpha05'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.0.2'
classpath "android.arch.navigation:navigation-safe-args-gradle-plugin:1.0.0-alpha04"
}
build.gradle(模块:应用)
apply plugin: 'kotlin-kapt'
implementation 'com.github.bumptech.glide:glide:4.7.1'`
//I've tried with and without this line for annotations implementation.
implementation 'com.github.bumptech.glide:annotations:4.7.1'
kapt 'com.github.bumptech.glide:compiler:4.7.1'
MyAppGlideModule
import com.bumptech.glide.annotation.GlideModule
import com.bumptech.glide.module.AppGlideModule
@GlideModule
class MyAppGlideModule : AppGlideModule()
所有已使用的外部库
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.0-rc01'
implementation 'androidx.legacy:legacy-support-v4:1.0.0-rc01'
implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
implementation 'androidx.cardview:cardview:1.0.0-rc01'
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
kapt "androidx.lifecycle:lifecycle-compiler:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-reactivestreams:$lifecycle_version" // use -ktx for Kotlin
implementation "androidx.paging:paging-runtime:$paging_version"
implementation "androidx.paging:paging-rxjava2:$paging_version"
implementation 'com.firebase:firebase-client-android:2.5.2'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-firestore:17.0.4'
implementation 'com.firebaseui:firebase-ui-firestore:4.1.0'
implementation 'com.jjoe64:graphview:4.2.2'
implementation 'io.reactivex.rxjava2:rxjava:2.2.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
implementation "android.arch.navigation:navigation-fragment:$nav_version" // use -ktx for Kotlin
implementation "android.arch.navigation:navigation-ui:$nav_version" // use -ktx fo
implementation 'com.github.bumptech.glide:glide:4.7.1'
kapt 'com.github.bumptech.glide:compiler:4.7.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
testImplementation "androidx.arch.core:core-testing:$lifecycle_version"
androidTestImplementation "android.arch.navigation:navigation-testing:$nav_version"
答案 0 :(得分:1)
将Glide的库升级到 4.8.0 后,成功生成了 GlideApp 。由于该应用是使用Kotlin构建的,因此正在使用 kapt 。
build.gradle (模块:应用)
implementation 'com.github.bumptech.glide:glide:4.8.0'
kapt 'com.github.bumptech.glide:compiler:4.8.0'