【Android】AndroidStudio导入别人的项目报错。编译通过,无法运行解决方案

来源:互联网 发布:淘宝虚拟市场清退标准 编辑:程序博客网 时间:2024/05/22 13:29

作者:程序员小冰
新浪微博:http://weibo.com/mcxiaobing

长期维护的Android项目,里面包括常用功能实现,以及知识点详解,
当然还有Java中的知识点。具体请看github:

https://github.com/QQ986945193/DavidAndroidProjectTools

说明,本人从github上下了一个代码,导入到AndroidStudio中,编译没问题,不过突然运行的时候就报错了。提示没有jdk8,大概意思我理解的就是这样。因为我电脑上一直都是装JDK7的,所以就google搜了一下答案,然后就解决了。下面是错误代码:

Error:FAILURE: Build completed with 2 failures.1: Task failed with an exception.-----------* What went wrong:Execution failed for task ':app:compileDebugJavaWithJavac'.> When running gradle with java 5, 6 or 7, you must set the path to jdk8, either with property retrolambda.jdk or environment variable JAVA8_HOME* Try:Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.==============================================================================2: Task failed with an exception.-----------* What went wrong:A problem was found with the configuration of task ':app:compileRetrolambdaDebug'.> Directory 'D:\AndroidStudio\AndroidSamples\app\build\retrolambda\debug' specified for property 'inputDir' does not exist.* Try:Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.==============================================================================

解决方法:1,去安装jdk7,然后配置好环境变量。

2,修改AndroidSutdio本地的jdk目录。

AndroidStudio->Project Structure->更改JDK location改为JDK8即可。

1 0