【问题标题】:react native Could not find com.google.firebase反应原生找不到 com.google.firebase
【发布时间】:2017-09-06 17:44:03
【问题描述】:

我最近将我的 react 本机应用程序弹出到 Expokit。我正在尝试使用react native firebase。遵循android installation page 上给出的 react native firebase 的设置说明后,当我执行“react-native run-android”时出现错误:“找不到 com.google.firebase:firebase-core:11.2.0” .请注意,正如在 SO 上的其他页面上给出的那样,我已经从 Android Studio 安装了 Google Play 服务和 Google 存储库,但即使这样做了,我仍然会收到错误消息。这是“react-native run-android”的完整输出:

Scanning 885 folders for symlinks in /Users/aksheyjawa/Misc/mobiledev/reactNative/SRFYSSapp/node_modules (23ms)
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...
NDK is missing a "platforms" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory.  It is currently set to /Users/aksheyjawa/Library/Android/sdk/ndk-bundle.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.

NDK is missing a "platforms" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory.  It is currently set to /Users/aksheyjawa/Library/Android/sdk/ndk-bundle.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.

Incremental java compilation is an incubating feature.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApkCopy'.
   > Could not find com.google.firebase:firebase-core:11.2.0.
     Searched in the following locations:
         file:/Users/aksheyjawa/Library/Android/sdk/extras/google/m2repository/com/google/firebase/firebase-core/11.2.0/firebase-core-11.2.0.pom
         file:/Users/aksheyjawa/Library/Android/sdk/extras/google/m2repository/com/google/firebase/firebase-core/11.2.0/firebase-core-11.2.0.jar
         file:/Users/aksheyjawa/Misc/mobiledev/reactNative/SRFYSSapp/android/sdk-manager/com/google/firebase/firebase-core/11.2.0/firebase-core-11.2.0.jar
         file:/Users/aksheyjawa/Library/Android/sdk/extras/android/m2repository/com/google/firebase/firebase-core/11.2.0/firebase-core-11.2.0.pom
         file:/Users/aksheyjawa/Library/Android/sdk/extras/android/m2repository/com/google/firebase/firebase-core/11.2.0/firebase-core-11.2.0.jar
         file:/Users/aksheyjawa/Misc/mobiledev/reactNative/SRFYSSapp/android/sdk-manager/com/google/firebase/firebase-core/11.2.0/firebase-core-11.2.0.jar
     Required by:
         project :app
   > Could not find com.google.android.gms:play-services-base:11.2.0.
     Searched in the following locations:
         file:/Users/aksheyjawa/Library/Android/sdk/extras/google/m2repository/com/google/android/gms/play-services-base/11.2.0/play-services-base-11.2.0.pom
         file:/Users/aksheyjawa/Library/Android/sdk/extras/google/m2repository/com/google/android/gms/play-services-base/11.2.0/play-services-base-11.2.0.jar
         file:/Users/aksheyjawa/Misc/mobiledev/reactNative/SRFYSSapp/android/sdk-manager/com/google/android/gms/play-services-base/11.2.0/play-services-base-11.2.0.jar
         file:/Users/aksheyjawa/Library/Android/sdk/extras/android/m2repository/com/google/android/gms/play-services-base/11.2.0/play-services-base-11.2.0.pom
         file:/Users/aksheyjawa/Library/Android/sdk/extras/android/m2repository/com/google/android/gms/play-services-base/11.2.0/play-services-base-11.2.0.jar
         file:/Users/aksheyjawa/Misc/mobiledev/reactNative/SRFYSSapp/android/sdk-manager/com/google/android/gms/play-services-base/11.2.0/play-services-base-11.2.0.jar
     Required by:
         project :app
   > Could not find com.google.firebase:firebase-analytics:11.2.0.
     Searched in the following locations:
         file:/Users/aksheyjawa/Library/Android/sdk/extras/google/m2repository/com/google/firebase/firebase-analytics/11.2.0/firebase-analytics-11.2.0.pom
         file:/Users/aksheyjawa/Library/Android/sdk/extras/google/m2repository/com/google/firebase/firebase-analytics/11.2.0/firebase-analytics-11.2.0.jar
         file:/Users/aksheyjawa/Misc/mobiledev/reactNative/SRFYSSapp/android/sdk-manager/com/google/firebase/firebase-analytics/11.2.0/firebase-analytics-11.2.0.jar
         file:/Users/aksheyjawa/Library/Android/sdk/extras/android/m2repository/com/google/firebase/firebase-analytics/11.2.0/firebase-analytics-11.2.0.pom
         file:/Users/aksheyjawa/Library/Android/sdk/extras/android/m2repository/com/google/firebase/firebase-analytics/11.2.0/firebase-analytics-11.2.0.jar
         file:/Users/aksheyjawa/Misc/mobiledev/reactNative/SRFYSSapp/android/sdk-manager/com/google/firebase/firebase-analytics/11.2.0/firebase-analytics-11.2.0.jar
     Required by:
         project :app
   > Could not find com.google.android.gms:play-services-base:11.2.0.
     Searched in the following locations:
         file:/Users/aksheyjawa/Library/Android/sdk/extras/google/m2repository/com/google/android/gms/play-services-base/11.2.0/play-services-base-11.2.0.pom
         file:/Users/aksheyjawa/Library/Android/sdk/extras/google/m2repository/com/google/android/gms/play-services-base/11.2.0/play-services-base-11.2.0.jar
         file:/Users/aksheyjawa/Misc/mobiledev/reactNative/SRFYSSapp/android/sdk-manager/com/google/android/gms/play-services-base/11.2.0/play-services-base-11.2.0.jar
         file:/Users/aksheyjawa/Library/Android/sdk/extras/android/m2repository/com/google/android/gms/play-services-base/11.2.0/play-services-base-11.2.0.pom
         file:/Users/aksheyjawa/Library/Android/sdk/extras/android/m2repository/com/google/android/gms/play-services-base/11.2.0/play-services-base-11.2.0.jar
         file:/Users/aksheyjawa/Misc/mobiledev/reactNative/SRFYSSapp/android/sdk-manager/com/google/android/gms/play-services-base/11.2.0/play-services-base-11.2.0.jar
     Required by:
         project :app > host.exp.exponent:expoview:19.0.0 > com.google.android.gms:play-services-analytics:9.8.0
         project :app > host.exp.exponent:expoview:19.0.0 > com.google.android.gms:play-services-gcm:9.8.0
         project :app > host.exp.exponent:expoview:19.0.0 > com.google.android.gms:play-services-location:9.8.0
         project :app > host.exp.exponent:expoview:19.0.0 > com.google.android.gms:play-services-fitness:9.8.0
         project :app > host.exp.exponent:expoview:19.0.0 > com.google.android.gms:play-services-auth:9.8.0
         project :app > host.exp.exponent:expoview:19.0.0 > com.google.android.gms:play-services-ads:9.8.0
         project :app > host.exp.exponent:expoview:19.0.0 > com.google.android.gms:play-services-maps:9.8.0
         project :app > host.exp.exponent:expoview:19.0.0 > com.google.android.gms:play-services-analytics:9.8.0 > com.google.android.gms:play-services-analytics-impl:9.8.0
         project :app > host.exp.exponent:expoview:19.0.0 > com.google.android.gms:play-services-gcm:9.8.0 > com.google.android.gms:play-services-iid:9.8.0
         project :app > host.exp.exponent:expoview:19.0.0 > com.google.android.gms:play-services-auth:9.8.0 > com.google.android.gms:play-services-auth-base:9.8.0
         project :app > host.exp.exponent:expoview:19.0.0 > com.google.android.gms:play-services-ads:9.8.0 > com.google.android.gms:play-services-clearcut:9.8.0

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

BUILD FAILED

Total time: 52.177 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html

以下是 build.gradle 中的几行代码:

compile(project(':react-native-firebase')) {
  transitive = false
}
compile "com.google.firebase:firebase-core:11.2.0"
compile "com.google.android.gms:play-services-base:11.2.0"
compile "com.google.firebase:firebase-analytics:11.2.0"
apply plugin: 'com.google.gms.google-services'

【问题讨论】:

    标签: android firebase react-native


    【解决方案1】:

    您需要添加 Google maven 存储库,请参阅 https://firebase.google.com/docs/android/setup#manually_add_firebase

    在根 build.gradle 中应该有一个 allprojects > dependencies 部分。在jcenter()下方添加maven repo:

    maven {
        url "https://maven.google.com" // Google's Maven repository
    } 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-12-31
      • 2017-05-10
      • 1970-01-01
      • 2021-08-25
      • 2020-03-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多