Phonegap CLI with Java 8

Until recently, I used PhoneGap CLI 5.0 with Node 4.1 and Java 1.7. To build the Android APK, I created a build-extras.gradle file under / android platforms with content

ext.postBuildExtras = {
android {
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_7
    targetCompatibility JavaVersion.VERSION_1_7
}
allprojects {
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_1_7
        targetCompatibility = JavaVersion.VERSION_1_7
    }
}

}
}

which allowed me to compile my applications using Java 7. I initially came across this using Phonegap CLI 6.3.1 about a week ago, but now I upgraded to PhoneGAP CLI 6.3.3 using Node 4.5 and Java 1.8. The same file build-extras.gradlestill works fine. However, I thought I would try VERION_1_8to get an error message

Error: Error code 1 for command: /path/to/app/platforms/android/gradlew 
with args: cdvBuildDebug,-b, /path/to/app/platforms/android/build.gradle,
-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true

Java 7, try-with-resources. , Java 8 - Joda- .., , . . , - , .


, 1_8 , phonegap create newprj --template=hello-world

+4
1

Java 8 Android, Jack. build.gradle:

android {
  ...
  defaultConfig {
    ...
    jackOptions {
      enabled true
    }
  }
  compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
  }
}

. Google.

, , Jack Build Tools 21.1.1. , , , . . Android - Jack and Jill.

+1

Source: https://habr.com/ru/post/1655329/


All Articles