Error:Execution failed for task ':app:compileDebugKotlin'. > Compilation error. See log for more details

匿名 (未验证) 提交于 2019-12-03 02:14:01

问题:

Error:Execution failed for task ':app:compileDebugKotlin'. > Compilation error. See log for more details 

build:gradle(Module:app)

buildscript {     repositories {         maven {             url 'https://jitpack.io'             url 'https://maven.fabric.io/public'         }     }      dependencies {         classpath 'io.fabric.tools:gradle:1.+'     } } apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'io.fabric' apply plugin: 'kotlin-android-extensions'   repositories {     maven { url 'https://maven.fabric.io/public' }     mavenCentral() }   android {     compileSdkVersion 25     buildToolsVersion "25.0.2"     useLibrary 'org.apache.http.legacy'        lintOptions {         checkReleaseBuilds false         abortOnError false     }      defaultConfig {         applicationId "uxx.xx.xxe"         minSdkVersion 18         targetSdkVersion 25         versionCode 17         versionName "0.1.14"          testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"     }     buildTypes {         release {             debuggable false             minifyEnabled true             shrinkResources true             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'         }         debug {             ext.enableCrashlytics = false             debuggable true             minifyEnabled true             shrinkResources true              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'         }     }     sourceSets {         main {             jniLibs.srcDirs = ['libs']             assets.srcDirs = ['src/main/assets', 'src/main/assets/']             res.srcDirs = ['src/main/res', 'src/main/assets/fonts']         }     }      dexOptions {         jumboMode true         javaMaxHeapSize "4g"      }      packagingOptions {         exclude 'META-INF/DEPENDENCIES'         exclude 'META-INF/NOTICE'         exclude 'META-INF/LICENSE'         exclude 'META-INF/LICENSE.txt'         exclude 'META-INF/NOTICE.txt'         exclude 'META-INF/ECLIPSE_.SF'         exclude 'META-INF/ECLIPSE_.RSA'     } }   dependencies {     compile fileTree(include: ['*.jar'], dir: 'libs')      compile "com.android.support:cardview-v7:${rootProject.supportLibraryVersion}"        compile "com.google.android.gms:play-services-ads:${rootProject.googlePlayServicesVersion}"     compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"     compile 'org.igniterealtime.smack:smack-android-extensions:4.1.9'     compile 'org.igniterealtime.smack:smack-tcp:4.1.9'     compile 'org.igniterealtime.smack:smack-experimental:4.1.9'     testCompile 'junit:junit:4.12' }  apply plugin: 'com.google.gms.google-services' apply plugin: 'com.getkeepsafe.dexcount' 

build:gradle(Project)

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {     ext.kotlin_version = '1.1.2-2'     repositories {         jcenter()     }     dependencies {         classpath 'com.android.tools.build:gradle:2.3.1'         classpath 'com.google.gms:google-services:3.0.0'         //visualize the method count         classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.6.2'         classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"     } }  allprojects {     repositories {         jcenter()         maven { url "https://jitpack.io" }     } }  ext.googlePlayServicesVersion = '10.2.0' ext.supportLibraryVersion = '25.3.1'  task clean(type: Delete) {     delete rootProject.buildDir } 

Solution Tried:

  1. Invalidate Caches/Restart
  2. Build -> Clean Project
  3. Update kotlin plugin, used lastest version of kotlin, google apis.

EDIT

./gradlew build --stacktrace > logs.txt 2>logErrors.txt 

logErrors.txt

* Exception is: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:compileDebugKotlin'.     at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:84)     at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:55)     at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)     at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)     at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88)     at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:46)     at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51)     at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)     at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)     at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)     at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.execute(DefaultTaskGraphExecuter.java:236)     at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.execute(DefaultTaskGraphExecuter.java:228)     at org.gradle.internal.Transformers$4.transform(Transformers.java:169)     at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106)     at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:61)     at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:228)     at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:215)     at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:77)     at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:58)     at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:32)     at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:113)     at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)     at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)     at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)     at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)     at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)     at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)     at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)     at org.gradle.initialization.DefaultGradleLauncher$3.execute(DefaultGradleLauncher.java:196)     at org.gradle.initialization.DefaultGradleLauncher$3.execute(DefaultGradleLauncher.java:193)     at org.gradle.internal.Transformers$4.transform(Transformers.java:169)     at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106)     at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:56)     at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:193)     at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:119)     at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:102)     at org.gradle.launcher.exec.GradleBuildController.run(GradleBuildController.java:71)     at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)     at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)     at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:41)     at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)     at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:75)     at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:49)     at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:44)     at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:29)     at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67)     at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)     at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)     at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:47)     at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)     at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)     at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)     at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)     at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)     at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)     at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)     at org.gradle.util.Swapper.swap(Swapper.java:38)     at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)     at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)     at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)     at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)     at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60)     at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)     at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)     at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:72)     at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)     at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)     at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)     at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:297)     at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)     at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40) Caused by: org.gradle.api.GradleException: Compilation error. See log for more details     at org.jetbrains.kotlin.gradle.tasks.TasksUtilsKt.throwGradleExceptionIfError(tasksUtils.kt:8)     at org.jetbrains.kotlin.gradle.tasks.KotlinCompile.processCompilerExitCode(Tasks.kt:286)     at org.jetbrains.kotlin.gradle.tasks.KotlinCompile.callCompiler$kotlin_gradle_plugin(Tasks.kt:260)     at org.jetbrains.kotlin.gradle.tasks.KotlinCompile.callCompiler$kotlin_gradle_plugin(Tasks.kt:160)     at org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile.execute(Tasks.kt:141)     at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)     at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$IncrementalTaskAction.doExecute(DefaultTaskClassInfoStore.java:163)     at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134)     at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:123)     at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:95)     at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:76)     ... 70 more 

回答1:

I got such error after a simple try of code refactoring. It is happened nor after some library was connected neither any changes in gradle. It looked like something in my code was wrong but compiler could not found the issue. That's why I double checked all changes that I did and found that I had changed somehow method signature in interface but had not changed it in class that implements it. I got this error twice during one day and decided to share my experience. I hope that it is temporary compiler bug.

Solution 1 I've got this error few more times. Possible solution is to go to File -> Settings -> Compiler -> and add "--stacktrace --debug" to Command-line Options. Read log and try to found answer of what went wrong.

Solution 2 The kapt3 can be source of such bugs. I removed apply plugin: 'kotlin-kapt' and added kapt { generateStubs = true } into android {} section of build.gradle. It seems that previous version of kapt generator is bugs free. (Update. It looks like bug with kapt is gone on kotlin version 1.2.+)



回答2:

If you are using AS 3.1 the new build graphical console isn't very helpful for finding out the source of the problem.

you need to click on toggle view and see the logs in text format to see the error and if needed to Run with --stacktrace



回答3:

In such case look at gradle console it will show the issue in detail with exact location which led to this compilation error.

In my case I was using Butterknife in one of my class and I had auto-converted that class to kotlin using android studio's utility

Log in Gradle Console

Executing tasks: [:app:assembleDebug]  Configuration on demand is an incubating feature. Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead. registerResGeneratingTask is deprecated, use registerGeneratedFolders(FileCollection) :app:buildInfoDebugLoader :app:preBuild UP-TO-DATE :app:preDebugBuild UP-TO-DATE :app:compileDebugAidl UP-TO-DATE :app:compileDebugRenderscript UP-TO-DATE :app:checkDebugManifest UP-TO-DATE :app:generateDebugBuildConfig UP-TO-DATE :app:generateDebugResValues UP-TO-DATE :app:generateDebugResources UP-TO-DATE :app:processDebugGoogleServices Parsing json file: /Users/Downloads/myproject/app/google-services.json :app:mergeDebugResources UP-TO-DATE :app:createDebugCompatibleScreenManifests UP-TO-DATE :app:processDebugManifest :app:splitsDiscoveryTaskDebug UP-TO-DATE :app:processDebugResources :app:kaptGenerateStubsDebugKotlin Using kotlin incremental compilation :app:kaptDebugKotlin e: /Users/Downloads/myproject/app/build/tmp/kapt3/stubs/debug/com/myproject/util/ConfirmationDialog.java:10: error: @BindView fields must not be private or static. (com.myproject.util.ConfirmationDialog.imgConfirmationLogo) e:   e:     private android.widget.ImageView imgConfirmationLogo; e:                                      ^ e: /Users/Downloads/myproject/app/build/tmp/kapt3/stubs/debug/com/myproject/util/ConfirmationDialog.java:13: error: @BindView fields must not be private or static. (com.myproject.util.ConfirmationDialog.txtConfirmationDialogTitle) e:   e:     private android.widget.TextView txtConfirmationDialogTitle; e:                                     ^ e: /Users/Downloads/myproject/app/build/tmp/kapt3/stubs/debug/com/myproject/util/ConfirmationDialog.java:16: error: @BindView fields must not be private or static. (com.myproject.util.ConfirmationDialog.txtConfirmationDialogMessage) e:   e:     private android.widget.TextView txtConfirmationDialogMessage; e:                                     ^ e: /Users/Downloads/myproject/app/build/tmp/kapt3/stubs/debug/com/myproject/util/ConfirmationDialog.java:19: error: @BindView fields must not be private or static. (com.myproject.util.ConfirmationDialog.txtViewPositive) e:   e:     private android.widget.TextView txtViewPositive; e:                                     ^ e: /Users/Downloads/myproject/app/build/tmp/kapt3/stubs/debug/com/myproject/util/ConfirmationDialog.java:22: error: @BindView fields must not be private or static. (com.pokkt.myproject.ConfirmationDialog.txtViewNegative) e:   e:     private android.widget.TextView txtViewNegative; e:                                     ^ e: /Users/Downloads/myproject/app/build/tmp/kapt3/stubs/debug/com/myproject/util/ExitDialog.java:10: error: @BindView fields must not be private or static. (com.myproject.util.ExitDialog.txtViewPositive) e:   e:     private android.widget.TextView txtViewPositive; e:                                     ^ e: /Users/Downloads/myproject/app/build/tmp/kapt3/stubs/debug/com/myproject/util/ExitDialog.java:13: error: @BindView fields must not be private or static. (com.myproject.util.ExitDialog.txtViewNegative) e:   e:     private android.widget.TextView txtViewNegative; e:                                     ^ e: java.lang.IllegalStateException: failed to analyze: org.jetbrains.kotlin.kapt3.diagnostic.KaptError: Error while annotation processing     at org.jetbrains.kotlin.analyzer.AnalysisResult.throwIfError(AnalysisResult.kt:57)     at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules(KotlinToJVMBytecodeCompiler.kt:144)     at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:167)     at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:55)     at org.jetbrains.kotlin.cli.common.CLICompiler.exec(CLICompiler.java:182)     at org.jetbrains.kotlin.daemon.CompileServiceImpl.execCompiler(CompileServiceImpl.kt:397)     at org.jetbrains.kotlin.daemon.CompileServiceImpl.access$execCompiler(CompileServiceImpl.kt:99)     at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$1$2.invoke(CompileServiceImpl.kt:365)     at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$1$2.invoke(CompileServiceImpl.kt:99)     at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$2$$special$$inlined$withValidClientOrSessionProxy$lambda$1.invoke(CompileServiceImpl.kt:798)     at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$2$$special$$inlined$withValidClientOrSessionProxy$lambda$1.invoke(CompileServiceImpl.kt:99)     at org.jetbrains.kotlin.daemon.common.DummyProfiler.withMeasure(PerfUtils.kt:137)     at org.jetbrains.kotlin.daemon.CompileServiceImpl.checkedCompile(CompileServiceImpl.kt:825)     at org.jetbrains.kotlin.daemon.CompileServiceImpl.access$checkedCompile(CompileServiceImpl.kt:99)     at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$2.invoke(CompileServiceImpl.kt:797)     at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$2.invoke(CompileServiceImpl.kt:99)     at org.jetbrains.kotlin.daemon.CompileServiceImpl.ifAlive(CompileServiceImpl.kt:1004)     at org.jetbrains.kotlin.daemon.CompileServiceImpl.ifAlive$default(CompileServiceImpl.kt:865)     at org.jetbrains.kotlin.daemon.CompileServiceImpl.doCompile(CompileServiceImpl.kt:791)     at org.jetbrains.kotlin.daemon.CompileServiceImpl.access$doCompile(CompileServiceImpl.kt:99)     at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$1.invoke(CompileServiceImpl.kt:364)     at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$1.invoke(CompileServiceImpl.kt:99)     at org.jetbrains.kotlin.daemon.CompileServiceImpl.ifAlive(CompileServiceImpl.kt:1004)     at org.jetbrains.kotlin.daemon.CompileServiceImpl.ifAlive$default(CompileServiceImpl.kt:865)     at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:336)     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: org.jetbrains.kotlin.kapt3.diagnostic.KaptError: Error while annotation processing     at org.jetbrains.kotlin.kapt3.AnnotationProcessingKt.doAnnotationProcessing(annotationProcessing.kt:90)     at org.jetbrains.kotlin.kapt3.AnnotationProcessingKt.doAnnotationProcessing$default(annotationProcessing.kt:42)     at org.jetbrains.kotlin.kapt3.AbstractKapt3Extension.runAnnotationProcessing(Kapt3Extension.kt:205)     at org.jetbrains.kotlin.kapt3.AbstractKapt3Extension.analysisCompleted(Kapt3Extension.kt:166)     at org.jetbrains.kotlin.kapt3.ClasspathBasedKapt3Extension.analysisCompleted(Kapt3Extension.kt:82)     at org.jetbrains.kotlin.resolve.jvm.TopDownAnalyzerFacadeForJVM$analyzeFilesWithJavaIntegration$2.invoke(TopDownAnalyzerFacadeForJVM.kt:89)     at org.jetbrains.kotlin.resolve.jvm.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(TopDownAnalyzerFacadeForJVM.kt:99)     at org.jetbrains.kotlin.resolve.jvm.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration$default(TopDownAnalyzerFacadeForJVM.kt:76)     at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.analyze(KotlinToJVMBytecodeCompiler.kt:365)     at org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport.analyzeAndReport(AnalyzerWithCompilerReport.kt:105)     at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyze(KotlinToJVMBytecodeCompiler.kt:354)     at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules(KotlinToJVMBytecodeCompiler.kt:139)     ... 40 more    FAILED :app:buildInfoGeneratorDebug  FAILURE: Build failed with an exception.  * What went wrong: Execution failed for task ':app:kaptDebugKotlin'. > Internal compiler error. See log for more details  * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.  BUILD FAILED in 32s  16 actionable tasks: 7 executed, 9 up-to-date 

