Error creating new Android Studio 3.1

I upgraded the version for Android Studio to version 3.1 and received this error when trying to create a project. At first there were problems with DataBinding , I fixed them, then I found this problem.

 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:415) at org.jetbrains.kotlin.gradle.tasks.KotlinCompile.callCompiler$kotlin_gradle_plugin(Tasks.kt:389) at org.jetbrains.kotlin.gradle.tasks.KotlinCompile.callCompiler$kotlin_gradle_plugin(Tasks.kt:251) at org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile.execute(Tasks.kt:215) 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.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73) at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:46) at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39) at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:121) at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336) at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328) at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:110) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92) 

[this is not a full version of the error logs]

Anyone find a solution?

+6
source share
3 answers

These recommendations depend on how difficult your project is (these recommendations may not be practical):

  • Update Kotlin plugin to the latest version

  • Remove

    kapt { generateStubs = true }

  • If you are using data binding, add this line android.databinding.enableV2=true to gradle.properties

  • gradle update
  • update build tools

Thank you for my staff found these facts.

+1
source

Update your kotlin version "1.2.31" add the following application level dependencies gradle file

compile "org.jetbrains.kotlin: kotlin-stdlib"

 android { ... sourceSets { main.java.srcDirs += 'src/main/kotlin' } } 

This may help you :)

+1
source

Just review this project and see the build.gradle files. I just updated this project for Android Studio 3.1 and performed the same error as yours, but now everything works fine after some changes in build.gradle.

https://github.com/thierryxing/Douban

Major updates:

 apply plugin: 'kotlin-kapt' dependencies { kapt "com.android.databinding:compiler:$gradle_version" } 
0
source

Source: https://habr.com/ru/post/1276166/


All Articles