我已尝试将Onesignal实施到我的Android项目中,但我有关于Firebase的错误:
无法解决:com.google.firebase:firebase-messaging:15.0.1
我在文档中做了所有事情:https://documentation.onesignal.com/docs/android-sdk-setup#section-android-studio
这是我的build.gradle
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/'}
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.9.0, 0.99.99]'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
repositories {
maven { url 'https://maven.google.com' }
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.my.package"
manifestPlaceholders = [
onesignal_app_id: 'XXXXXX-1b8c-48d3-a596-d277fad80edc',
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: 'XXX921710280' ]
minSdkVersion 16
targetSdkVersion 27
versionCode 2
versionName "v2.2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:customtabs:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.android.gms:play-services-ads:15.0.1'
compile 'com.android.volley:volley:1.0.0'
compile 'com.github.simbiose:Encryption:2.0.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.scottyab:aescrypt:0.0.1'
compile 'com.github.bloder:magic:1.1'
compile 'com.onesignal:OneSignal:3.9.1'
}
答案 0 :(得分:0)
在 build.gradle :
中添加:
jcenter()
在repositories
然后再次同步Gradle
。
答案 1 :(得分:0)
现在可以使用,我必须为:
实现相同的版本implementation 'com.google.android.gms:play-services-ads:15.0.0'
implementation 'com.google.firebase:firebase-messaging:15.0.0'