As in my log it clearly shows issues are with declaration of variables with butterknife. So I looked into this issue and was able to solve it.



回答4:

I had a similar problem. The problem was that I incorrectly wrote the properties of the model in the attributes of the view:

<TextView         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:text="@{ferm.coin.value}"/>  

This part was wrong:

@{ferm.coin.value} 

When I wrote the correct property, the error was resolved.



回答5:

in my case I accidentally changed version="1.0" to xml version="1.0" in my XML file.

I only had to change it back.

if you have the same problem and the solutions above didn't work for you. open Gradle Console and scroll to Run with --debug option click it and it will show you more useful info about your error.

some notes:

this error doesn't appear directly after I make the change in XML it appear only after I change some java code. I think it has something to do with the instant run and build cash.



回答6:

I had a same problem. To solve this problem just open your all files(recent working files) in Which you made the changes and check did you forget to delete some which should be deleted.

In my case the problem was with the Unreferenced code which I was using in one of my file and that code is present in that file which should not be present in that file because I was using an interface which I have deleted from my project but I forget to deleted from one of my file).



回答7:

I was suffering the same problem I solved it by checking build tab and switch to text mode. Check the console it will show the problems mine was removing a drawable without deleting the usage and deleting a class without deleting the usage also Text mode button



回答8:

