已经运行的JS服务器响应原生app

时间:2017-03-12 20:01:02

标签: javascript android react-native

我从这里开始使用入门教程:https://facebook.github.io/react-native/docs/getting-started.html。我可以使用react-native start启动我的包管理器。但是运行应用程序本身总是会导致崩溃。

$ react-native run-android
JS server already running.
Building and installing the app on the device (cd android && gradlew.bat installDebug...
Error occurred during initialization of VM
Unable to use shared archive.
An error has occurred while processing the shared archive file.
Unable to unmap shared space.
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

有什么问题?

2 个答案:

答案 0 :(得分:1)

您已经在同一端口的后台运行了一个react本机进程。

使用ps -ef | grep react 然后使用进程ID终止进程 kill -9 pid

然后重新执行命令: react-native run-android

答案 1 :(得分:0)

  

首先授予gradlew适当的权限,在根目录中,运行以下命令

public static void SwapMinMaxIfNull<T>(this IEnumerable<T> rows, string reportfor)
{
   if (reportfor.Equals("Comparison"))
   {
      var row = rows as IEnumerable<RiskBoardDataToExport>;                
      try
      {
         if (rows.Any())
         {
            var Tests = row.Where(min => min.MinGaitSpeed == null && min.MaxGaitSpeed != null).ToList();
            if (Tests != null)
            {
               foreach (RiskBoardDataToExport test in Tests)
               {
                  test.MinGaitSpeed = test.MaxGaitSpeed;
                  test.MaxGaitSpeed = null;
               }
            }
            // again check for next object 
            Tests = row.Where(min => min.MinTUGTime == null && min.MaxTUGTime != null).ToList();
            if (Tests != null)
            {
               foreach (RiskBoardDataToExport test in Tests)
               {
                  test.MinTUGTime = test.MaxTUGTime;
                  test.MaxTUGTime = null;
               }
            }
            // again check for next object
             Tests = row.Where(min => min.MinBergScoreSpeed == null && min.MaxBergScoreSpeed != null).ToList();
             if (Tests != null)
             {
                foreach (RiskBoardDataToExport test in Tests)
                {
                   test.MinBergScoreSpeed = test.MaxBergScoreSpeed;
                   test.MaxBergScoreSpeed = null;
                }
             }
             //.. for brevity
          }
     }
}
  

在此之后,请确保您的android文件夹中有local.properties文件,其中sdk文件路径为

chmod 755 android/gradlew