反应本机找不到com.google.firebase [英] react native Could not find com.google.firebase
问题描述
我最近将我的React本机应用程序弹出到Expokit.我正在尝试使用反应本地Firebase .按照 android安装页面,当我执行"react-native run-android"时,出现错误:找不到com.google.firebase:firebase-core:11.2.0".请注意,正如SO其他页面上给出的那样,我已经从Android Studio安装了Google Play服务和Google存储库,但是即使这样做,我仍然会收到错误消息.这是'react-native run-android'的完整输出:
I have recently ejected my react native app to Expokit. I am trying to use react native firebase. After following the setup instructions for react native firebase as given on android installation page, when I execute 'react-native run-android' I get an error: "Could not find com.google.firebase:firebase-core:11.2.0". Please note that, as given on other pages on SO, I have already installed Google play services and Google repository from Android studio but even after doing that I am still getting the error. Here is the complete output of '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的几行:
Here are a few lines from 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'
推荐答案
You'll need to add the Google maven repo, see https://firebase.google.com/docs/android/setup#manually_add_firebase
在根目录build.gradle中应该有一个allprojects>依赖项部分.将Maven存储库添加到 jcenter()
下方:
In the root build.gradle there should be an allprojects > dependencies section. Add the maven repo there underneath jcenter()
:
maven {
url "https://maven.google.com" // Google's Maven repository
}
这篇关于反应本机找不到com.google.firebase的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!