Android Databinding V2 fails for multi-module project - android

I have a multi-module Android project, with Kotlin, databinding v2, under Android Studio 3.1.3. Most of my databinding-enabled layouts are enclosed in library modules, which the final application module aggregates.
Problem starts when I want to add new layout in my application module, or override layout from one of library modules. After adding a test layout with <layout> tag to the application module, databinding stops generating, with the following error:
error: cannot find symbol
public static TestBinding bind(#NonNull View view, #Nullable DataBindingComponent component) {
^
symbol: class DataBindingComponent
location: class TestBinding
e: error: cannot generate view binders java.lang.NullPointerException
at android.databinding.tool.store.SetterStore.getMatchingMultiAttributeSetters(SetterStore.java:633)
at android.databinding.tool.store.SetterStore.getMultiAttributeSetterCalls(SetterStore.java:520)
at android.databinding.tool.BindingTarget.resolveMultiSetters(BindingTarget.java:220)
at android.databinding.tool.LayoutBinder.<init>(LayoutBinder.java:256)
at android.databinding.tool.DataBinder.<init>(DataBinder.java:55)
at android.databinding.tool.CompilerChef.ensureDataBinder(CompilerChef.java:95)
at android.databinding.tool.CompilerChef.sealModels(CompilerChef.java:259)
at android.databinding.annotationprocessor.ProcessExpressions.writeResourceBundle(ProcessExpressions.java:213)
at android.databinding.annotationprocessor.ProcessExpressions.onHandleStep(ProcessExpressions.java:111)
at android.databinding.annotationprocessor.ProcessDataBinding$ProcessingStep.runStep(ProcessDataBinding.java:203)
at android.databinding.annotationprocessor.ProcessDataBinding$ProcessingStep.access$000(ProcessDataBinding.java:188)
at android.databinding.annotationprocessor.ProcessDataBinding.doProcess(ProcessDataBinding.java:90)
at android.databinding.annotationprocessor.ProcessDataBinding.process(ProcessDataBinding.java:65)
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.GeneratedMethodAccessor101.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:357)
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:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
All DataBindingComponent interfaces from library modules are being generated, only the one from the application module is not generated.

I've had similar issue after migrating to androidx namespace. Make sure you've updated:
1.your gradle wrapper to 4.10.1 in gradle-wrapper-properties
2.you use gradle build plugin 3.3.0-beta-1
With this configuration everything works fine. Make also sure you don't have any databinding kapt or apt annotated dependencies in app.gradle as since 3.2.0 it is already bundled to gradle

Related

While using dagger 2 : e: [kapt] An exception occurred: java.lang.IllegalArgumentException: void

