Up until recently I have been using PhoneGap CLI 5.0 with Node 4.1 and Java 1.7. To build Android APKs I created the build-extras.gradle file under platforms/android with the 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 apps using Java 7. I originally ran into this with Phonegap CLI 6.3.1 about a week ago but have now upgraded to Phonegap CLI 6.3.3 with Node 4.5 and Java 1.8. The same build-extras.gradle
file still works just fine. However, I thought I would try VERION_1_8
only to be given the 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
I had originally switched to Java 7 since it allowed me to use try-with-resources
. I dare say Java 8 brings a few other goodies - better handling of time without using Joda-time etc, I suspect - which might well make a fresh transition worthwhile. However, this error leaves me stumped. I am hoping that someone here might be able to tell me what is going on.
I should mention that for good measure I tried the switch to version 1_8 with a freshly created phonegap project, phonegap create newprj --template=hello-world