android - React Native 安卓运行报错 java.lang.NullPointerException
问题描述
$ ./gradlew installDebug --stacktrace --info 130 ↵Starting BuildSettings evaluated using settings file ’/Users/zehao/Work/tpy/AwesomeProject/android/settings.gradle’.Projects loaded. Root project using build file ’/Users/zehao/Work/tpy/AwesomeProject/android/build.gradle’.Included projects: [root project ’AwesomeProject’, project ’:app’]Evaluating root project ’AwesomeProject’ using build file ’/Users/zehao/Work/tpy/AwesomeProject/android/build.gradle’.Evaluating project ’:app’ using build file ’/Users/zehao/Work/tpy/AwesomeProject/android/app/build.gradle’.Creating configuration compileCreating configuration apkCreating configuration providedCreating configuration wearAppCreating configuration annotationProcessorCreating configuration androidTestCompileCreating configuration androidTestApkCreating configuration androidTestProvidedCreating configuration androidTestWearAppCreating configuration androidTestAnnotationProcessorCreating configuration testCompileCreating configuration testApkCreating configuration testProvidedCreating configuration testWearAppCreating configuration testAnnotationProcessorCreating configuration debugCompileCreating configuration debugApkCreating configuration debugProvidedCreating configuration debugWearAppCreating configuration debugAnnotationProcessorCreating configuration testDebugCompileCreating configuration testDebugApkCreating configuration testDebugProvidedCreating configuration testDebugWearAppCreating configuration testDebugAnnotationProcessorCreating configuration releaseCompileCreating configuration releaseApkCreating configuration releaseProvidedCreating configuration releaseWearAppCreating configuration releaseAnnotationProcessorCreating configuration testReleaseCompileCreating configuration testReleaseApkCreating configuration testReleaseProvidedCreating configuration testReleaseWearAppCreating configuration testReleaseAnnotationProcessorParsing the SDK, no caching allowedParsing /usr/local/opt/android-sdk/add-ons/addon-google_apis-google-23/package.xmlParsing /usr/local/opt/android-sdk/build-tools/23.0.1/package.xmlParsing /usr/local/opt/android-sdk/build-tools/25.0.2/package.xmlParsing /usr/local/opt/android-sdk/extras/m2repository/com/android/support/constraint/constraint-layout-solver/1.0.0-alpha7/package.xmlParsing /usr/local/opt/android-sdk/extras/m2repository/com/android/support/constraint/constraint-layout/1.0.0-alpha7/package.xmlParsing /usr/local/opt/android-sdk/platform-tools/package.xmlParsing /usr/local/opt/android-sdk/platforms/android-23/package.xmlParsing /usr/local/opt/android-sdk/sources/android-23/package.xmlParsing /usr/local/opt/android-sdk/system-images/android-23/default/x86/package.xmlParsing /usr/local/opt/android-sdk/system-images/android-23/google_apis/x86_64/package.xmlParsing /usr/local/opt/android-sdk/tools/package.xmlParsing /usr/local/opt/android-sdk/add-ons/addon-google_apis-google-23/package.xmlParsing /usr/local/opt/android-sdk/build-tools/23.0.1/package.xmlParsing /usr/local/opt/android-sdk/build-tools/25.0.2/package.xmlParsing /usr/local/opt/android-sdk/extras/m2repository/com/android/support/constraint/constraint-layout-solver/1.0.0-alpha7/package.xmlParsing /usr/local/opt/android-sdk/extras/m2repository/com/android/support/constraint/constraint-layout/1.0.0-alpha7/package.xmlParsing /usr/local/opt/android-sdk/platform-tools/package.xmlParsing /usr/local/opt/android-sdk/platforms/android-23/package.xmlParsing /usr/local/opt/android-sdk/sources/android-23/package.xmlParsing /usr/local/opt/android-sdk/system-images/android-23/default/x86/package.xmlParsing /usr/local/opt/android-sdk/system-images/android-23/google_apis/x86_64/package.xmlParsing /usr/local/opt/android-sdk/tools/package.xmlResource missing. [HTTP GET: https://jcenter.bintray.com/com/android/support/appcompat-v7/23.0.1/appcompat-v7-23.0.1.pom]Resource missing. [HTTP HEAD: https://jcenter.bintray.com/com/android/support/appcompat-v7/23.0.1/appcompat-v7-23.0.1.jar]Resource missing. [HTTP GET: https://jcenter.bintray.com/com/android/support/recyclerview-v7/23.4.0/recyclerview-v7-23.4.0.pom]Resource missing. [HTTP HEAD: https://jcenter.bintray.com/com/android/support/recyclerview-v7/23.4.0/recyclerview-v7-23.4.0.jar]Resource missing. [HTTP GET: https://jcenter.bintray.com/com/android/support/support-v4/23.2.1/support-v4-23.2.1.pom]Resource missing. [HTTP HEAD: https://jcenter.bintray.com/com/android/support/support-v4/23.2.1/support-v4-23.2.1.jar]Parsing /usr/local/opt/android-sdk/add-ons/addon-google_apis-google-23/package.xmlParsing /usr/local/opt/android-sdk/build-tools/23.0.1/package.xmlParsing /usr/local/opt/android-sdk/build-tools/25.0.2/package.xmlParsing /usr/local/opt/android-sdk/extras/m2repository/com/android/support/constraint/constraint-layout-solver/1.0.0-alpha7/package.xmlParsing /usr/local/opt/android-sdk/extras/m2repository/com/android/support/constraint/constraint-layout/1.0.0-alpha7/package.xmlParsing /usr/local/opt/android-sdk/platform-tools/package.xmlParsing /usr/local/opt/android-sdk/platforms/android-23/package.xmlParsing /usr/local/opt/android-sdk/sources/android-23/package.xmlParsing /usr/local/opt/android-sdk/system-images/android-23/default/x86/package.xmlParsing /usr/local/opt/android-sdk/system-images/android-23/google_apis/x86_64/package.xmlParsing /usr/local/opt/android-sdk/tools/package.xmlIOException: https://dl.google.com/android/repository/addons_list-3.xmljavax.net.ssl.SSLHandshakeException: Remote host closed connection during handshakeIOException: https://dl.google.com/android/repository/addons_list-2.xmljavax.net.ssl.SSLHandshakeException: Remote host closed connection during handshakeIOException: https://dl.google.com/android/repository/addons_list-1.xmljavax.net.ssl.SSLHandshakeException: Remote host closed connection during handshakeFailed to download any source lists!javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshakeFAILURE: Build failed with an exception.* What went wrong:A problem occurred configuring project ’:app’.> java.lang.NullPointerException (no error message)* Try:Run with --debug option to get more log output.* Exception is:org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ’:app’.at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigurationFailure(LifecycleProjectEvaluator.java:79)at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:74)at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:61)at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:540)at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:93)at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:47)at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:35)at org.gradle.initialization.DefaultGradleLauncher$2.run(DefaultGradleLauncher.java:124)at org.gradle.internal.Factories$1.create(Factories.java:22)at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:53)at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:121)at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32)at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:98)at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:92)at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:63)at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:92)at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:83)at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:99)at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:48)at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:30)at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:81)at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:46)at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:51)at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:28)at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:43)at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:173)at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:239)at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:212)at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:205)at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)at org.gradle.launcher.Main.doAction(Main.java:33)at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:55)at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:36)at org.gradle.launcher.GradleMain.main(GradleMain.java:23)at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:30)at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:127)at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)Caused by: java.lang.NullPointerExceptionat com.android.builder.sdk.DefaultSdkLoader.updateRepositories(DefaultSdkLoader.java:486)at com.android.build.gradle.internal.DependencyManager.collectArtifacts(DependencyManager.java:514)at com.android.build.gradle.internal.DependencyManager.gatherDependencies(DependencyManager.java:375)at com.android.build.gradle.internal.DependencyManager.resolveDependencyForConfig(DependencyManager.java:278)at com.android.build.gradle.internal.DependencyManager.resolveDependencies(DependencyManager.java:155)at com.android.build.gradle.internal.TaskManager.resolveDependencies(TaskManager.java:364)at com.android.build.gradle.internal.VariantManager$9.call(VariantManager.java:636)at com.android.build.gradle.internal.VariantManager$9.call(VariantManager.java:633)at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:156)at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:120)at com.android.build.gradle.internal.profile.SpanRecorders.record(SpanRecorders.java:44)at com.android.build.gradle.internal.VariantManager.createVariantData(VariantManager.java:629)at com.android.build.gradle.internal.VariantManager.createVariantDataForProductFlavors(VariantManager.java:823)at com.android.build.gradle.internal.VariantManager.populateVariantDataList(VariantManager.java:494)at com.android.build.gradle.internal.VariantManager$1.call(VariantManager.java:269)at com.android.build.gradle.internal.VariantManager$1.call(VariantManager.java:266)at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:156)at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:120)at com.android.build.gradle.internal.VariantManager.createAndroidTasks(VariantManager.java:265)at com.android.build.gradle.BasePlugin$11.call(BasePlugin.java:688)at com.android.build.gradle.BasePlugin$11.call(BasePlugin.java:685)at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:156)at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:120)at com.android.build.gradle.BasePlugin.createAndroidTasks(BasePlugin.java:683)at com.android.build.gradle.BasePlugin$10.call(BasePlugin.java:608)at com.android.build.gradle.BasePlugin$10.call(BasePlugin.java:605)at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:156)at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:120)at com.android.build.gradle.BasePlugin.lambda$createTasks$1(BasePlugin.java:603)at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:93)at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:82)at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:44)at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:79)at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatch.java:30)at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)at com.sun.proxy.$Proxy11.afterEvaluate(Unknown Source)at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:67)... 44 moreBUILD FAILEDTotal time: 7 mins 5.354 secsStopped 0 compiler daemon(s).
问题解答
回答1:IOException: https://dl.google.com/android/repository/addons_list-3.xmljavax.net.ssl.SSLHandshakeException: Remote host closed connection during handshakeIOException: https://dl.google.com/android/repository/addons_list-2.xmljavax.net.ssl.SSLHandshakeException: Remote host closed connection during handshakeIOException: https://dl.google.com/android/repository/addons_list-1.xmljavax.net.ssl.SSLHandshakeException: Remote host closed connection during handshakeFailed to download any source lists!javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshakeFAILURE: Build failed with an exception.
你没有设置 Android SDK ,build的时候会自动下载,但是google服务器需要翻墙,所以请先翻墙后,再次运行命令即可。
回答2:再来一次命令,RN在Android上是这样的,经常要多次重复才行。
相关文章:
1. javascript - vue报错,昨天也是这么写的也没报错呀,今天就报错了,不知原因。求解决2. html - jQuery 移动端横向滚动会带动网页上下滑动怎么办?3. 最新版的phpstudy的mysql版本只是5.5,有没有5.6或者5.7版本的集成版呀?4. css - 这个线怎么做,效果是竖直的效果,5. javascript - 关于微信公众号开发的一个trouble!6. html - 谁能推荐一个类似apple官网的模板,用来展示产品的?7. javascript - 这两种JS写法有什么区别8. css - font-face引入的新字体无法在火狐浏览器上显示?但是谷歌可以?9. css3 - transition transform初始display:block怎么就没移动效果?10. javascript - vue el 重复挂载 同一个实例