来自GIT的react-native UI Explorer示例无法在使用Genymotion模拟Android的Mac


  • 我按照在-https://github.com/facebook/react-native
  • 我正试图通过Mac上的Genymotion Android模拟器设置它来预览示例。*之前关于设置、撤回回购等的所有步骤都是成功的,没有任何错误。*然后,我在Mac上的bash shell中执行以下语句

./gradlew :Examples:UIExplorer:android:app:installDebug

生成时显示以下错误。

_:示例:UIExplorer:android:app:compileDebugJavaWithJavac/Users/xxx/gitRepo/react native/Examples/UIExplorer/android/app/src/main/java/UIExplorerActivity.java:63:错误:找不到符号

mReactInstanceManager.onPause();
^

symbol:方法onPause()location:ReactInstanceManager类型的变量mReactInstanceManager/Users/xxx/gitRepo/react native/Examples/UIExplorer/android/app/src/main/java/UIExplorerActivity.java:72:error:找不到符号

mReactInstanceManager.onResume(this, this);
^

symbol:方法onResume(UIExplorerActivity,UIExplorerActivity)location:ReactInstanceManager类型的变量mReactInstanceManager2个错误:示例:UIExplorer:android:app:compileDebugJavaWithJavac失败

失败:生成失败,出现异常。

  • 出了什么问题:任务":示例:UIExplorer:android:app:compileDebugJavaWithJavac"执行失败。

    编译失败;有关详细信息,请参阅编译器错误输出。

  • 尝试:使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获得更多日志输出。

BUILD FAILED_

使用--debug参数显示类似的信息

11:47:06.178[INF][org.gradle.api.internal.tasks.compile.JdkJavaCompiler]使用JDK Java编译器api编译。

11:47:06.434[错误][system.err]/Users/xxx/gitRepo/react native/Examples/UIExplorer/android/app/src/main/java/UIExplorerActivity.java:63:错误:找不到符号

11:47:06.434[错误][system.err]mReactInstanceManager.onPause();

11:47:06.434[错误][系统错误]
^11:47:06.435[错误][system.err]符号:方法onPause()

11:47:06.435[错误][system.err]位置:ReactInstanceManager 类型的变量mReactInstanceManager

11:47:06.440[错误][system.err]/Users/xxx/gitRepo/react native/Examples/UIExplorer/android/app/src/main/java/UIExplorerActivity.java:72:ERROR:找不到符号

11:47:06.441[错误][system.err]mReactInstanceManager.onResume(this,this);

11:47:06.441[错误][系统错误]^11:47:06.441[错误][system.err]符号:方法onResume(UIExplorerActivity,UIExplorerActivity)

11:47:06.441[错误][system.err]位置:ReactInstanceManager 类型的变量mReactInstanceManager

11:47:06.464[错误][系统错误]2个错误

11:47:06.465[DEBUG][org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter]完成执行任务':示例:UIExplorer:android:app:compileDebugJavaWithJavac'

11:47:06.465[LIFECYCLE][class org.gradle.TaskExecutionLogger]:示例:UIExplorer:android:app:compileDebugJavaWithJavac失败

11:47:06.466[INF][org.gradle.expension.taskgraph.AbstractTaskPlanExecutor]:示例:UIExplorer:android:app:compileDebugJavaWithJavac(Thread[Demon worker Thread4,5,main])已完成。耗时0.319秒。

11:47:06.466[DEBUG][org.gradle.expension.taskgraph.AbstractTaskPlanExecutor]任务工作者[Thread[Demon-worker Thread4,5,main]]完成,忙:5.546秒,空闲:0.049秒

11:47:06.468[错误][org.gradle.BuildExceptionReporter]

11:47:06.468[错误][org.gradle.BuildExceptionReporter]失败:生成失败,出现异常。

11:47:06.468[错误][org.gradle.BuildExceptionReporter]

11:47:06.469[错误][org.gradle.BuildExceptionReporter]*哪里出了问题:

11:47:06.469[错误][org.gradle.BuildExceptionReporter]任务"的执行失败:示例:UIExplorer:android:app:compileDebugJavaWithJavac'。

11:47:06.469[ERROR][org.gradle.BuildExceptionReporter]>编译失败;有关详细信息,请参阅编译器错误输出。

11:47:06.469[错误][org.gradle.BuildExceptionReporter]

11:47:06.469[错误][org.gradle.BuildExceptionReporter]*尝试:

11:47:06.470[ERROR][org.gradle.BuildExceptionReporter]使用--stacktrace选项运行以获取堆栈跟踪。

11:47:06.471【生命周期】【org.gradle.BuildResultLogger】

11:47:06.471【生命周期】【org.gradle.BuildResultLogger】BUILD FAILED

11:47:06.471【生命周期】【org.gradle.BuildResultLogger】

11:47:06.471[LIFECYCLE][org.gradle.BuildResultLogger]总时间:14.184秒

