Glide Version:4.7.1
Integration libraries:okhttp:3.10.0
Device/Android Version: not running
Issue details / Repro steps / Use case background:
I want to use Glide to display a RecyclerView of photos, so I added the following to my build.gradle
implementation('com.github.bumptech.glide:glide:4.7.1') {
exclude group: "com.android.support"
}
implementation("com.github.bumptech.glide:recyclerview-integration:4.7.1") {
transitive = false
}
kapt 'com.github.bumptech.glide:compiler:4.7.1'
and created the following class
@GlideModule
class MyAppGlideModule : AppGlideModule()
When I try to compile I get the following error:
e: [kapt] An exception occurred: java.lang.RuntimeException: javax.annotation.processing.FilerException: Illegal name unnamed package.GlideOptions
I don;t have any class named GlideOptions, or extending GlideOptions.
Glide load line / GlideModule (if any) / list Adapter code (if any):
I've not added any other code related to Glide, or its use than what is listed above.
Glide.with...
Not yet in effect, received the error immediately after adding MyAppGlideModule as above.
Layout XML:
<FrameLayout xmlns:android="...
Stack trace / LogCat:
[kapt] An exception occurred: java.lang.RuntimeException: javax.annotation.processing.FilerException: Illegal name unnamed package.GlideOptions
at com.bumptech.glide.annotation.compiler.ProcessorUtil.writeClass(ProcessorUtil.java:119)
at com.bumptech.glide.annotation.compiler.AppModuleProcessor.writeRequestOptions(AppModuleProcessor.java:161)
at com.bumptech.glide.annotation.compiler.AppModuleProcessor.maybeWriteAppModule(AppModuleProcessor.java:88)
at com.bumptech.glide.annotation.compiler.GlideAnnotationProcessor.process(GlideAnnotationProcessor.java:131)
at org.jetbrains.kotlin.kapt3.ProcessorWrapper.process(annotationProcessing.kt:131)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:794)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:705)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$1800(JavacProcessingEnvironment.java:91)
at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1035)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1176)
at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1170)
at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1068)
at org.jetbrains.kotlin.kapt3.AnnotationProcessingKt.doAnnotationProcessing(annotationProcessing.kt:87)
at org.jetbrains.kotlin.kapt3.AnnotationProcessingKt.doAnnotationProcessing$default(annotationProcessing.kt:45)
at org.jetbrains.kotlin.kapt3.AbstractKapt3Extension.runAnnotationProcessing(Kapt3Extension.kt:257)
at org.jetbrains.kotlin.kapt3.AbstractKapt3Extension.analysisCompleted(Kapt3Extension.kt:212)
at org.jetbrains.kotlin.kapt3.ClasspathBasedKapt3Extension.analysisCompleted(Kapt3Extension.kt:95)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM$analyzeFilesWithJavaIntegration$2.invoke(TopDownAnalyzerFacadeForJVM.kt:97)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(TopDownAnalyzerFacadeForJVM.kt:107)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration$default(TopDownAnalyzerFacadeForJVM.kt:84)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:374)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:64)
at org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport.analyzeAndReport(AnalyzerWithCompilerReport.kt:101)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyze(KotlinToJVMBytecodeCompiler.kt:365)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:130)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:161)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:63)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:107)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:51)
at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:96)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$1$1$2.invoke(CompileServiceImpl.kt:405)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$1$1$2.invoke(CompileServiceImpl.kt:98)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:920)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:98)
at org.jetbrains.kotlin.daemon.common.DummyProfiler.withMeasure(PerfUtils.kt:137)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.checkedCompile(CompileServiceImpl.kt:950)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.doCompile(CompileServiceImpl.kt:919)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:404)
at sun.reflect.GeneratedMethodAccessor92.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:346)
at sun.rmi.transport.Transport$1.run(Transport.java:200)
at sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: javax.annotation.processing.FilerException: Illegal name unnamed package.GlideOptions
at com.sun.tools.javac.processing.JavacFiler.checkName(JavacFiler.java:495)
at com.sun.tools.javac.processing.JavacFiler.checkNameAndExistence(JavacFiler.java:517)
at com.sun.tools.javac.processing.JavacFiler.createSourceOrClassFile(JavacFiler.java:396)
at com.sun.tools.javac.processing.JavacFiler.createSourceFile(JavacFiler.java:378)
at com.bumptech.glide.repackaged.com.squareup.javapoet.JavaFile.writeTo(JavaFile.java:114)
at com.bumptech.glide.annotation.compiler.ProcessorUtil.writeClass(ProcessorUtil.java:117)
... 53 more
I probably need to add that this is a multi-module Android application written in Kotlin 1.2.41
Okay, I solved the issue. It turns out that when I created the Kotlin file containing my AppGlideModule subclass that I inadvertently left out the package name (probably chose the File option instead of the Class option). I created a new test app copying relevant bits out of the broken app and everything worked. Then it struck me, "why doesn't that file have a package name?" (package headers are extraneous details I normally hide).
It would be nice if the error message was a bit more informative.
Probably doesn't need saying, but this issue can be closed.
Thanks. If you'd like, you could send a pull request that would throw an exception if this package name is empty: https://github.com/bumptech/glide/blob/b7c2b1360c777794c50351a10c30c08a3390b753/annotation/compiler/src/main/java/com/bumptech/glide/annotation/compiler/AppModuleProcessor.java#L84
Thanks for following up!
I wasnt able to solve this issue i have same issue please share your source file
Most helpful comment
Okay, I solved the issue. It turns out that when I created the Kotlin file containing my AppGlideModule subclass that I inadvertently left out the package name (probably chose the
Fileoption instead of theClassoption). I created a new test app copying relevant bits out of thebrokenapp and everything worked. Then it struck me, "why doesn't that file have a package name?" (package headers are extraneous details I normally hide).It would be nice if the error message was a bit more informative.