我的kotlin android项目停止构建和运行。我不知道出了什么问题,但几天前一切都很好。现在重建它说:
2017-09-18 08:20:17,691 [ 870125] INFO - s.plugins.gradle.GradleManager - Instructing gradle to use java from D:/progs/Android Studio/jre
2017-09-18 08:20:17,752 [ 870186] INFO - ild.invoker.GradleBuildInvoker - Build command line options: [--configure-on-demand, -Pandroid.injected.invoked.from.ide=true, --init-script, C:\Users\User2\AppData\Local\Temp\asLocalRepo5085.gradle]
2017-09-18 08:20:17,753 [ 870187] INFO - xecution.GradleExecutionHelper - Passing command-line args to Gradle Tooling API: [--configure-on-demand, -Pandroid.injected.invoked.from.ide=true, --init-script, C:\Users\User2\AppData\Local\Temp\asLocalRepo5085.gradle]
2017-09-18 08:20:37,451 [ 889885] INFO - roid.sdk.MessageBuildingSdkLog - com.android.ide.common.blame.Message.<init>(com.android.ide.common.blame.Message$Kind, java.lang.String, java.lang.String, com.google.common.collect.ImmutableList)
java.lang.NoSuchMethodException: com.android.ide.common.blame.Message.<init>(com.android.ide.common.blame.Message$Kind, java.lang.String, java.lang.String, com.google.common.collect.ImmutableList)
at java.lang.Class.getConstructor0(Class.java:3082)
at java.lang.Class.getConstructor(Class.java:1825)
at org.jetbrains.kotlin.android.KotlinOutputParserHelper$simpleMessageConstructor$2.invoke(KotlinOutputParserHelper.kt:171)
at org.jetbrains.kotlin.android.KotlinOutputParserHelper$simpleMessageConstructor$2.invoke(KotlinOutputParserHelper.kt:143)
at kotlin.SynchronizedLazyImpl.getValue(Lazy.kt:130)
at org.jetbrains.kotlin.android.KotlinOutputParserHelper.getSimpleMessageConstructor(KotlinOutputParserHelper.kt)
at org.jetbrains.kotlin.android.KotlinOutputParserHelper.createNewMessage(KotlinOutputParserHelper.kt:272)
at org.jetbrains.kotlin.android.KotlinOutputParserHelper.createMessage(KotlinOutputParserHelper.kt:250)
at org.jetbrains.kotlin.android.KotlinOutputParserHelper.createMessage$default(KotlinOutputParserHelper.kt:244)
at org.jetbrains.kotlin.android.KotlinOutputParserHelperKt.parse(KotlinOutputParserHelper.kt:41)
at org.jetbrains.kotlin.android.KotlinOutputParser.parse(KotlinOutputParser.java:28)
at com.android.ide.common.blame.parser.ToolOutputParser.parseToolOutput(ToolOutputParser.java:86)
at com.android.tools.idea.gradle.output.parser.BuildOutputParser.parseGradleOutput(BuildOutputParser.java:43)
at com.android.tools.idea.gradle.project.build.invoker.GradleTasksExecutor$GradleTasksExecutorImpl.lambda$collectMessages$5(GradleTasksExecutor.java:516)
at com.intellij.openapi.application.impl.ApplicationImpl$2.run(ApplicationImpl.java:307)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
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)
2017-09-18 08:20:37,452 [ 889886] INFO - roid.sdk.MessageBuildingSdkLog - Exception from KotlinOutputParser
2017-09-18 08:20:37,482 [ 889916] INFO - pl.ProjectRootManagerComponent - project roots have changed
2017-09-18 08:20:37,724 [ 890158] INFO - .diagnostic.PerformanceWatcher - Pushing properties took 99ms; general responsiveness: ok; EDT responsiveness: ok
2017-09-18 08:20:37,741 [ 890175] INFO - .diagnostic.PerformanceWatcher - Indexable file iteration took 17ms; general responsiveness: ok; EDT responsiveness: ok
2017-09-18 08:20:37,741 [ 890175] INFO - indexing.UnindexedFilesUpdater - Unindexed files update started: 30 files to update
2017-09-18 08:20:38,005 [ 890439] INFO - .diagnostic.PerformanceWatcher - Unindexed files update took 264ms; general responsiveness: ok; EDT responsiveness: ok
答案 0 :(得分:0)
就我而言,有助于“构建->清理项目”和“构建->重建项目”
答案 1 :(得分:-1)
问题出在问题上。只需要一条线。
apply plugin: 'kotlin-kapt'
现在我添加了android插件行。现在一切都按照应有的方式建立。
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'