简体   繁体   English

React Native Android应用程序白屏将无法启动

[英]React Native Android app white screen won't start

I get the following error log when I run my Android app: http://pastebin.com/1jHEfdQ3 The app sometimes crashes in the simulator but most of the time it just displays a white screen. 当我运行我的Android应用程序时,我收到以下错误日志: http//pastebin.com/1jHEfdQ3该应用程序有时会在模拟器中崩溃,但大多数时候它只显示一个白色的屏幕。 I can console.log one or two things until the app won't respond. 我可以console.log一两件事,直到应用程序不响应。 RR to refresh doesn't work. RR刷新不起作用。 None of the dev tools work. 开发工具都不起作用。 I'm stumped with what to do at this point. 我很难在这一点上做什么。

I'm running react native 0.38.0 我正在运行反应原生0.38.0

EDIT: 编辑:

I've tried cleaning my gradle and deleting and reinstalling my node modules. 我已经尝试清理我的gradle并删除并重新安装我的节点模块。

One thing to note is that I am using React Native Navigation which means I had to modify MainApplication and MainActivity to the following: 需要注意的一点是,我使用的是React Native Navigation,这意味着我必须将MainApplicationMainActivity修改为以下内容:

MainActivity: 主要活动:

package com.prayerrequest;

import com.facebook.react.ReactActivity;
import com.reactnativenavigation.NavigationApplication;
import com.airbnb.android.react.maps.MapsPackage;
import com.cmcewen.blurview.BlurViewPackage;
import io.realm.react.RealmReactPackage;
import com.reactnativenavigation.controllers.SplashActivity;


public class MainActivity extends SplashActivity {

}

MainApplication: MainApplication:

package com.prayerrequest;

import com.facebook.react.ReactPackage;

import com.cmcewen.blurview.BlurViewPackage;
import io.realm.react.RealmReactPackage;
import com.airbnb.android.react.maps.MapsPackage;

import com.reactnativenavigation.NavigationApplication;

import java.util.Arrays;
import java.util.List;

  public class MainApplication extends NavigationApplication {
    @Override
     public boolean isDebug() {
         // Make sure you are using BuildConfig from your own application
         return BuildConfig.DEBUG;
     }

     @Override
     public List<ReactPackage> createAdditionalReactPackages() {
        return Arrays.<ReactPackage>asList(
          new RealmReactPackage(),
          new BlurViewPackage(),
          new MapsPackage()
        );
     }
  }

I've crossposted on React Native's issues page here 我已经在React Native的问题页面上进行交叉

The issue seems to be 'Couldn't load memtrack module (No such file or directory)' 问题似乎是“无法加载memtrack模块(没有这样的文件或目录)”

It looks like there's an issue with the simulator. 看起来模拟器存在问题。

This is a config of my fully functional simulator: 这是我的全功能模拟器的配置: 在此输入图像描述

Lots of other suggestions can be found here: 在这里可以找到很多其他建议:

Couldn't load memtrack module Logcat Error 无法加载memtrack模块Logcat错误

I had a similar problem. 我遇到了类似的问题。 I would get this white screen when trying to get it to run on device. 试图让它在设备上运行时我会得到这个白色屏幕。

The problem was when I would do adb devices or react-native run-android I would get "ADB is Not Recognized as an internal or external command". 问题是当我做adb设备或反应本机运行时我会得到“ADB未被识别为内部或外部命令”。

So my fix was to add the path to adb.exe's parent directory to my Environment Variables and then restart my command prompts.I then ran react-native run-android and on startup no more red screen showing the completely useless error message Error calling AppRegistry.runApplication! 所以我的修复是将adb.exe的父目录路径添加到我的环境变量然后重新启动我的命令提示。然后运行react-native run-android并在启动时不再显示红色屏幕显示完全无用的错误消息错误调用AppRegistry .runApplication! :) :)

So I found ADB was located in my folder: 所以我发现ADB位于我的文件夹中:

C:\\Users\\dell\\AppData\\Local\\Android\\sdk\\platform-tools\\adb.exe I am on a Windows 10 system. C:\\ Users \\ dell \\ AppData \\ Local \\ Android \\ sdk \\ platform-tools \\ adb.exe我在Windows 10系统上。 dell is my user name of the computer. 戴尔是我的电脑用户名。

So I went to System Environment Variables then found "Path" then clicked "Edit", then clicked "New" and added in "C:\\Users\\dell\\AppData\\Local\\Android\\sdk\\platform-tools". 所以我转到系统环境变量,然后找到“路径”然后单击“编辑”,然后单击“新建”并添加到“C:\\ Users \\ dell \\ AppData \\ Local \\ Android \\ sdk \\ platform-tools”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM