gpt4 book ai didi

android - 如何从 Android 库构建 AAR?

转载 作者:行者123 更新时间:2023-11-29 23:05:10 27 4
gpt4 key购买 nike

我关注了the official guide on creating Android libraries ,但有些东西似乎不太适合我。

我的项目由两个模块组成。一个名为“app”的应用程序模块和一个名为“bfsdk”的库模块。在我的应用程序的 build.gradle 文件中,我像这样包含库:

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(path: ':bfsdk')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

然后在我的库模块中,我的 build.gradle 在第一行指定它是一个库:

apply plugin: 'com.android.library'

根据文档,我现在应该:

select the library module in the Project window and then click Build > Build APK

这应该构建 AAR 文件。然而:

enter image description here

enter image description here

当我点击它并等待整个构建过程完成时,我无法在任何地方找到 AAR 文件。这会在 ~/Source/BluePlayer/app/build/outputs/apk/android/release 中生成一个 APK 文件,但是 ~/中没有 build 目录Source/BluePlayer/bfsdk 文件夹。

我做错了什么?我错过了什么步骤? AAR 文件应该出现在哪里?

最佳答案

引用 Create aar file in Android Studio ,尝试简单地 Build > Rebuild project。 AAR 文件应该出现在 ~/Source/BluePlayer/bfsdk/build/outputs/aar

关于android - 如何从 Android 库构建 AAR?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56634384/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com