我在Android设备中添加了以下库,之后出现错误。
https://github.com/bumptech/glide/releases/download/v4.6.1/compiler-4.6.1.jar
https://github.com/bumptech/glide/releases/download/v4.6.1/glide-full-4.6.1.jar
错误:
Error:Execution failed for task ':app:javaPreCompileDebug'.
> Annotation processors must be explicitly declared now. The following dependencies on the compile classpath are found to contain annotation processor. Please add them to the annotationProcessor configuration.
- compiler-4.6.1.jar (compiler-4.6.1.jar) Alternatively, set android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath
= true to continue with previous behavior. Note that this option is deprecated and will be removed in the future. See https://developer.android.com/r/tools/annotation-processor-error-message.html for more details.
摇篮:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.usamaakmal.bookswap"
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(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.android.support:design:26.1.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'
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.3.0'
compile 'com.google.code.gson:gson:2.7'
compile 'com.jaredrummler:material-spinner:1.2.4'
compile 'com.mikhaellopez:circularimageview:3.0.2'
implementation 'com.android.support:cardview-v7:26.1.0'
}
最佳答案
无需将glide用作jar库。
只是使用它的依赖...
在项目-> build.gradle文件中:
添加此代码。
repositories {
mavenCentral()
google()
}
在应用程序build.gradle文件中:
添加此代码。
dependencies {
implementation 'com.github.bumptech.glide:glide:4.6.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'
}
希望对您有帮助。