I am using dagger2 and after adding some view model injection code, I get this error:
e: [kapt] An exception occurred: java.lang.IllegalArgumentException: void
at com.sun.tools.javac.model.JavacTypes.getDeclaredType0(JavacTypes.java:252)
at com.sun.tools.javac.model.JavacTypes.getDeclaredType(JavacTypes.java:222)
at dagger.internal.codegen.langmodel.DaggerTypes.getDeclaredType(DaggerTypes.java:345)
at dagger.internal.codegen.BindsTypeChecker.desiredAssignableType(BindsTypeChecker.java:71)
at dagger.internal.codegen.BindsTypeChecker.isAssignable(BindsTypeChecker.java:56)
at dagger.internal.codegen.BindsMethodValidator$Validator.checkParameter(BindsMethodValidator.java:92)
at dagger.internal.codegen.BindingMethodValidator$MethodValidator.checkParameters(BindingMethodValidator.java:209)
at dagger.internal.codegen.BindsMethodValidator$Validator.checkParameters(BindsMethodValidator.java:77)
at dagger.internal.codegen.BindingMethodValidator$MethodValidator.checkAdditionalProperties(BindingMethodValidator.java:144)
at dagger.internal.codegen.BindingElementValidator$ElementValidator.validate(BindingElementValidator.java:145)
at dagger.internal.codegen.BindingElementValidator$ElementValidator.access$000(BindingElementValidator.java:129)
at dagger.internal.codegen.BindingElementValidator.validateUncached(BindingElementValidator.java:78)
at dagger.internal.codegen.Util.reentrantComputeIfAbsent(Util.java:93)
at dagger.internal.codegen.BindingElementValidator.validate(BindingElementValidator.java:74)
at dagger.internal.codegen.AnyBindingMethodValidator.validateUncached(AnyBindingMethodValidator.java:99)
at dagger.internal.codegen.Util.reentrantComputeIfAbsent(Util.java:93)
at dagger.internal.codegen.AnyBindingMethodValidator.validate(AnyBindingMethodValidator.java:74)
at dagger.internal.codegen.ModuleValidator.validateUncached(ModuleValidator.java:189)
at dagger.internal.codegen.ModuleValidator.lambda$validate$0(ModuleValidator.java:169)
at dagger.internal.codegen.Util.reentrantComputeIfAbsent(Util.java:93)
at dagger.internal.codegen.ModuleValidator.validate(ModuleValidator.java:169)
at dagger.internal.codegen.ModuleValidator.validate(ModuleValidator.java:163)
at dagger.internal.codegen.ModuleProcessingStep.process(ModuleProcessingStep.java:98)
at dagger.internal.codegen.ModuleProcessingStep.process(ModuleProcessingStep.java:47)
at dagger.internal.codegen.TypeCheckingProcessingStep.lambda$process$0(TypeCheckingProcessingStep.java:51)
at com.google.common.collect.RegularImmutableMap.forEach(RegularImmutableMap.java:185)
at dagger.internal.codegen.TypeCheckingProcessingStep.process(TypeCheckingProcessingStep.java:48)
at dagger.internal.codegen.ModuleProcessingStep.process(ModuleProcessingStep.java:89)
at dagger.internal.codegen.ModuleProcessingStep.process(ModuleProcessingStep.java:47)
at dagger.internal.codegen.DaggerStatisticsCollectingProcessingStep.process(DaggerStatisticsCollectingProcessingStep.java:52)
at dagger.shaded.auto.common.BasicAnnotationProcessor.process(BasicAnnotationProcessor.java:330)
at dagger.shaded.auto.common.BasicAnnotationProcessor.process(BasicAnnotationProcessor.java:181)
at org.jetbrains.kotlin.kapt3.base.incremental.IncrementalProcessor.process(incrementalProcessors.kt)
at org.jetbrains.kotlin.kapt3.base.ProcessorWrapper.process(annotationProcessing.kt:147)
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.base.AnnotationProcessingKt.doAnnotationProcessing(annotationProcessing.kt:79)
at org.jetbrains.kotlin.kapt3.base.AnnotationProcessingKt.doAnnotationProcessing$default(annotationProcessing.kt:35)
at org.jetbrains.kotlin.kapt3.AbstractKapt3Extension.runAnnotationProcessing(Kapt3Extension.kt:230)
at org.jetbrains.kotlin.kapt3.AbstractKapt3Extension.analysisCompleted(Kapt3Extension.kt:188)
at org.jetbrains.kotlin.kapt3.ClasspathBasedKapt3Extension.analysisCompleted(Kapt3Extension.kt:99)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM$analyzeFilesWithJavaIntegration$2.invoke(TopDownAnalyzerFacadeForJVM.kt:96)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(TopDownAnalyzerFacadeForJVM.kt:106)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration$default(TopDownAnalyzerFacadeForJVM.kt:81)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:555)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:82)
at org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport.analyzeAndReport(AnalyzerWithCompilerReport.kt:107)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyze(KotlinToJVMBytecodeCompiler.kt:546)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:177)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:164)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:54)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:84)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:42)
at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:104)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1558)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
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:357)
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:573)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:834)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:kaptDebugKotlin'.
> Compilation error. See log for more details
I don't know much about it, why this occurred, but also tried some solution and updating versions of kotlin and dagger2 but didn't work.
Let me know if something else is needed to put in the code.
I just suffered through this exact error. Make sure that you're returning a ViewModel from your module function (provides or binds) e.g.
#Binds
#IntoMap
#ViewModelKey(AuthenticationViewModel::class)
abstract fun bindsAuthViewModel(authViewModel: AuthenticationViewModel) :ViewModel
I'm writing kotlin for the first time in a while and I forgot to add the :ViewModel to return the dependency that'll get injected wherever.
Good luck!
In a problem similar to the one described in #bibangamba 's answer, it can also happen when using dagger.android and not returning the AndroidInjector.Factory<*> type for the injector factory's binding function declaration:
#Module(subcomponents = [
ChatComponent::class
])
interface ChatModule {
#Binds
#IntoMap
#ClassKey(ChatFragment::class)
abstract fun bindChatFragmentInjectorFactory(
factory: ChatComponent.Factory
): AndroidInjector.Factory<*>
}

Kotlin room database crash on kotlin 1.2.40 version

