在运行gradle 6,7,8时设置jdk8的路径是什么意思?

时间:2016-04-21 12:48:34

标签: java android gradle

我收到以下错误

  Information:Gradle tasks [:omniNotes:assembleDebug]
    Warning:Dependency commons-logging:commons-logging:1.1.3 is ignored for debug as it may be conflicting with the internal version provided by Android.
             In case of problem, please repackage it with jarjar to change the class packages
    Warning:Dependency commons-logging:commons-logging:1.1.3 is ignored for release as it may be conflicting with the internal version provided by Android.
             In case of problem, please repackage it with jarjar to change the class packages
    :omniNotes:preBuild UP-TO-DATE
    :omniNotes:preDebugBuild UP-TO-DATE
    :omniNotes:checkDebugManifest
    :omniNotes:preReleaseBuild UP-TO-DATE
    :omniNotes:prepareBeBillingtonCalendarRecurrencepickerLibrary111Library UP-TO-DATE
    :omniNotes:prepareChAcraAcra470RC1Library UP-TO-DATE
    :omniNotes:prepareComAndroidSupportAnimatedVectorDrawable2321Library UP-TO-DATE
    :omniNotes:prepareComAndroidSupportAppcompatV72321Library UP-TO-DATE
    :omniNotes:prepareComAndroidSupportDesign2321Library UP-TO-DATE
    :omniNotes:prepareComAndroidSupportRecyclerviewV72321Library UP-TO-DATE
    :omniNotes:prepareComAndroidSupportSupportV42321Library UP-TO-DATE
    :omniNotes:prepareComAndroidSupportSupportVectorDrawable2321Library UP-TO-DATE
    :omniNotes:prepareComArtemzinRxjavaProguardRules10142Library UP-TO-DATE
    :omniNotes:prepareComGetbaseFloatingactionbutton1101Library UP-TO-DATE
    :omniNotes:prepareComGithubAfollestadMaterialDialogsCommons0856Library UP-TO-DATE
    :omniNotes:prepareComGithubAfollestadMaterialDialogsCore0856Library UP-TO-DATE
    :omniNotes:prepareComGithubFedericoiosueChecklistview313Library UP-TO-DATE
    :omniNotes:prepareComGithubFedericoiosuePixlui25Library UP-TO-DATE
    :omniNotes:prepareComGithubFedericoiosueSimpleGallery120Library UP-TO-DATE
    :omniNotes:prepareComGithubFlavienlaurentDatetimepickerLibrary002Library UP-TO-DATE
    :omniNotes:prepareComGithubGabrielemariottiChangeloglibChangelog200Library UP-TO-DATE
    :omniNotes:prepareComGithubPaolorotoloAppintro130Library UP-TO-DATE
    :omniNotes:prepareComGoogleAndroidGmsPlayServicesBase810Library UP-TO-DATE
    :omniNotes:prepareComGoogleAndroidGmsPlayServicesBasement810Library UP-TO-DATE
    :omniNotes:prepareComGoogleAndroidGmsPlayServicesLocation810Library UP-TO-DATE
    :omniNotes:prepareComGoogleAndroidGmsPlayServicesMaps810Library UP-TO-DATE
    :omniNotes:prepareComLarswerkmanHoloColorPicker14Library UP-TO-DATE
    :omniNotes:prepareComNhaarmanListviewanimationsLibCore310Library UP-TO-DATE
    :omniNotes:prepareComNhaarmanListviewanimationsLibManipulation310Library UP-TO-DATE
    :omniNotes:prepareComPnikosisMaterialishProgress15Library UP-TO-DATE
    :omniNotes:prepareComPushbulletAndroidExtensions104Library UP-TO-DATE
    :omniNotes:prepareComSquareupLeakcanaryLeakcanaryAndroid13Library UP-TO-DATE
    :omniNotes:prepareComTbruyelleRxpermissionsRxpermissions042Library UP-TO-DATE
    :omniNotes:prepareDeKeyboardsurferAndroidWidgetCrouton184Library UP-TO-DATE
    :omniNotes:prepareIoNlopezSmartlocationLibrary320Library UP-TO-DATE
    :omniNotes:prepareIoReactivexRxandroid101Library UP-TO-DATE
    :omniNotes:prepareMeZhanghaiAndroidMaterialprogressbarLibrary114Library UP-TO-DATE
    :omniNotes:prepareDebugDependencies
    :omniNotes:compileDebugAidl UP-TO-DATE
    :omniNotes:compileDebugRenderscript UP-TO-DATE
    :omniNotes:generateDebugBuildConfig UP-TO-DATE
    :omniNotes:generateDebugAssets UP-TO-DATE
    :omniNotes:mergeDebugAssets UP-TO-DATE
    :omniNotes:generateDebugResValues UP-TO-DATE
    :omniNotes:generateDebugResources UP-TO-DATE
    :omniNotes:mergeDebugResources UP-TO-DATE
    :omniNotes:processDebugManifest UP-TO-DATE
    :omniNotes:processDebugResources UP-TO-DATE
    :omniNotes:generateDebugSources UP-TO-DATE
    :omniNotes:compileDebugJavaWithJavac FAILED
    Error:Execution failed for task ':omniNotes:compileDebugJavaWithJavac'.
  

使用java 5,6或7运行gradle时,必须使用属性retrolambda.jdk或环境变量JAVA8_HOME

设置jdk8的路径
    Information:BUILD FAILED
    Information:Total time: 13.861 secs
    Information:1 error
    Information:2 warnings
    Information:See complete output in console

2 个答案:

答案 0 :(得分:0)

似乎gradle正在寻找Java 8.看看你是否可以将它设置为使用Java 7,因为你已经拥有它。如果要设置JAVA8_HOME,请查找系统上安装Java 8的位置。通常是C:\ Program Files \ Java \ jdk8。现在执行以下操作

  1. 右键单击桌面上的“我的电脑”图标,然后选择“属性”。
  2. 单击“高级”选项卡。
  3. 单击“环境变量”按钮。
  4. 在“系统变量”下,单击“新建”。
  5. 输入变量名称JAVA8_HOME。
  6. 输入变量值(上面提到的路径之一)作为 Java Development Kit的安装路径。
  7. 单击“确定”。
  8. 点击Apply Changes。

答案 1 :(得分:0)

我认为您应首先安装JAVA_1.8

并添加一个名为JAVA8_HOME的新环境系统变量,其中包含jdk_1.8路径。

"JAVA8_HOME = C:\Program Files\Java\jdk8"

这可能会解决您的问题。如果您不知道如何设置系统变量,那么您可以这样做

  1. 选择开始,选择控制面板。双击“系统”,然后选择“高级”选项卡。
  2. 单击“环境变量”。 ...
  3. 在“新建系统变量”窗口中,指定JAVA8_HOME环境变量的值。 ...