I almost completed a project in Android Studio that included OpenCV library, I imported the library by creating a new folder "jniLibs" under app/src/main. Now there is a big problem, the .apk file size is 105 MB. Using shrinkResources and minifyEnabled for the App module, the dimensions drop to 95 MB. Activating shrinkResources and minifyEnabled also for the OpenCV module, I am returned an error when compiling. Gradle can't find packages of the library!
This is my build.gradle(App)
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId 'it.project'
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
}
buildTypes {
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets.main {
jniLibs.srcDir 'src/main/jniLibs'
jni.srcDirs = []
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:26.0.2'
compile 'com.android.support:design:26.0.2'
compile 'com.google.code.gson:gson:2.7'
compile project(':openCVLibrary330')
}
and this is build.gradle(library)
apply plugin: 'com.android.library'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
minSdkVersion 19
targetSdkVersion 26
}
}
how can I activate gradle to clean up the library code too?
In this situation with this gradle builds i get an apk of 95 MB. But activating minify for library too i get the error. Cannot resolve org.opencv.core ecc ecc