after upgrading to kotlin 1.2.40 I have the following error at build:
e: [kapt] An exception occurred: java.lang.NoClassDefFoundError: org/jetbrains/kotlin/serialization/jvm/JvmProtoBufUtil
at me.eugeniomarletti.kotlin.metadata.KotlinClassMetadata$data$2.invoke(KotlinMetadata.kt:51)
at me.eugeniomarletti.kotlin.metadata.KotlinClassMetadata$data$2.invoke(KotlinMetadata.kt:50)
at kotlin.SynchronizedLazyImpl.getValue(Lazy.kt:131)
at me.eugeniomarletti.kotlin.metadata.KotlinClassMetadata.getData(KotlinMetadata.kt)
at android.arch.persistence.room.ext.KotlinMetadataProcessor$DefaultImpls.getParameterNames(KotlinMetadataProcessor.kt:33)
at android.arch.persistence.room.processor.PojoProcessor.getParameterNames(PojoProcessor.kt:73)
at android.arch.persistence.room.processor.PojoProcessor.getParamNames(PojoProcessor.kt:245)
at android.arch.persistence.room.processor.PojoProcessor.chooseConstructor(PojoProcessor.kt:263)
at android.arch.persistence.room.processor.PojoProcessor.doProcess(PojoProcessor.kt:207)
at android.arch.persistence.room.processor.PojoProcessor.access$doProcess(PojoProcessor.kt:73)
at android.arch.persistence.room.processor.PojoProcessor$process$1.invoke(PojoProcessor.kt:104)
at android.arch.persistence.room.processor.PojoProcessor$process$1.invoke(PojoProcessor.kt:73)
at android.arch.persistence.room.processor.cache.Cache$Bucket.get(Cache.kt:46)
at android.arch.persistence.room.processor.PojoProcessor.process(PojoProcessor.kt:101)
at android.arch.persistence.room.processor.EntityProcessor.doProcess(EntityProcessor.kt:68)
at android.arch.persistence.room.processor.EntityProcessor.access$doProcess(EntityProcessor.kt:50)
at android.arch.persistence.room.processor.EntityProcessor$process$1.invoke(EntityProcessor.kt:57)
at android.arch.persistence.room.processor.EntityProcessor$process$1.invoke(EntityProcessor.kt:50)
at android.arch.persistence.room.processor.cache.Cache$Bucket.get(Cache.kt:46)
at android.arch.persistence.room.processor.EntityProcessor.process(EntityProcessor.kt:56)
at android.arch.persistence.room.processor.DatabaseProcessor.processEntities(DatabaseProcessor.kt:248)
at android.arch.persistence.room.processor.DatabaseProcessor.doProcess(DatabaseProcessor.kt:63)
at android.arch.persistence.room.processor.DatabaseProcessor.process(DatabaseProcessor.kt:53)
at android.arch.persistence.room.RoomProcessor$DatabaseProcessingStep.process(RoomProcessor.kt:57)
at com.google.auto.common.BasicAnnotationProcessor.process(BasicAnnotationProcessor.java:318)
at com.google.auto.common.BasicAnnotationProcessor.process(BasicAnnotationProcessor.java:171)
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:1039)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1180)
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.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
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: java.lang.ClassNotFoundException: org.jetbrains.kotlin.serialization.jvm.JvmProtoBufUtil
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 77 more
After I changed to version 1.2.30 in my build-gradle the build worked, but now I have a mismatch between the version used by gradle (1.2.30) and the one bundled into the IDE plugin (1.2.40).
Is there anything I am doing wrong with the new kotlin version ? Or how can I downgrade to the 1.2.30 version ?
Thank you for the attention.
You can downgrade by downloading a plugin zip corresponding to your android studio version here: http://plugins.jetbrains.com/plugin/6954-kotlin
And use Settings | Plugins | Install plugin from disk and select the downloaded zip file.
The problem is that they've introduced a binary incompatibility in compiler-embeddable in Kotlin 1.2.40. There're a few options right now:
Downgrade Kotlin to the 1.2.30
Use the latest Kotlin version with the stable Room version (1.1.0). Then you must substitute the kotlin-compiler-embeddable dependency (see below).
Use the latest Kotlin version with the latest Room version (1.1.0-rc1). They've fix bug in RC1.
I'd use the 3d way and keep an eye on the Room's releases. But if you choose the 2nd one then you must insert this in your root build.gradle:
subprojects {
configurations.all {
resolutionStrategy {
eachDependency {
if (requested.name == "kotlin-compiler-embeddable") {
useVersion("1.2.30")
}
}
}
}
}

