我在项目中包括了react-native-onesignal 。运行react-native run-android
时,我收到此错误。
这是我的build.gradle
文件,看起来像
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
maven {
url 'https://plugins.gradle.org/m2/'
}
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.10.0, 0.99.99]'
// NOTE: Do not place your application dependencies here; they belong
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
这是我的app/build.gradle
文件
dependencies {
compile project(':react-native-onesignal')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules
implementation (project(':react-native-maps')){
exclude group: 'com.google.android.gms'
}
implementation "com.google.android.gms:play-services-base:15.0.1"
implementation "com.google.android.gms:play-services-maps:15.0.1"
}
答案 0 :(得分:0)
配置文档对于onesignal颇具误导性。
他们说要在项目根目录 build.gradle 中添加的行应添加到 app / build.gradle 文件中。这样我解决了我的问题。
有关更多信息,请查看onesignal的示例应用程序。 example app