简体   繁体   English

未在Project中使用Kotlin编译项目

[英]Project not compiling using Kotlin in Project

I have a problem Compiling my program when I add some class in Kotlin in it. 我在Kotlin中添加某些类时,在编译程序时遇到问题。 When I do a clean of the project, and Start running it, the next error is prompt: 当我清理项目并开始运行它时,提示下一个错误:

Error:Execution failed for task ':app:compileRetrolambdaMyProject'.

Process 'command '/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java'' finished with non-zero exit value 1 进程'command'/ Applications / Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java''完成,退出值非零

The thing is that if I execute again the project it works perfectly. 关键是,如果我再次执行该项目,它会完美运行。 So basically I have to build the project twice in order to execute the project. 因此,基本上,我必须两次构建该项目才能执行该项目。

I need this to be fixed because I build the final version in Jenkins and this is giving me problems. 我需要解决此问题,因为我在詹金斯构建了最终版本,这给我带来了问题。

Any clues on how to fix it? 关于如何解决的任何线索?

Edit: 编辑:

This are the unique warnings that it gives me, but as I said, they are warnings, not errors, and if I Run again the project it works perfectly : 这是它给我的独特警告,但是正如我所说,它们是警告,而不是错误,如果我再次运行该项目,它将运行完美:

Warning:(31, 57) Parameter 'buttonView' is never used, could be renamed to _
Warning:(40, 46) Parameter 'v' is never used, could be renamed to _
Warning:(56, 48) Parameter 'v' is never used, could be renamed to _
Error:Execution failed for task ':app:compileRetrolambdaMyProject'.
> Process 'command '/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

The problem was with RetroLambda Library, following this issue on Github: https://github.com/evant/gradle-retrolambda/issues/105 问题在于RetroLambda库,紧随Github上的此问题: https : //github.com/evant/gradle-retrolambda/issues/105

The solution is to add : 解决方案是添加:

retrolambda {
    jvmArgs '-noverify'
}

to my gradle, and upgrading the Retrolambda library to version 3.7.0 . 到我的gradle,然后将Retrolambda库升级到version 3.7.0

I also had this problem and tried the following things: 我也遇到了这个问题,并尝试了以下操作:

via Android Studio: 通过Android Studio:

  • Build > Clean Project 构建>清洁项目
  • File > Invalidate Caches / Restart 文件>使缓存无效/重新启动

via command line: 通过命令行:

  • ./gradlew build --refresh-dependencies ./gradlew建立--refresh-dependencies

These three approaches solved most of the problems like this I had before, but in this case the only thing that helped was to delete all build folders in my project manually (build folder in project root and in all modules like app and others if you have more). 这三种方法解决了我以前遇到的大多数问题,但是在这种情况下,唯一有用的是手动删除项目中的所有构建文件夹 (项目根目录以及所有模块(例如app和其他模块)中的构建文件夹)更多)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM