1

我想将推送通知集成到我的 React Native 项目中,按照指南 https://mobile.azure.com/orgs/....../push/setup 以及当我运行时

react-native run-android

我有一个错误:

-> % react-native run-android
Scanning 744 folders for symlinks in /Users/kalaliu/temp/RNBase/node_modules (5ms)
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...
File /Users/kalaliu/.android/repositories.cfg could not be loaded.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApk'.
   > A problem occurred configuring project ':mobile-center-push'.
      > Could not resolve all dependencies for configuration ':mobile-center-push:_debugPublishCopy'.
         > Could not find com.google.firebase:firebase-core:11.0.0.
           Required by:
               RNBase:mobile-center-push:unspecified > com.microsoft.azure.mobile:mobile-center-push:0.10.0
         > Could not find com.google.firebase:firebase-messaging:11.0.0.
           Required by:
               RNBase:mobile-center-push:unspecified > com.microsoft.azure.mobile:mobile-center-push:0.10.0

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

看起来我需要在我的 RN 项目中升级我的 android SDK?有什么想法吗?我的安卓配置

 compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.rnbase"
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 1
        versionName "1.0.1"
        ndk {
            abiFilters "armeabi-v7a"
        }
        vectorDrawables.useSupportLibrary = true
    }

我的 package.json

"mobile-center": "^0.6.0",
"mobile-center-analytics": "^0.6.0"
"mobile-center-crashes": "^0.6.0",
"mobile-center-push": "^0.7.0",
"react": "16.0.0-alpha.12",
"react-native": "^0.45.1",

PS:我找到了firebase提示: 如果我升级我的本地 SDK,这对 React Native 来说是一个安全的更新吗?

4

2 回答 2

3

Firebase SDK 位于本地存储库中,如果过时需要更新:

在此处输入图像描述

于 2017-07-05T18:25:46.740 回答
0

看起来您缺少与 Firebase 相关的步骤。请确保您已完成说明的所有步骤。

文档中:

在使用 Mobile Center Push 服务之前,您需要将 Firebase 添加到您的应用程序中。

于 2017-07-05T13:51:50.253 回答