gpt4 book ai didi

android - 使用 react-native 的 android 上的空白屏幕(仅限发布)

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:07:49 28 4
gpt4 key购买 nike

我的应用程序在模拟器上以 Debug模式运行良好。当我尝试在设备上使用已签名的 APK 或在模拟器上以 Release模式运行它时,使用:

react-native run-android --variant=release

它只是给出一个空白的白色屏幕并且不会加载。

我正在使用 React-Native-Navigation 和 React-Native-Firebase,它们可能会或可能不会导致问题。

我确实看到的一个错误与我认为的 Firebase 有关:

W/GooglePlayServicesUtil: Google Play services out of date. Requires 11717000 but found 10298470 11-20 11:24:04.624 16106-16106/? W/FA:

未能发送应用程序启动确实看起来不祥。

编辑:我不太确定上面的错误实际上是在我的设备上运行发布版本时导致空白屏幕的原因。此消息显示在模拟器中,但我的应用程序可在模拟器上运行。在我的设备上,我看到 Google Play 服务的版本是 11.7.46,我认为它应该可以正常工作。

还有什么其他因素会导致我的应用仅在发布时成为空白屏幕吗?

编辑 2:

这次我发现了另一个错误(我已经降级到旧版本的 react-native-firebase 2.2)

11-25 12:11:07.278 5281-5295/com.spectrum E/FirebaseCrash: Failed to load crash reporting com.google.android.gms.internal.mn: .com.google.android.gms.dynamite.DynamiteModule$zzc: Remote load failed. No local fallback found. at com.google.android.gms.internal.ml.zzFk(Unknown Source) at com.google.firebase.crash.zzc.zzFi(Unknown Source) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) at java.lang.Thread.run(Thread.java:818) Caused by: com.google.android.gms.dynamite.DynamiteModule$zzc: Remote load failed. No local fallback found. ...

编辑 3:

这里是 app.gradle 的依赖:

dependencies {
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:25.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
compile project(':react-native-navigation')

// RNFirebase required dependencies
compile(project(':react-native-firebase')) {
transitive = false
}
compile "com.google.firebase:firebase-core:11.0.4"

// RNFirebase optional dependencies
compile "com.google.firebase:firebase-crash:11.0.4"
compile "com.google.firebase:firebase-messaging:11.0.4"

// If you are receiving Google Play API availability issues, add the following dependency
// compile "com.google.android.gms:play-services-base:11.0.4"

}

最佳答案

如错误所述:

Google Play services out of date. Requires 11717000 but found 10298470

这意味着您有不同版本的 google play 服务。我将假设您使用的是最新的 firebase,即 Firebase 11.6.0,但您使用的是 Google Play 服务版本 10.2.9,而所需的版本是 11.7.1 .

来自 Firebase 文档(在先决条件中):

A device running Android 4.0 (Ice Cream Sandwich) or newer, and Google Play services 11.6.0 or higher

因此,您需要下载最新版本的 Google Play 服务,或者在您的 build.gradle 文件中降级 firebase

您当前拥有此版本的 firebase:

'com.google.firebase:firebase-core:11.6.0'

降级(可能)到:

'com.google.firebase:firebase-core:10.2.0'

如果你降级 firebase-core,那么你也必须降级(在 build.gradle 中)firebase-auth/firebase-storage/firebase-数据库

关于android - 使用 react-native 的 android 上的空白屏幕(仅限发布),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47400050/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com