我正在尝试为React Native构建一个liblinphone包装器(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')
}
从app settings.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
}
答案 0 :(得分:0)
无需更改应用程序的gradle或settings.gradle,只需对您原生模块的gradle进行以下更改:
repositories {
mavenCentral()
flatDir { dirs "$rootDir/../node_modules/react-native-liblinphone/android/libs" }
}
希望它有所帮助!