[英]react-native-onesignal Could not get unknown property 'android' for root project 'weather' of type org.gradle.api.Project
I have included react-native-onesignal in my project. 我已经在我的项目中加入了react-native-onesignal 。 When running
react-native run-android
im getting this error. 当运行
react-native run-android
im时出现此错误。
Here is my build.gradle
file looks like 这是我的
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'
And this is my app/build.gradle
file 这是我的
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"
} }
The configuration doc is quite misleading for onesignal. 配置文档对于onesignal颇具误导性。
The line that they are saying to add in project root build.gradle should be added in the app/build.gradle file. 他们说要在项目根目录build.gradle中添加的行应添加到app / build.gradle文件中。 Thus I solved my problem.
这样我解决了我的问题。
For more check out the example app of onesignal. 有关更多信息,请查看onesignal的示例应用程序。 example app
示例应用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.