11:47:07.113[信息][org.gradle.elauncher.daemon.client.DemonClient]收到结果失败[value=org.gradle.initialization.ReportedException:org.gradleinternal.exceptions.LocationAwareException:任务执行失败

':示例:UIExplorer:android:app:compileDebugJavaWithJavac'。]来自守护进程DaemonInfo{pid=23827,address=[0c64a320-a8e2-43e3-ad0a-0b3dfff7feca端口:65276,address:[/0:0:0:0:0:1,/127.0.0.1],idle=true,

context=DefaultDaemonContext[uid=dba435c0-a637-4e5b-8486-166f81a1489c,javaHome=/Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home,daemonRegistryDir=/Users/xxx/.gradle/daemon,pid=23827,idleTimeout=10800000,daemon Opts=-xxx>:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.concoding=UTF-8,-Duser.country=US,-Duser.glanguage=en,-Duser.variation]}(构建应为完成)。

并且使用-info参数也返回相同的信息

执行任务':示例:UIExplorer:android:app:compileDebugJavaWithJavac'(最新检查耗时0.004秒),原因是:没有可用的历史记录。增量任务的所有输入文件都被视为过期:示例:UIExplorer:android:app:compileDebugJavaWithJavac'。使用JDK Java编译器API编译。/Users/xxx/gitRepo/react native/Examples/UIExplorer/android/app/src/main/java/UIExplorerActivity.java:63:错误:找不到符号mReactInstanceManager.onPause();^symbol:方法onPause()location:ReactInstanceManager类型的变量mReactInstanceManager/Users/xxx/gitRepo/react native/Examples/UIExplorer/android/app/src/main/java/UIExplorerActivity.java:72:error:找不到符号mReactInstanceManager.onResume(this,this);^symbol:方法onResume(UIExplorerActivity,UIExplorerActivity)location:ReactInstanceManager类型的变量mReactInstanceManager2个错误:示例:UIExplorer:android:app:compileDebugJavaWithJavac失败:示例:UIExplorer:android:app:compileDebugJavaWithJavac(Thread[Demon worker Thread 5,5,main])已完成。耗时0.418秒。

失败:生成失败,出现异常。

  • 出了什么问题:任务":示例:UIExplorer:android:app:compileDebugJavaWithJavac"执行失败。编译失败;有关详细信息,请参阅编译器错误输出。

  • 尝试:使用--stacktrace选项运行以获取堆栈跟踪。使用--debug选项运行以获得更多日志输出。

BUILD FAILED

总时间:7.151秒已停止0个编译器守护程序。接收到的结果失败[value=org.grade.initialization.ReportedException:org.grade.internal.exceptions.LocationAwareException:任务执行失败':示例:UIExplorer:android:app:compileDebugJavaWithJavac'。]来自守护进程DaemonInfo{pid=23827,address=[0c64a320-a8e2-43e3-ad0a-0b3dfff7feca端口:65276,addresses:[/0:0:0:0:0:0:1,/120.0.1]],idle=true,context=DefaultDaemonContext[uid=dba435c0-a637-4e5b-8486-166f81a1489c,javaHome=/Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home,daemonRegistryDir=/Users/xxx/.gradle/daemon,pid=23827,idleTimeout=10800000,daemonPopts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.concoding=UTF-8,-Dusser.country=US,-Dussr.language=en,-Dusse.variation]}(应该完成构建)。

使用--stacktrace返回

org.gradle.api.tasks.TaskExecutionException:任务"的执行失败:示例:UIExplorer:android:app:compileDebugJavaWithJavac'。位于org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)在org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)

。。。(不想把整个堆叠比赛,除非你想要它)

所有类型的错误都表明UIExplorerActivity.java在编译时存在onPause()和onResume()错误。

我已经研究过这份清单上的类似问题,包括-https://github.com/facebook/react-native/issues/5790-https://github.com/facebook/react-native/issues/4858

以及堆叠式气流的问题,包括

React原生Android示例不工作

React Native使android应用程序在genymotion 中加载

以及其他一些问题,但它们似乎与此问题无关(因为要么是不同的类失败,要么是不同问题导致相同结果

注意:构建iOS版本效果良好(使用xCode等)。

如何解决此问题?任何见解都值得赞赏。谢谢

Edward

结合github上的#react原生devs,得出了一个答案:

https://github.com/facebook/react-native/issues/6107

总结:

  • 回购在两天前(2016年2月22日)进行了更新,以纠正上述问题-https://github.com/facebook/react-native/commit/ad17a2f2908f430b05fd2836d3f08873988bce10。因此git pull最新回购

  • 节点加速更新为2.3.0

  • 更新npm-shrinkwrap.json…代码低于

    "节点匆忙":{

    "版本":"2.3.0","from":"node haste@>=2.2.0<3.0.0","依赖项":{

    在终端提示下。。。

npm安装节点匆忙

然后按照说明在mac上使用android模拟器模拟android运行react原生示例

/gradlew:示例:电影:安卓:应用程序:安装调试

/分装商/分装商.sh

那么一切都应该正常。(在撰写本文时。经常对本机更新做出反应)

最新更新