Sye*_*der 9 kotlin android-studio gradle-kts
实现(fileTree(mapOf(“dir”到“libs”,“include”到listOf(“*.jar”))))
实施(文件(“BudgetLibraryNBB.aar”))
Vic*_*hiu 13
推荐的方法是使用File-> New-> New Module->导入它Import .JAR/.AAR Package,然后在库模块build.gradle.kts文件中引用它:
implementation(project(":BudgetLibraryNBB"))
Run Code Online (Sandbox Code Playgroud)
如果将其放入 libs 目录中:
implementation(files("./libs/BudgetLibraryNBB.aar"))
Run Code Online (Sandbox Code Playgroud)
或者
implementation(files("$projectDir/libs/BudgetLibraryNBB.aar"))
Run Code Online (Sandbox Code Playgroud)
当你执行bundleAar任务时,你会遇到以下错误:
Execution failed for task ':common:bundleDebugAar'.
> Direct local .aar file dependencies are not supported when building an AAR. The
resulting AAR would be broken because the classes and Android resources from any
local .aar file dependencies would not be packaged in the resulting AAR. Previous
versions of the Android Gradle Plugin produce broken AARs in this case too
(despite not throwing this error). The following direct local .aar file
dependencies of the :common project caused this error:
Run Code Online (Sandbox Code Playgroud)
这非常简单,只需包含*.aar在fileTree
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar", "*.aar"))))
附言。当然,如果你仍然把你的图书馆放在libs目录中
| 归档时间: |
|
| 查看次数: |
12330 次 |
| 最近记录: |