Could not get unknown property 'manifestFile'

in Android studio gradle versions
distributionUrl=https\://services.gradle.org/distributions-snapshots/gradle-4.5-20171123235935+0000-all.zip
classpath 'com.android.tools.build:gradle:3.1.0-alpha04'
its getting this error
Error:Could not get unknown property 'manifestFile' for task ':backend:generateDebugRFile' of type com.android.build.gradle.internal.res.GenerateLibraryRFileTask.
Trying to change gradle, Studio version etc no affect
First off, regular caveats about using pre-release (alpha) software apply: if you don't need to use the alpha for any particular reason, consider using the stable versions instead. Right now that means
Android Studio 3.0.1
Android Gradle Plugin 3.0.1 (a.k.a. com.android.tools.build:gradle:3.0.1)
With that out of the way....it could be that the 3.1.0-alpha04 plugin removed support for manifestFile, and some other plugin you're using still depends on that. After all, the tools team did remove the similarly-named manifestOutputFile in 3.0.
I tried building a project with
Gradle dist 4.4-rc-3
Android Gradle plugin 3.1.0-alpha04
Fabric Gradle plugin 1.25.0
that applied the fabric plugin and got an error message that looks a lot like the one you posted:
Caused by: groovy.lang.MissingPropertyException: Could not get unknown property 'manifestFile' for task ':libs:generateProdDebugRFile' of type com.android.build.gradle.internal.res.GenerateLibraryRFileTask.
at org.gradle.internal.metaobject.AbstractDynamicObject.getMissingProperty(AbstractDynamicObject.java:83)
at org.gradle.internal.metaobject.AbstractDynamicObject.getProperty(AbstractDynamicObject.java:61)
at com.android.build.gradle.internal.res.GenerateLibraryRFileTask_Decorated.getProperty(Unknown Source)
at com.crashlytics.tools.gradle.CrashlyticsPlugin.addPluginTasks(CrashlyticsPlugin.groovy:239)
at com.crashlytics.tools.gradle.CrashlyticsPlugin.this$2$addPluginTasks(CrashlyticsPlugin.groovy)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at com.crashlytics.tools.gradle.CrashlyticsPlugin$_addPluginTasksToLibraryVariantsIn_closure4.doCall(CrashlyticsPlugin.groovy:122)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:71)
at org.gradle.util.ConfigureUtil.configureTarget(ConfigureUtil.java:160)
at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:106)
at org.gradle.util.ConfigureUtil$1.execute(ConfigureUtil.java:123)
at org.gradle.internal.ImmutableActionSet$SingletonSet.execute(ImmutableActionSet.java:155)
at org.gradle.internal.MutableActionSet.execute(MutableActionSet.java:35)
at org.gradle.api.internal.DefaultDomainObjectCollection.doAdd(DefaultDomainObjectCollection.java:204)
at org.gradle.api.internal.DefaultDomainObjectCollection.add(DefaultDomainObjectCollection.java:198)
at com.android.build.gradle.LibraryExtension.addVariant(LibraryExtension.java:90)
at com.android.build.gradle.FeatureExtension.addVariant(FeatureExtension.java:108)
at com.android.build.gradle.internal.ApiObjectFactory.create(ApiObjectFactory.java:132)
at com.android.build.gradle.BasePlugin.lambda$createAndroidTasks$6(BasePlugin.java:709)
at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:81)
at com.android.build.gradle.BasePlugin.createAndroidTasks(BasePlugin.java:695)
at com.android.build.gradle.BasePlugin.lambda$null$4(BasePlugin.java:613)
at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:81)
at com.android.build.gradle.BasePlugin.lambda$createTasks$5(BasePlugin.java:609)
at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:91)
at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:80)
at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:42)
at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:230)
at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:149)
at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:58)
at org.gradle.internal.event.BroadcastDispatch$CompositeDispatch.dispatch(BroadcastDispatch.java:324)
at org.gradle.internal.event.BroadcastDispatch$CompositeDispatch.dispatch(BroadcastDispatch.java:234)
at org.gradle.internal.event.ListenerBroadcast.dispatch(ListenerBroadcast.java:140)
at org.gradle.internal.event.ListenerBroadcast.dispatch(ListenerBroadcast.java:37)
at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
at com.sun.proxy.$Proxy26.afterEvaluate(Unknown Source)
at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:76)
... 81 more
Had a similar problem with Crashlytics integration and found that I needed to add
crashlytics { instantAppSupport true }
This was needed even though I am not using Instant Apps.
Found from this answer in SO

