From @RVEIII on February 1, 2018 19:40
I searched for Gradle issues and read a lot of them. It did not answer my question/problem.
Tell us about the problem
I have an application that uses a plugin that depends on a few Android libraries from an external source. Those libraries were compiled with Java 8, Android Gradle Plugin 3.0.1, and Gradle 4.4. The min sdk is 21 and the target is 27.
In my nativescript app, I can get those library dependencies brought into the apk by putting them in my plugin's include.gradle. The issue though is that when I build the app I get this error:
Dex: Error converting bytecode to dex:
Cause: Dex cannot parse version 52 byte code.
This is caused by library dependencies that have been compiled using Java 8 or above.
If you are using the 'java' gradle plugin in a library submodule add
targetCompatibility = '1.7'
sourceCompatibility = '1.7'
This error is remedied by using the Jack compiler option in my app.gradle and the source and target compatibility set to Java 1.8:
android {
compileSdkVersion 27
defaultConfig {
...
minSdkVersion 24
jackOptions {
enabled true
}
}
aaptOptions {
additionalParameters "--no-version-vectors"
}
compileOptions.with {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
}
I have a requirement to be able to support this app on sdk 21+. But due to the use of the Jack compiler option, it won't allow me to use anything before 24. I would not have this issue if I could use a newer version of gradle to build the Nativescript app. It seems that Nativescript uses 2.3.3. But I need 3+.
Is there a way to change this? I tried with a classpath dependency but the issue there is that the build.gradle file that gets generated for platforms/android has methods in it that are no longer available in Gradle 3. I need to be able to use the latest version of the Android Gradle plugin to build my app.
Which platform(s) does your issue occur on?
Android
Please provide the following version numbers that your issue occurs with:
- CLI: 3.4.0
- Cross-platform modules: 3.4.0
- Runtime(s): 3.4.1
- Plugin(s): My plugin uses 3.4.0 cross platform.
Please tell us how to recreate the issue in as much detail as possible.
Build a Nativescript app for Android and see that Gradle 2.3.3 is used.
Copied from original issue: NativeScript/NativeScript#5370
From @RVEIII on February 1, 2018 19:40
Did you verify this is a real problem by searching the NativeScript Forum and the other open issues in this repo?
I searched for Gradle issues and read a lot of them. It did not answer my question/problem.
Tell us about the problem
I have an application that uses a plugin that depends on a few Android libraries from an external source. Those libraries were compiled with Java 8, Android Gradle Plugin 3.0.1, and Gradle 4.4. The min sdk is 21 and the target is 27.
In my nativescript app, I can get those library dependencies brought into the apk by putting them in my plugin's include.gradle. The issue though is that when I build the app I get this error:
Dex: Error converting bytecode to dex:
Cause: Dex cannot parse version 52 byte code.
This is caused by library dependencies that have been compiled using Java 8 or above.
If you are using the 'java' gradle plugin in a library submodule add
targetCompatibility = '1.7'
sourceCompatibility = '1.7'
This error is remedied by using the Jack compiler option in my app.gradle and the source and target compatibility set to Java 1.8:
I have a requirement to be able to support this app on sdk 21+. But due to the use of the Jack compiler option, it won't allow me to use anything before 24. I would not have this issue if I could use a newer version of gradle to build the Nativescript app. It seems that Nativescript uses 2.3.3. But I need 3+.
Is there a way to change this? I tried with a classpath dependency but the issue there is that the build.gradle file that gets generated for platforms/android has methods in it that are no longer available in Gradle 3. I need to be able to use the latest version of the Android Gradle plugin to build my app.
Which platform(s) does your issue occur on?
Android
Please provide the following version numbers that your issue occurs with:
Please tell us how to recreate the issue in as much detail as possible.
Build a Nativescript app for Android and see that Gradle 2.3.3 is used.
Copied from original issue: NativeScript/NativeScript#5370