React-native-onesignal: خطأ في مكتبة خدمات Google Play

تم إنشاؤها على ٨ فبراير ٢٠١٨  ·  35تعليقات  ·  مصدر: OneSignal/react-native-onesignal

مرحبا،

يبدو أنه لا يمكنني توصيل تطبيقي بـ OneSignal. تم تجميع التطبيق بنجاح ، لكنه لا يتلقى إشعارات.

عندما أذهب إلى الإدارة Users/All Users ، أرى اتصالاً ، ولكن مع وجود خطأ يفيد بأن Google Play services library initialization error. Check for conflicting plugins and make sure "com.google.android.gms.version" is in your AndroidManifest.xml. Check the logcat for more details. .
لقد راجعت AndroidManifest.xml الموجود في android/app/build/intermediates/manifests/full/debug ويمكنني رؤية البيانات الوصفية com.google.android.gms.version هناك.

أي اقتراحات حول كيفية إصلاح هذا؟

التعليق الأكثر فائدة

نعم إنه كذلك. أنا أقدم لقطات شاشة.

image

image

ال 35 كومينتر

هل جهازك معروض على لوحة معلومات OneSignal؟

نعم إنه كذلك. أنا أقدم لقطات شاشة.

image

image

تم حل المشكلة. لم أكن أعلم أنه يجب إنشاء التطبيق للإصدار. هل هناك أي طريقة لاختبار هذا في إصدار التصحيح؟

تحديث - اكتشفت أن السبب الحقيقي هو أنه ليس لدي إذن لتلقي الإخطارات. لذلك لأي شخص يواجه نفس المشكلة ، تأكد من أن لديك هذا السطر في AndroidManifest.xml :

<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>

لدي نفس المشكلة وقمت بإضافة هذا الرمز ولكن لا يعمل :- (الرجاء المساعدة.

نفس المشكلة

LuckyLukywpyaryaseralimardany أي حل؟ شكرا..

حسنًا ، الحل الذي قدمته يعمل معي.

أقترح التحقق من إصدار التصحيح AndroidManifest.xml إنشاؤه أثناء الإنشاء ، إذا كان يحتوي على الإذن المطلوب. خلاف ذلك ، لا أعرف.

نفس المشكلة

yaseralimardanyLuckyLuky حصلت على هذا، في وضعي، وهذا هو مسألة بناء النسخة ...
بعد تحديث gradle ، gms ، يعمل أخيرًا.
شكرا لكما.

حصلت على هذا الخطأ في لوجكات:
E / OneSignal: خطأ غير معروف في الحصول على رمز FCM
java.lang.NoSuchMethodError: لا توجد طريقة ثابتة هي DeviceProtectedStorage (Landroid / content / Context ؛) Z في الفئة Landroid / support / v4 / content / ContextCompat ؛ أو فئاتها الفائقة (يظهر إعلان "android.support.v4.content.ContextCompat" في /data/app/com.motoshubapp-2/base.apk)
في com.google.firebase.FirebaseApp.zza (مصدر غير معروف)
في com.google.firebase.FirebaseApp.initializeApp (مصدر غير معروف)
على com.onesignal.PushRegistratorFCM.initFirebaseApp (PushRegistratorFCM.java:64)
على com.onesignal.PushRegistratorFCM.getToken (PushRegistratorFCM.java:50)
على com.onesignal.PushRegistratorAbstractGoogle.attemptRegistration (PushRegistratorAbstractGoogle.java:97)
على com.onesignal.PushRegistratorAbstractGoogle.access 100 دولار (PushRegistratorAbstractGoogle.java:37)
على com.onesignal.PushRegistratorAbstractGoogle $ 1.run (PushRegistratorAbstractGoogle.java:84)
في java.lang.Thread.run (Thread.java:818)

و pushToken فارغ في الجهاز الحقيقي. في مشروع ونسيجنل لدي خطأ:

خطأ في مكتبة خدمات Google Play

نفس المشكلة.

أيه أفكار؟

انا ايضا اواجه نفس المشكلة.

لدي نفس المشكلة

مشكلة واحدة في الإصدار الأحدث. الإصدار الأقدم الذي وضعته معرّف التطبيق في androidmanifest.

yaseralimardany أواجه نفس الخطأ وأيضًا رمز الدفع فارغ. أي جديد؟؟

LuckyLuky حصلت على الإذن وما زلت أحصل على هذه المشكلة.

adirzoari تحقق مما إذا كان هذا الإذن موجودًا في إصدار التصحيح / الإصدار AndroidManifest.xml إنشاؤه أثناء الإنشاء. خلاف ذلك ، لا أعرف للأسف.

ربما يكون ذلك بسبب أن لدي قاعدة تفاعلية أصلية ولا تعمل معًا؟

نفس المشكلة

تأكد من أن لديك أحدث 3.2.4 OneSignal SDK الذي تم إصداره في 21 مايو واتبع هذا الإعداد الإضافي الجديد إضافة خطوة

نعم ، أحاول في مشروع جديد ولا أعمل :(

نفس المشكلة هنا ... أنا أستخدم oneSignal مع xamarin

لقد حللت هنا ....
قمت بإلغاء تثبيت حزم خدمات google play والإشارة بالتسلسل.
بعد ذلك قمت بتثبيت إشارة واحدة ويعمل كل شيء الآن.
ملاحظة: ابحث في الأرشيفات التي تم إنشاؤها بعد الإنشاء وتحقق مما إذا كان ملف dll الخاص بخدمات google play موجودًا.
P2s: أنا أستخدم إشارات one مع تطبيقات xamarin.

lahed ، فقط إصدارات compileSdkVersion 26 و buildToolsVersion "26.0.0" يجب أن تتطابق مع "com.android. support: appcompat-v7 : 26.0.0". انظر التطبيق الخاص بك / build.gradle.

+1

تحقق # 525

lahed ، أتلقى إشعارًا ولكن التطبيق

بنيتي

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        maven { 
            url 'https://maven.google.com/' 
            name 'Google'
        } 
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenLocal()
        jcenter()
        maven { 

            url "$rootDir/../node_modules/react-native/android"
        }
        maven { 
            url 'https://maven.google.com/' 
            name 'Google' 
        }
    }
}

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]'
    }
}

apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

apply plugin: "com.android.application"

import com.android.build.OutputFile

/**
 * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
 * and bundleReleaseJsAndAssets).
 * These basically call `react-native bundle` with the correct arguments during the Android build
 * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
 * bundle directly from the development server. Below you can see all the possible configurations
 * and their defaults. If you decide to add a configuration block, make sure to add it before the
 * `apply from: "../../node_modules/react-native/react.gradle"` line.
 *
 * project.ext.react = [
 *   // the name of the generated asset file containing your JS bundle
 *   bundleAssetName: "index.android.bundle",
 *
 *   // the entry file for bundle generation
 *   entryFile: "index.android.js",
 *
 *   // whether to bundle JS and assets in debug mode
 *   bundleInDebug: false,
 *
 *   // whether to bundle JS and assets in release mode
 *   bundleInRelease: true,
 *
 *   // whether to bundle JS and assets in another build variant (if configured).
 *   // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
 *   // The configuration property can be in the following formats
 *   //         'bundleIn${productFlavor}${buildType}'
 *   //         'bundleIn${buildType}'
 *   // bundleInFreeDebug: true,
 *   // bundleInPaidRelease: true,
 *   // bundleInBeta: true,
 *
 *   // whether to disable dev mode in custom build variants (by default only disabled in release)
 *   // for example: to disable dev mode in the staging build type (if configured)
 *   devDisabledInStaging: true,
 *   // The configuration property can be in the following formats
 *   //         'devDisabledIn${productFlavor}${buildType}'
 *   //         'devDisabledIn${buildType}'
 *
 *   // the root of your project, i.e. where "package.json" lives
 *   root: "../../",
 *
 *   // where to put the JS bundle asset in debug mode
 *   jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
 *
 *   // where to put the JS bundle asset in release mode
 *   jsBundleDirRelease: "$buildDir/intermediates/assets/release",
 *
 *   // where to put drawable resources / React Native assets, e.g. the ones you use via
 *   // require('./image.png')), in debug mode
 *   resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
 *
 *   // where to put drawable resources / React Native assets, e.g. the ones you use via
 *   // require('./image.png')), in release mode
 *   resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
 *
 *   // by default the gradle tasks are skipped if none of the JS files or assets change; this means
 *   // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
 *   // date; if you have any other folders that you want to ignore for performance reasons (gradle
 *   // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
 *   // for example, you might want to remove it from here.
 *   inputExcludes: ["android/**", "ios/**"],
 *
 *   // override which node gets called and with what additional arguments
 *   nodeExecutableAndArgs: ["node"],
 *
 *   // supply additional arguments to the packager
 *   extraPackagerArgs: []
 * ]
 */

