Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error when building on new Android Studio 3.1

I updated Android Studio to 3.1 stable version and get this error, when try to build project. At first there were problems with DataBinding, I fixed them, then I found this issue.

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 full version of error logs]

Does anybody find solution?

like image 788
Karamba Avatar asked Mar 27 '18 09:03

Karamba


People also ask

How do I fix Android Studio?

Open your gradle. properties file in Android Studio. Restart Android Studio for your changes to take effect. Click Sync Project with Gradle Files to sync your project.

Where is error code in Android Studio?

There's "Messages" tab in Android Studio. Complilation errors and warning go there. You can select it by pressing alt+0 (⌘+0 in OS X - a shortcut to View|Tool Windows|Messages).


2 Answers

This recommendations depends, how much complicated your project(these recommendations can be not usefull):

  • Update Kotlin plugin to last version

  • Remove

    kapt { generateStubs = true }

  • If you use databinding, add to gradle.properties this line android.databinding.enableV2=true

  • update gradle
  • update build tools

Thanks for my coworkers to find these facts

like image 142
Karamba Avatar answered Oct 05 '22 23:10

Karamba


Update your kotlin version "1.2.31" add following dependencies in app level gradle file

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

android {
  ...

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

It may help to you :)

like image 33
Priya Avatar answered Oct 05 '22 23:10

Priya