Ошибка при инициализации firabase.init () из плагина Nativescript firebase

Я пытаюсь использовать подключаемый модуль native script firebase для FCM, чтобы реализовать push-уведомление в моем собственном сценарии приложение. Но когда я пытаюсь запустить firebase, вызывая firebase init в соответствии с документацией.

  firebase.init({
        onMessageReceivedCallback: function(message) {
            console.log("Title: " + message.title);
            console.log("Body: " + message.body);
            // if your server passed a custom property called 'foo', then do this:
            console.log("Value of 'foo': " + message.data.foo);
        }
    }).then(function (instance) {
        console.log("firebase.init done");
    }, function (error) {
        console.log("firebase.init error: " + error);
    });

Я получаю эту ошибку

Error in firebase.init: Error: A valid Facebook app id must be set in the AndroidManifest.xml or set by calling FacebookSdk.setApplicationId before initializing the sdk.
com.facebook.FacebookSdk.sdkInitialize(FacebookSdk.java:275)
com.facebook.FacebookSdk.sdkInitialize(FacebookSdk.java:231)
com.tns.Runtime.callJSMethodNative(Native Method)
com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1088)
com.tns.Runtime.callJSMethodImpl(Runtime.java:970)
com.tns.Runtime.callJSMethod(Runtime.java:957)
com.tns.Runtime.callJSMethod(Runtime.java:941)
com.tns.Runtime.callJSMethod(Runtime.java:933)
com.tns.gen.android.view.GestureDetector_SimpleOnGestureListener_frnal_ts_helpers_l58_c38__TapAndDoubleTapGestureListenerImpl.onSingleTapUp(GestureDetector_SimpleOnGestureListener_frnal_ts_helpers_l58_c38__TapAndDoubleTapGestureListenerImpl.java:12)
android.view.GestureDetector.onTouchEvent(GestureDetector.java:635)
android.support.v4.view.GestureDetectorCompat$GestureDetectorCompatImplJellybeanMr2.onTouchEvent(GestureDetectorCompat.java:480)
android.support.v4.view.GestureDetectorCompat.onTouchEvent(GestureDetectorCompat.java:543)
com.tns.Runtime.callJSMethodNative(Native Method)
com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1088)
com.tns.Runtime.callJSMethodImpl(Runtime.java:970)
com.tns.Runtime.callJSMethod(Runtime.java:957)
com.tns.Runtime.callJSMethod(Runtime.java:941)
com.tns.Runtime.callJSMethod(Runtime.java:933)

Но во время установки плагина я установил да только для облачных сообщений и платформы Android. Я не использую аутентификацию firebase. Для входа в facebook я использую плагин native-script-OAuth.

Это include.gradle из nativescript-plugin-firebase / platform / android.

android {
   productFlavors {
     "fireb" {
        dimension "fireb"
      }
  }
}

repositories {
   jcenter()
    mavenCentral()
    maven {
       url "https://maven.google.com"
   }
}

def supportVersion = project.hasProperty("supportVersion") ? project.supportVersion : "26.0.0"

dependencies {
    compile "com.android.support:appcompat-v7:$supportVersion"
    compile "com.android.support:cardview-v7:$supportVersion"
    compile "com.android.support:customtabs:$supportVersion"
    compile "com.android.support:design:$supportVersion"
    compile "com.android.support:support-compat:$supportVersion"

     def firebaseVersion = "12.0.1"

    // make sure you have these versions by updating your local Android SDK's (Android Support repo and Google repo)
  compile "com.google.firebase:firebase-core:$firebaseVersion"
  compile "com.google.firebase:firebase-auth:$firebaseVersion"

  // for reading google-services.json and configuration
   def googlePlayServicesVersion = 
    project.hasProperty('googlePlayServicesVersion') ? 
    project.googlePlayServicesVersion : firebaseVersion
    compile "com.google.android.gms:play-services-
   base:$googlePlayServicesVersion"

   // Uncomment if you want to use the regular Database
  // compile "com.google.firebase:firebase-database:$firebaseVersion"

  // Uncomment if you want to use 'Cloud Firestore'
  // compile "com.google.firebase:firebase-firestore:$firebaseVersion"

  // Uncomment if you want to use 'Remote Config'
  // compile "com.google.firebase:firebase-config:$firebaseVersion"

  // Uncomment if you want to use 'Crash Reporting'
  // compile "com.google.firebase:firebase-crash:$firebaseVersion"

  // Uncomment if you want FCM (Firebase Cloud Messaging)
 compile "com.google.firebase:firebase-messaging:$firebaseVersion"

  // Uncomment if you want Google Cloud Storage
  // compile "com.google.firebase:firebase-storage:$firebaseVersion"

  // Uncomment if you want AdMob
  // compile "com.google.firebase:firebase-ads:$firebaseVersion"

  // Uncomment if you need Facebook Authentication
  // compile ("com.facebook.android:facebook-android-sdk:4.+"){ exclude group: 'com.google.zxing' }

  // Uncomment if you need Google Sign-In Authentication
  // compile "com.google.android.gms:play-services-auth:$googlePlayServicesVersion"

  // Uncomment if you need Firebase Invites or Dynamic Links
  // compile "com.google.firebase:firebase-invites:$firebaseVersion"
}
apply plugin: "com.google.gms.google-services"

Было бы здорово, если бы мне в этом помогли.


person Saidul Amin Nobin    schedule 07.04.2018    source источник


Ответы (1)


хорошо, проблема возникла из-за плагина native-script facebook. Я также ранее установил плагин native-script-facebook, который вызывал эту проблему. Это может быть конфликт плагинов или что-то в этом роде. После удаления встроенного скрипта facebook проблема была решена.

person Saidul Amin Nobin    schedule 08.04.2018