Another possible recent solution is changing gradle version to:

classpath 'com.android.tools.build:gradle:3.0.0-rc2' 

and updating build tool



回答9:

I Had the same issue and finally discovered the reason. In mycase was badly written Java method:

@FormUrlEncoded @POST("register-user/") Call<RegisterUserApiResponse> registerUser(         @Field("email") String email,         @Field("password") String password,                     @Field("date") String birthDate, ); 

Note the illegal comma after the "date" field. For some reason the compiler could not reveal this exact error, and came with the ':app:compileDebugKotlin'. > Compilation error thing.



回答10:

I Had the same problem and finally reached to the solution.

add "--stacktrace --debug" to your command-line options(File -> Settings -> Compiler) then run it. This will show the problem(unwanted code) in your code.



回答11:

In my case error was caused by this line

@BindColor(R.color.colorAccent) var mColor: Int? = 0

Solved By

@JvmField @BindColor(android.R.color.white) @ColorInt internal var mColor: Int = 0

Error in GradleConsole

:app:kaptDebugKotlin e: \app\build\tmp\kapt3\stubs\debug\MainFragment.java:23: error: @BindColor field type must be 'int' or 'ColorStateList'. (com.sample.MainFragment.mColor) e:

e: private java.lang.Integer mColor;



回答12:

i was surprised to find that when i had a class that was closed it produced this vague error. changing it to a open class resolved the issue.

before:   class DefaultSubscriber<T> : Observer<T> {//... }  after:  open class DefaultSubscriber<T> : Observer<T> {//... } 


易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!