Android Gradle Plugin 3.0.0-alpha4-不从本地AAR选择.so库 [英] Android Gradle Plugin 3.0.0-alpha4 - not picking .so libraries from local AAR
问题描述
我目前正在将我的Android项目迁移到最新版本的Android Gradle插件,以便与Android Studio 3.0一起使用.
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.
除了我在本地AAR文件中拥有的.so本机库文件未打包到最终的APK中之外,一切似乎都工作正常.其中没有lib
文件夹.
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插件:
Android Gradle Plugin:
classpath 'com.android.tools.build:gradle:3.0.0-alpha4'
Gradle版本为4.0
.
Gradle version is 4.0
.
本地AAR是使用Android Studio中的New Module...
选项添加的,并且一直有效.
The local AAR is added using the New Module...
option in Android Studio and it has always worked.
这是生成的build.gradle
:
configurations.maybeCreate("default")
artifacts.add("default", file('FILENAME.aar'))
在应用程序build.gradle
中,我像往常一样声明它:
And in the application build.gradle
I declare it as usual like this:
implementation project(':NAME_OF_THE_MODULE')
我错过了重大更改吗?
以下已知问题与我的问题有关吗?
While using this plugin with Android Studio, dependencies on local AAR files are not yet supported.
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.
更新:旧的flatDir
技巧仍然可以正常运行:
Update: the old flatDir
trick still works fine:
flatDir {
dirs 'libs'
}
然后将AA复制到该文件夹(即app/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')
推荐答案
在我的案例中,使用"api"解决了该问题.
in my case using "api" solved the problem.
代替使用:
implementation(name: 'libvlc', ext: 'aar')
implementation(name: 'libvlc', ext: 'aar')
使用:
api(name: 'libvlc', ext: 'aar')
api(name: 'libvlc', ext: 'aar')
在图书馆项目的build.gradle内部
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
这篇关于Android Gradle Plugin 3.0.0-alpha4-不从本地AAR选择.so库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!