project.ext.react = [
    entryFile: "index.js"
]

apply from: "../../node_modules/react-native/react.gradle"

/**
 * Set this to true to create two separate APKs instead of one:
 *   - An APK that only works on ARM devices
 *   - An APK that only works on x86 devices
 * The advantage is the size of the APK is reduced by about 4MB.
 * Upload all the APKs to the Play Store and people will download
 * the correct one based on the CPU architecture of their device.
 */
def enableSeparateBuildPerCPUArchitecture = false

/**
 * Run Proguard to shrink the Java bytecode in release builds.
 */
def enableProguardInReleaseBuilds = false

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.2"

    defaultConfig {
        applicationId "com.driverapp"
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
         manifestPlaceholders = [onesignal_app_id: "7cb17176-6d1d-48cb-89aa-2df617123eba",
                                onesignal_google_project_number: "REMOTE"]
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86"
        }
    }
    buildTypes {
        release {
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }
    // applicationVariants are e.g. debug, release
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            // For each separate APK per architecture, set a unique version code as described here:
            // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
            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-mauron85-background-geolocation')
    compile project(':react-native-image-picker')
    compile project(':react-native-onesignal')
    compile project(':react-native-vector-icons')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:26.0.1"
    compile "com.facebook.react:react-native:+"  // From node_modules
    compile(project(':react-native-maps')){
        exclude group: 'com.google.android.gms', module: 'play-services-base'
        exclude group: 'com.google.android.gms', module: 'play-services-maps'
    }
    compile 'com.google.android.gms:play-services-base:+'
    compile 'com.google.android.gms:play-services-maps:+'
}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}


رمز إشارة واحد

 OneSignal.init("7cb17176-6d1d-48cb-89aa-2df617123eba")
      OneSignal.setSubscription(true);
     // OneSignal.inFocusDisplaying(2);


      OneSignal.addEventListener('received', this.onReceived);
      OneSignal.addEventListener('opened', this.onOpened);
      OneSignal.addEventListener('ids', this.onIds);

      OneSignal.configure();  // if device info not working 


    }


    onReceived = (notification) => {
      console.log("Notification received: ", notification);
    }

    onOpened = (openResult) => {
      console.log('Message: ', openResult.notification.payload.body);
      console.log('Data: ', openResult.notification.payload.additionalData);
      console.log('isActive: ', openResult.notification.isAppInFocus);
      console.log('openResult: ', openResult);
    }

    onIds = (device)=> {
      console.log('Device info: ', device);
    }




    componentWillUnmount() {
      OneSignal.removeEventListener('received', this.onReceived);
      OneSignal.removeEventListener('opened', this.onOpened);
      OneSignal.removeEventListener('ids', this.onIds);

    }

androidmanifesto.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.driverapp">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>

    <application
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:allowBackup="false"
      android:theme="@style/AppTheme">
      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        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.geo.API_KEY"
      android:value="key"/>
    </application>

</manifest>

<activity ...> <service android:name="com.google.firebase.components.ComponentDiscoveryService" > <meta-data android:name="com.google.firebase.components:com.google.firebase.iid.Registrar" android:value="com.google.firebase.components.ComponentRegistrar" /> </service> ... </activity>

إنه يعمل بالنسبة لي

لم يعمل أي من الحلول المقترحة هنا بالنسبة لي ، فأنا أستخدم إصدار حزمة واحدة للإصدار 2.6.0 ، هل هناك أي شيء آخر يستحق المحاولة؟ شكرا

نفس المشكلة هنا ، لقد قمت بنشر ملفات التكوين الخاصة بي حول هذه المشكلة الأخرى:

https://github.com/OneSignal/react-native-onesignal/issues/525#issuecomment -668732429

لقد غيرت app_id للإشارة في التطبيق إلى واحد جديد وعمل.

انا ايضا اواجه نفس المشكلة.

هل كانت هذه الصفحة مفيدة؟
0 / 5 - 0 التقييمات