I'm trying to take advantage of some Java 8 features to my Android project by following the documentation: https://developer.android.com/guide/platform/j8-jack.html
android {
...
defaultConfig {
...
jackOptions {
enabled true
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
I'm using a shared library module. When I add jackOptions to my main module, it syncs and compiles with no issues. However, when the configuration is added to my serviceLibrary module, sync fails with: Error:Cannot add task ':serviceLibrary:assembleDebug' as a task with that name already exists.
My two build files are fairly similar in regards to the configuration:
android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
defaultConfig {
jackOptions {
enabled true
}
applicationId "com.my.app"
minSdkVersion 16
targetSdkVersion 24
versionCode 83
versionName "2.0.8"
vectorDrawables.useSupportLibrary = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
...
so this error is not making a lot of sense to me. Any help would be appreciated.
Copyright Notice:Content Author:「jwBurnside」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/40901305/android-issues-enabling-java-8-features-using-a-shared-library