I have made a custom module and included tensorflow-lite dependency in it with 'api' configuration. I build its aar. Now I create a new project and put the aar in libs folder. But I can access only the classes I created and not the tensorflow api. How can I use the transitive dependencies too without including them again?
I have replaced 'implementation' with 'api' as I read that in a blog (https://medium.com/mindorks/implementation-vs-api-in-gradle-3-0-494c817a6fa).
build.gradle(Module:mylib)
apply plugin: 'com.android.library'
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 24
targetSdkVersion 28
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
aaptOptions{
noCompress "tflite"
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
api 'androidx.appcompat:appcompat:1.1.0-alpha04'
api 'org.tensorflow:tensorflow-lite:0.0.0-gpu-experimental'
}
build.gradle(Module:two in a new project):
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 24
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
arguments '-DANDROID_TOOLCHAIN=clang', '-DANDROID_STL=gnustl_static'
cppFlags "-std=c++11", "-frtti", "-fexceptions"
}
}
ndk {
abiFilters 'armeabi-v7a'
}
}
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
aaptOptions {
noCompress "tflite"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
sourceSets {
main {
jniLibs.srcDirs = ['libs']
}
}
}
repositories {
maven { url 'https://google.bintray.com/tensorflow' }
flatDir {
dirs 'libs'
}
mavenCentral()
}
dependencies {
api fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
api project(':openCVLibrary341')
api "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}