首页  >  问答  >  正文

android - React Native 安卓运行报错 java.lang.NullPointerException

$ ./gradlew installDebug --stacktrace --info                                                                                         130 ↵
Starting Build
Settings 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 compile
Creating configuration apk
Creating configuration provided
Creating configuration wearApp
Creating configuration annotationProcessor
Creating configuration androidTestCompile
Creating configuration androidTestApk
Creating configuration androidTestProvided
Creating configuration androidTestWearApp
Creating configuration androidTestAnnotationProcessor
Creating configuration testCompile
Creating configuration testApk
Creating configuration testProvided
Creating configuration testWearApp
Creating configuration testAnnotationProcessor
Creating configuration debugCompile
Creating configuration debugApk
Creating configuration debugProvided
Creating configuration debugWearApp
Creating configuration debugAnnotationProcessor
Creating configuration testDebugCompile
Creating configuration testDebugApk
Creating configuration testDebugProvided
Creating configuration testDebugWearApp
Creating configuration testDebugAnnotationProcessor
Creating configuration releaseCompile
Creating configuration releaseApk
Creating configuration releaseProvided
Creating configuration releaseWearApp
Creating configuration releaseAnnotationProcessor
Creating configuration testReleaseCompile
Creating configuration testReleaseApk
Creating configuration testReleaseProvided
Creating configuration testReleaseWearApp
Creating configuration testReleaseAnnotationProcessor
Parsing the SDK, no caching allowed
Parsing /usr/local/opt/android-sdk/add-ons/addon-google_apis-google-23/package.xml
Parsing /usr/local/opt/android-sdk/build-tools/23.0.1/package.xml
Parsing /usr/local/opt/android-sdk/build-tools/25.0.2/package.xml
Parsing /usr/local/opt/android-sdk/extras/m2repository/com/android/support/constraint/constraint-layout-solver/1.0.0-alpha7/package.xml
Parsing /usr/local/opt/android-sdk/extras/m2repository/com/android/support/constraint/constraint-layout/1.0.0-alpha7/package.xml
Parsing /usr/local/opt/android-sdk/platform-tools/package.xml
Parsing /usr/local/opt/android-sdk/platforms/android-23/package.xml
Parsing /usr/local/opt/android-sdk/sources/android-23/package.xml
Parsing /usr/local/opt/android-sdk/system-images/android-23/default/x86/package.xml
Parsing /usr/local/opt/android-sdk/system-images/android-23/google_apis/x86_64/package.xml
Parsing /usr/local/opt/android-sdk/tools/package.xml
Parsing /usr/local/opt/android-sdk/add-ons/addon-google_apis-google-23/package.xml
Parsing /usr/local/opt/android-sdk/build-tools/23.0.1/package.xml
Parsing /usr/local/opt/android-sdk/build-tools/25.0.2/package.xml
Parsing /usr/local/opt/android-sdk/extras/m2repository/com/android/support/constraint/constraint-layout-solver/1.0.0-alpha7/package.xml
Parsing /usr/local/opt/android-sdk/extras/m2repository/com/android/support/constraint/constraint-layout/1.0.0-alpha7/package.xml
Parsing /usr/local/opt/android-sdk/platform-tools/package.xml
Parsing /usr/local/opt/android-sdk/platforms/android-23/package.xml
Parsing /usr/local/opt/android-sdk/sources/android-23/package.xml
Parsing /usr/local/opt/android-sdk/system-images/android-23/default/x86/package.xml
Parsing /usr/local/opt/android-sdk/system-images/android-23/google_apis/x86_64/package.xml
Parsing /usr/local/opt/android-sdk/tools/package.xml
Resource 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.xml
Parsing /usr/local/opt/android-sdk/build-tools/23.0.1/package.xml
Parsing /usr/local/opt/android-sdk/build-tools/25.0.2/package.xml
Parsing /usr/local/opt/android-sdk/extras/m2repository/com/android/support/constraint/constraint-layout-solver/1.0.0-alpha7/package.xml
Parsing /usr/local/opt/android-sdk/extras/m2repository/com/android/support/constraint/constraint-layout/1.0.0-alpha7/package.xml
Parsing /usr/local/opt/android-sdk/platform-tools/package.xml
Parsing /usr/local/opt/android-sdk/platforms/android-23/package.xml
Parsing /usr/local/opt/android-sdk/sources/android-23/package.xml
Parsing /usr/local/opt/android-sdk/system-images/android-23/default/x86/package.xml
Parsing /usr/local/opt/android-sdk/system-images/android-23/google_apis/x86_64/package.xml
Parsing /usr/local/opt/android-sdk/tools/package.xml
IOException: https://dl.google.com/android/repository/addons_list-3.xml
javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
IOException: https://dl.google.com/android/repository/addons_list-2.xml
javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
IOException: https://dl.google.com/android/repository/addons_list-1.xml
javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
Failed to download any source lists!
javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake

FAILURE: 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.NullPointerException
        at 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 more


BUILD FAILED

Total time: 7 mins 5.354 secs
Stopped 0 compiler daemon(s).
伊谢尔伦伊谢尔伦2763 天前1321

全部回复(2)我来回复

  • 迷茫

    迷茫2017-04-18 10:53:42

    IOException: https://dl.google.com/android/repository/addons_list-3.xml
    javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
    IOException: https://dl.google.com/android/repository/addons_list-2.xml
    javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
    IOException: https://dl.google.com/android/repository/addons_list-1.xml
    javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
    Failed to download any source lists!
    javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
    
    FAILURE: Build failed with an exception.

    你没有设置 Android SDK ,build的时候会自动下载,但是google服务器需要翻墙,所以请先翻墙后,再次运行命令即可。

    回复
    0
  • 怪我咯

    怪我咯2017-04-18 10:53:42

    再来一次命令,RN在Android上是这样的,经常要多次重复才行。

    回复
    0
  • 取消回复