问题
I'm currently migrating my Android project to the latest version of the Android Gradle Plugin in order to use it with Android Studio 3.0.
Everything seems to be working fine except for the fact that .so native libraries files I have in a local AAR file are not packaged into the final APK. There is no lib
folder inside it.
My project was already defining two flavor dimentions and I don't see any error or warning about it, so I think that's not the problem.
Android Gradle Plugin:
classpath 'com.android.tools.build:gradle:3.0.0-alpha4'
Gradle version is 4.0
.
The local AAR is added using the New Module...
option in Android Studio and it has always worked.
That's the build.gradle
generated:
configurations.maybeCreate("default")
artifacts.add("default", file('FILENAME.aar'))
And in the application build.gradle
I declare it as usual like this:
implementation project(':NAME_OF_THE_MODULE')
Am I missing a breaking change?
Is the following known issue related to my problem?
While using this plugin with Android Studio, dependencies on local AAR files are not yet supported.
Update: the old flatDir
trick still works fine:
flatDir {
dirs 'libs'
}
Then copy the AA inside that folder (i.e. app/libs
) and declare it as a dependency in this way:
implementation(name: 'libvlc', ext: 'aar')
回答1:
in my case using "api" solved the problem.
instead of using:
implementation(name: 'libvlc', ext: 'aar')
use:
api(name: 'libvlc', ext: 'aar')
inside of build.gradle in your library project
And for more information see:
https://blog.mindorks.com/implementation-vs-api-in-gradle-3-0-494c817a6fa https://developer.android.com/studio/build/dependencies.html
来源:https://stackoverflow.com/questions/44785068/android-gradle-plugin-3-0-0-alpha4-not-picking-so-libraries-from-local-aar