Onsignal app id无效

时间:2017-11-08 13:28:21

标签: android

我正试图在我的Android应用程序项目中暗示信号推送通知当我打开应用程序说无效的应用程序ID时,我会收到错误请帮助

错误日志

11-08 18:50:58.831 15128 15128 E   OneSignal                                    OneSignal AppId format is invalid.
11-08 18:50:58.831 15128 15128 E   OneSignal                                    Example: 'b2f7f966-d8cc-11e4-bed1-df8f05be55ba'
11-08 18:50:58.831 15128 15128 E   OneSignal                                    
11-08 18:50:58.831 15128 15128 E   OneSignal                                    java.lang.NullPointerException: uuid == null
11-08 18:50:58.831 15128 15128 E   OneSignal                                    at java.util.UUID.fromString(UUID.java:182)
11-08 18:50:58.831 15128 15128 E   OneSignal                                    at com.onesignal.OSUtils.initializationChecker(OSUtils.java:62)
11-08 18:50:58.831 15128 15128 E   OneSignal                                    at com.onesignal.OneSignal.init(OneSignal.java:491)
11-08 18:50:58.831 15128 15128 E   OneSignal                                    at com.onesignal.OneSignal.init(OneSignal.java:467)
11-08 18:50:58.831 15128 15128 E   OneSignal                                    at com.onesignal.OneSignal.access$000(OneSignal.java:79)
11-08 18:50:58.831 15128 15128 E   OneSignal                                    at com.onesignal.OneSignal$Builder.init(OneSignal.java:283)
11-08 18:50:58.831 15128 15128 E   OneSignal                                    at com.mytest.test.MyApplication.onCreate(MyApplication.java:24)
11-08 18:50:58.831 15128 15128 E   OneSignal                                    at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1037)
11-08 18:50:58.831 15128 15128 E   OneSignal                                    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6422)
11-08 18:50:58.831 15128 15128 E   OneSignal                                    at android.app.ActivityThread.access$1800(ActivityThread.java:229)
11-08 18:50:58.831 15128 15128 E   OneSignal                                    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1887)
11-08 18:50:58.831 15128 15128 E   OneSignal                                    at android.os.Handler.dispatchMessage(Handler.java:102)
11-08 18:50:58.831 15128 15128 E   OneSignal                                    at android.os.Looper.loop(Looper.java:148)
11-08 18:50:58.831 15128 15128 E   OneSignal                                    at android.app.ActivityThread.main(ActivityThread.java:7325)
11-08 18:50:58.831 15128 15128 E   OneSignal                                    at java.lang.reflect.Method.invoke(Native Method)
11-08 18:50:58.831 15128 15128 E   OneSignal                                    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
11-08 18:50:58.831 15128 15128 E   OneSignal                                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
11-08 18:50:59.721 2622 3256 E     Watchdog                                     !@Sync 1206 [11-08 18:50:59.734]

的build.gradle

    defaultConfig {
        applicationId "com.mytest.test"

        // TODO: Please update the OneSignal ID below to yours!
        manifestPlaceholders = [onesignal_app_id: "955e2312-8a7f-45c8-9418-c58dc24b8632",
                                // Project number pulled from dashboard, local value is ignored.
                                onesignal_google_project_number: "REMOTE"]

        minSdkVersion 15
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])

    // OneSignal requires at least version 7.0.0 of GMS but the newest version is recommend.
    // Required for OneSignal, even if you have added FCM.
    compile 'com.google.android.gms:play-services-gcm:8.1.0'

    // Required for geotagging
    compile 'com.google.android.gms:play-services-location:8.1.0'


    // play-services-analytics is only needed when using 8.1.0 or older.
     compile 'com.google.android.gms:play-services-analytics:8.1.0'
    //noinspection GradleCompatible

    compile 'com.android.support.constraint:constraint-layout:1.0.2'

compile files('libs/OneSignalSDK.jar')
}

知道什么是错的吗? 我试图在我的Android应用程序项目中暗示onsignal推送通知当我打开应用程序说无效的应用程序ID请帮助时出现错误

1 个答案:

答案 0 :(得分:0)

看到这张图片:

enter image description here

请看下面的网址:

Troubleshooting Android

在此处REMOTE onesignal_google_project_number: "REMOTE"插入您的发件人ID,例如:onesignal_google_project_number: "5454545845"< ===您的发件人ID。

enter image description here

enter image description here