1. 程式人生 > >Ensure that you have installed a JDK (not just a JRE) and configured your JAVA_HOME system variable

Ensure that you have installed a JDK (not just a JRE) and configured your JAVA_HOME system variable

       出現錯誤的原因是:

          gradle的版本過低導致的

  
   解決辦法:

          將build.gradle檔案裡的

        classpath 'com.android.tools.build:gradle:1.3.0'
        修改為
       classpath 
'com.android.tools.build:gradle:2.2.3'



          如果再次編譯時遇到:

          Error:No service of type Factory<LoggingManagerInternal> available in Project

          即是因為maven的版本過低導致。將build.gradle修改如下:

     dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
        classpath'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
        classpath'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.3.1'
        // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files }
         接下來編譯通過。