代码之家  ›  专栏  ›  技术社区  ›  Beginner

Lint-失败:生成失败,出现异常

  •  -1
  • Beginner  · 技术社区  · 7 年前

    我想跑步 gradlew :lint 关于我的项目。

    但是,我越来越 错误:

    C:\[ProjectName]>gradlew :lint
    Starting a Gradle Daemon, 1 incompatible and 3 stopped Daemons could not be reused, use --status for details
    Incremental java compilation is an incubating feature.
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Task 'lint' not found in root project '[ProjectName]'. Some candidates are: 'init'.
    
    * Try:
    Run gradlew tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
    
    BUILD FAILED
    
    Total time: 1 mins 27.334 secs
    

    当我跑步时: gradlew lint

    :

    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':app:compileDebugJavaWithJavac'.
    > Could not find tools.jar. Please check that C:\Program Files\Java\jre1.8.0_151 contains a valid JDK installation.
    
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
    
    BUILD FAILED
    

    我无法在线搜索任何解决方案。

    参考: https://developer.android.com/studio/write/lint.html

    1 回复  |  直到 7 年前
        1
  •  1
  •   Beginner    7 年前

    将JAVA_HOME变量设置为 C:\Program Files\Java\jdkX.XX 为我工作。

    由于某种原因,它以前被设置为JRE目录。

    将JAVA_HOME变量设置为 C: \程序文件\ Java\jdkX。XX

    1) 进入搜索栏,输入“环境”,点击“编辑系统环境变量”。 2) 点击“环境变量”按钮 3) 在系统变量标题下,单击“新建”。输入名称为 JAVA_HOME 然后像Jeffrey说的那样查找jdk的路径。单击“确定”,然后再次单击“确定”。

    echo %JAVA_HOME% 在DOS窗口上