我正在构建一个 Android 的 React Native 模块,我的代码需要从第三方 SDK 中导入类,该 SDK 以 aar 文件的形式提供。我应该如何将此文件打包到我的模块中?我尝试添加
allprojects {
repositories {
flatDir {
dirs: 'libs'
}
}
}
和
dependencies {
... other deps ...
compile (name:'my-external-lib', ext:'aar')
}
将这个 my-external-lib.aar 文件放到 libs/
文件夹中,并将其添加到 build.gradle 文件中,但是在构建包含 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
有什么建议吗?