I have an application code in android studio, which I want to convert it to library project so that I can use it as library in other application.
The build.gradle of the library project is as follows
apply plugin: 'com.android.library'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 24
buildToolsVersion "24.0.3"
defaultConfig {
//applicationId "com.example"
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
jackOptions {
enabled true
}
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize "4g"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testCompile 'junit:junit:4.12'
/* support libraries*/
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
compile 'com.android.support:recyclerview-v7:23.1.0'
compile 'com.android.support:support-v4:23.1.0'
compile 'com.android.support:support-annotations:23.1.0'
/* google play services libraries*/
compile 'com.google.android.gms:play-services-location:9.0.0'
}
I am using android studio 2.2.1 and jdk 1.8,
jdk 1.8 requires jackOptions
it says:
Error:Library projects cannot enable Jack. Jack is enabled in default config.
if i disable jackOptions then my library is not working as due to jdk 1.8 it says jackOptions are necessary and getting following errors.
app:generateDebugSources
app:mockableAndroidJar
app:prepareDebugUnitTestDependencies
app:generateDebugAndroidTestSources
myapplication:generateDebugSources
myapplication:generateDebugAndroidTestSources
myapplication:mockableAndroidJar
myapplication:prepareDebugUnitTestDependencies
Duplicated entry in the settings. Just remove the following lines from your build.gradle:
jackOptions {
enabled true
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With