gradle 构建使用Android AAR库的react native模块

zpjtge22  于 2023-08-06  发布在  Android
关注(0)|答案(1)|浏览(125)

我正在尝试为React Native构建一个liblinphone的 Package 器(react-native-liblinphone)。我将从Android实现开始,并使用linphone提供的SDK的.aar文件。
React Native模块自己成功构建,但当它链接到RN应用程序(使用react native link)时,应用程序构建无法找到SDK(Failed to resolve: :liblinphone-sdk:)。
从react-native-liblinphone build.gradle:

repositories {
    mavenCentral()
    flatDir { dirs 'libs' }
}

dependencies {
    compile 'com.facebook.react:react-native:+'
    compile(name: 'liblinphone-sdk', ext: 'aar')
}

字符串
从应用程序设置.gradle:

include ':react-native-liblinphone'
project(':react-native-liblinphone').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-liblinphone/android')
include ':react-native-contacts'
project(':react-native-contacts').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-contacts/android')
include ':react-native-vector-icons'
project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')

include ':app'


从app build.gradle:

dependencies {
    compile project(':react-native-liblinphone')
    compile project(':react-native-contacts')
    compile project(':react-native-vector-icons')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"
    compile "com.facebook.react:react-native:+"  // From node_modules
}

bkkx9g8r

bkkx9g8r1#

无需更改应用的gradle或设置。gradle,只需对原生模块的gradle进行以下更改:

repositories {
    mavenCentral()
    flatDir { dirs "$rootDir/../node_modules/react-native-liblinphone/android/libs" }
}

字符串
希望能帮上忙!

相关问题