Den*_*nko 7 android gradle android-gradle-plugin react-native react-native-android
我正在构建一个Android React Native模块,我的代码从第三方SDK导入类,该SDK作为aar文件提供.我应该如何将此文件捆绑到我的模块中?我尝试添加
allprojects {
repositories {
flatDir {
dirs: 'libs'
}
}
}
Run Code Online (Sandbox Code Playgroud)
和
dependencies {
... other deps ...
compile (name:'my-external-lib', ext:'aar')
}
Run Code Online (Sandbox Code Playgroud)
到build.gradle文件并将此my-external-lib.aar文件放入libs/文件夹,但在构建包含react-native-my-module的MyApp react-native应用程序时仍然出错:
* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration
':app:_developmentDebugApkCopy'.
> Could not find :my-external-lib:.
Required by:
MyApp:app:unspecified > MyApp:react-native-my-module:unspecified
Run Code Online (Sandbox Code Playgroud)
有什么建议?
小智 0
在你的settings.gradle中你应该包含这个库,例如:
include ':app', ':my-external-lib'
Run Code Online (Sandbox Code Playgroud)
您可以将其编译为普通项目,例如:compile project(':my-external-lib')
另外你的my-external-libbuild.gradle 应该是这样的:
configurations.maybeCreate("default")
artifacts.add("default", file('my-external-lib.aar'))
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1461 次 |
| 最近记录: |