taskdef A class needed by class com.android.ant.GetUiTargetTask cannot be found: com/android/utils/ILogger

After I update Android Studio to version 2.3, When I make my project I got this error
/Users/xxx/Work/yyy/build.xml:96: taskdef A class needed by class com.android.ant.GetUiTargetTask cannot be found: com/android/utils/ILogger
using the classloader AntClassLoader[/Users/xxx/Library/Android/sdk/tools/lib/ant-tasks.jar:/Users/xxx/Library/Android/sdk/tools/lib/kxml2-2.3.0.jar:/Users/xxx/Library/Android/sdk/tools/lib/gson-2.2.4.jar:/Users/xxx/Library/Android/sdk/tools/lib/commons-compress-1.8.1.jar:/Users/xxx/Library/Android/sdk/tools/lib/httpclient-4.1.1.jar:/Users/xxx/Library/Android/sdk/tools/lib/httpmime-4.1.jar:/Users/xxx/Library/Android/sdk/tools/lib/httpcore-4.1.jar:/Users/xxx/Library/Android/sdk/tools/lib/commons-logging-1.1.1.jar:/Users/xxx/Library/Android/sdk/tools/lib/commons-codec-1.4.jar]
at org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:612)
at org.apache.tools.ant.taskdefs.Definer.loadProperties(Definer.java:408)
at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:264)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:180)
at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:93)
at org.apache.tools.ant.Main.runBuild(Main.java:832)
at org.apache.tools.ant.Main.startAnt(Main.java:236)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:287)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:113)
Caused by: java.lang.NoClassDefFoundError: com/android/utils/ILogger
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:579)
... 16 more
Caused by: java.lang.ClassNotFoundException: com.android.utils.ILogger
at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1384)
at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1333)
at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1088)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 19 more
And this is the code line in build.xml that mentioned
<taskdef resource="anttasks.properties" classpathref="android.antlibs" />
<property name="exe" value="" />
<property name="bat" value="" />
Before update I never see this error. How I fix this error.
You need to copy the mentioned files from tools that still have them, like windows version:
ant/*
lib/ant-tasks.jar
lib/common.jar
lib/sdklib.jar
lib/guava-17.0.jar
lib/manifest-merger.jar
I've downloaded and installed android tools version 25.2.3 that still have ant that fix this problem

Gradle doesn't find my Android Annotations generated classes

I'm using gradle and intellij to build my android project. My generated java files are stored in the .aagen directory. I can import all these generated classes in my non generated classes. Still when I build my project with my build.gradle script this is the output.
/android/source/com/app/App.java:30: cannot find symbol
symbol : class TestActivity_
location: package com.ui
import com.ui.TestActivity_;
This is my error I got:
aused by: org.gradle.api.internal.tasks.compile.CompilationFailedException: Compilation failed; see the compiler error output for details.
at org.gradle.api.internal.tasks.compile.jdk6.Jdk6JavaCompiler.execute(Jdk6JavaCompiler.java:42)
at org.gradle.api.internal.tasks.compile.jdk6.Jdk6JavaCompiler.execute(Jdk6JavaCompiler.java:33)
at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.delegateAndHandleErrors(NormalizingJavaCompiler.java:95)
at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:48)
at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:34)
at org.gradle.api.internal.tasks.compile.DelegatingJavaCompiler.execute(DelegatingJavaCompiler.java:29)
at org.gradle.api.internal.tasks.compile.DelegatingJavaCompiler.execute(DelegatingJavaCompiler.java:20)
at org.gradle.api.internal.tasks.compile.IncrementalJavaCompilerSupport.execute(IncrementalJavaCompilerSupport.java:33)
at org.gradle.api.internal.tasks.compile.IncrementalJavaCompilerSupport.execute(IncrementalJavaCompilerSupport.java:24)
at org.gradle.api.tasks.compile.Compile.compile(Compile.java:68)
at org.gradle.api.internal.BeanDynamicObject$MetaClassAdapter.invokeMethod(BeanDynamicObject.java:216)
at org.gradle.api.internal.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:122)
at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:147)
at org.gradle.api.tasks.compile.JavaCompile_Decorated.invokeMethod(Unknown Source)
at org.gradle.util.ReflectionUtil.invoke(ReflectionUtil.groovy:23)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:217)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:210)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:199)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:526)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:509)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
... 67 more

Categories

Resources