IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    [原]VirtualApp出现无法编译问题整理

    cuiran发表于 2016-08-25 15:37:49
    love 0

    最近看到github上出现了VirtualApp 看了作者的介绍感觉很不错,然后就clone下来编译并研究一下,但是编译过程出现了如下错误提示,看着有些头疼
    由于VirtualApp是需要将提供的android.jar和sdk里面的jar替换 这里就省略….

    编译错误提示

    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 '/Users/cuiran/git/VirtualApp/VirtualApp/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.
    ==============================================================================
    

    根据错误提示
    首先,需要安装Jdk1.8 然后设置jdk1.8环境变量
    然后,在android studio->Preferences->Path Variables添加
    如图所示
    Path Variables

    最后需要在build.gradle中添加代码

     retrolambda {
            jdk '/Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home'//System.getenv("JAVA_8")
            oldJdk System.getenv("JAVA8_HOME")
            javaVersion JavaVersion.VERSION_1_7
        }

    这样就可编译通过!



沪ICP备19023445号-2号
友情链接