Error:Execution @R_301_5138@ for task ':app:compileDeBUGKotlin'. > Compilation error. See log for more details
建立:gradle这个(模块: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'
建设:gradle这个(项目)
//顶级构建文件,您可以在其中添加所有子项目/模块共有的配置选项.
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}
解决方案:
>使高速缓存/重新启动无效
>构建 – >清洁项目
>更新kotlin插件,使用最新版本的kotlin,Google Apis.
编辑
./gradlew build --stacktrace > logs.txt 2>logErrors.txt
logErrors.txt
* Exception is:org.gradle.API.tasks.TaskExecutionException: Execution @R_301_5138@ 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.execute(DefaultTaskGraphExecuter.java:236) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:228) at org.gradle.internal.transformers.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.access0(DefaultBuildExecuter.java:23) at org.gradle.execution.DefaultBuildExecuter.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.execute(DefaultGradleLauncher.java:196) at org.gradle.initialization.DefaultGradleLauncher.execute(DefaultGradleLauncher.java:193) at org.gradle.internal.transformers.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.call(ForwardClIEntinput.java:74) at org.gradle.launcher.daemon.server.exec.ForwardClIEntinput.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.run(StartBuildOrResponDWithBusy.java:50) at org.gradle.launcher.daemon.server.DaemonStateCoordinator.run(DaemonStateCoordinator.java:297) at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54) at org.gradle.internal.concurrent.StoppableExecutorImpl.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
解决方法:
经过简单的代码重构尝试后,我遇到了这样的错误.它已经发生,也没有一些库连接后没有任何gradle的变化.看起来我的代码中的某些内容是错误的,但编译器无法找到问题.这就是为什么我仔细检查了我所做的所有更改,发现我在界面中以某种方式改变了方法签名,但没有在实现它的类中更改它.
我在一天内两次得到这个错误,并决定分享我的经验.我希望它是一个临时的编译器BUG.
解决方案1可能的解决方案是转到文件 – >设置 – >编译器 – >并在命令行选项中添加“–stacktrace –deBUG”.阅读日志并尝试找出问题的答案.
在新的AndroID Studio 3.1中. ,您可以通过按“构建”选项卡上的“切换视图”来启用/禁用控制台日志详细信息.在那里你可以找到细节.请注意两种模式都可用于调查问题的原因.见:https://stackoverflow.com/a/49717363/
解决方案2单击Gradle(在右侧栏上),然后在:app下选择assembleDeBUG(如果使用flavor,则选择assembleYourFlavor).错误将显示在“运行”选项卡中.见:https://stackoverflow.com/a/51022296
解决方案3作为最后的手段.在androID studio中,尝试Analyze – >检查代码 – >整个项目.等到检查结束,然后更正“常规”部分中的错误以及其他部分中的可能错误.
注意kapt3可能是此类错误的来源.我删除了apply plugin:’kotlin-kapt’并将kapt {generateStubs = true}添加到build.gradle的androID {}部分.似乎kapt生成器的先前版本是免费的. (更新.看起来像kapt的BUG在kotlin版本1.2上消失了.)
总结以上是内存溢出为你收集整理的android – 错误:任务执行失败’:app:compileDebugKotlin’. >编译错误.有关详细信息,请参阅日志全部内容,希望文章能够帮你解决android – 错误:任务执行失败’:app:compileDebugKotlin’. >编译错误.有关详细信息,请参阅日志所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)