我正在使用OneSignal进行响应式推送通知。
Blockquote 我的问题是“用户”(我的Android设备)未显示在OneSignal信息中心中,因为我的用户未订阅。 块引用 我已按照文档中的说明进行操作,但无法订阅用户。调试应用后,logcat会说- dalvikvm:找不到方法com.onesignal.OSUtils.hasGCMLibrary引用的类'com.google.android.gms.gcm.GoogleCloudMessaging'
OneSignal AppId format is invalid.
Example: 'b2f7f966-d8cc-11e4-bed1-df8f05be55ba'
java.lang.IllegalArgumentException: Invalid UUID:
****here is my app/build.gradle****
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/' } // Gradle Plugin Portal
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.10.0, 0.99.99]'
}
}
plugins {
id 'com.onesignal.androidsdk.onesignal-gradle-plugin' version '0.8.1'
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: "com.android.application"
repositories {
maven { url 'https://maven.google.com' }
}
import com.android.build.OutputFile
project.ext.react = [
entryFile: "index.js"
]
apply from: "../../node_modules/react-native/react.gradle"
def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false
android {
defaultConfig {
applicationId "com.onesignalexample"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
manifestPlaceholders = [
onesignal_app_id: "1b67a245-829d-4275-846c-118fce78eba3",
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: 'REMOTE'
]
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
compileSdkVersion 27
buildToolsVersion "27.0.3"
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
def versionCodes = ["armeabi-v7a":1, "x86":2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
dependencies {
compile project(':react-native-onesignal')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:27.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
compile 'com.onesignal:OneSignal:[3.9.1, 3.99.99]'
}
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
**Here is my AndroidManifest.xml**
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.onesignalexample">
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<application
android:name=".MainApplication"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:label="@string/app_name"
android:windowSoftInputMode="adjustResize"
android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
</application>
</manifest>
Anyone help appreciated