javascript - 从 : Intent shows a blank screen on a real device and I do not get any error with adb logcat 开始

标签 javascript android react-native react-navigation

我不知道为什么,突然我的 react-native 项目不再启动了 在 android 真实设备上。
两天前它就像一个魅力。
现在我总是在收到这些冗长的消息后出现空白屏幕:

102 actionable tasks: 4 executed, 98 up-to-date
Running adb -s F7AZFG015283 reverse tcp:8081 tcp:8081
Starting the app on F7AZFG015283 (adb -s F7AZFG015283 shell am start -n com.etc/com.etc.MainActivity)...
Starting: Intent { cmp=com.etc/.MainActivity }

应用程序似乎在手机上卡住。

react-native的版本是0.56.0。
我试过:

adb logcat

但我没有看到任何错误。
我还尝试了这些命令:

rm -rf node_modules
yarn cache clean
rm -rf android/build
npm install

但我还是没能解决。

更新

看来问题可能出在 react-native-facebook-sdk 和您必须在 AndroidManifest 文件中添加的元名称元素。

我用 ignite 创建了一个新项目,并且:

  • 添加了 react-native-facebook-sdk:有效;
  • 将 MainApplication.java 编辑为包安装说明:它有效;
  • 将这一行“<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>”添加到 AndroidManifest.xml 文件:它不起作用,我有黑屏。

string.xml中存在“facebook_app_id”元素,其值正确。

最佳答案

2018 年 8 月 29 日发布的最新版 Android 版 Facebook SDK (4.36.0) 似乎存在问题。

我能够按照此线程中的建议解决此问题 https://github.com/facebook/react-native/issues/17147#issuecomment-351930384

您必须在 android/build.gradle 文件中使用特定版本的 facebook-android-sdk:

allprojects {
    repositories {
        ...
        configurations.all {
            resolutionStrategy {
                force 'com.facebook.android:facebook-android-sdk:4.28.0'
            }
        }
    }
}

关于javascript - 从 : Intent shows a blank screen on a real device and I do not get any error with adb logcat 开始,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52123116/

相关文章:

javascript - 如何在angularjs中向div添加元素?

javascript - 为什么reduce中的predicate函数需要wrapper函数?

ios - react-native iOS新方案报错: Undefined symbol: _OBJC_CLASS_$_FlipperClient

java - 使用 radioButtons 更新 ListView 适配器输入

java - 在 Java/Android 中创建目录以根据图像类型对图像进行分类?

javascript - 如何在 React Native 中获取父组件区域的触摸事件?

android - 如何在 React Native Android 应用程序中使用工具栏

javascript - javascript escape() 和 unescape() 的 PHP 实现

javascript - 使用 AngularJS 的动态元图像

android - GnssStatus.CallBack onSatelliteStatusChanged() 不工作