Window React Native Android 开发问题 - java.lang.NullPointerException: entry [英] Window React Native Android development issue - java.lang.NullPointerException: entry

查看:56
本文介绍了Window React Native Android 开发问题 - java.lang.NullPointerException: entry的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 React Native 的 Android 开发新手,请在下面找到更多详细信息来解决我的问题

I'm new to React Native for Android development, please find the below further details to resolve my issue

  1. 操作系统:Windows 7
  2. JDK &JRE:版本 8
  3. 节点:v7.0.0
  4. NPM:3.10.6

每当我尝试在我的项目根文件夹中运行命令 - 'react-native run-android' 时,都会出现以下错误,但同时 React Packager 正在运行 - React Packager Ready.不知道是什么问题,

Whenever I try to run the command - 'react-native run-android' inside of my project root foleder gettting the following error, but meanwhile React Packager is opeing with - React Packager Ready. Not sure what whould be an issue,

$ react-native run-android(节点:6096)弃用警告:不推荐使用 os.tmpDir().使用 os.tmpdir() 代替.(node:6096) 弃用警告:在没有 new 的情况下使用 Buffer 将很快停止工作.使用 new Buffer(),或者最好使用 Buffer.from()Buffer.allocUnsafe()Buffer.alloc() 代替.

$ react-native run-android (node:6096) DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead. (node:6096) DeprecationWarning: Using Buffer without new will soon stop working. Use new Buffer(), or preferably Buffer.from(), Buffer.allocUnsafe() or Buffer.alloc() instead.

正在启动 JS 服务器...

Starting JS server...

运行 C:\Users******\AppData\Local\Android\sdk/platform-tools/adb -s emulator-5554 反向 tcp:8081 tcp:8081在设备上构建和安装应用程序(cd android && gradlew.bat installDebug...

Running C:\Users******\AppData\Local\Android\sdk/platform-tools/adb -s emulator-5554 reverse tcp:8081 tcp:8081 Building and installing the app on the device (cd android && gradlew.bat installDebug...

java.lang.NullPointerException:入口

java.lang.NullPointerException: entry

    at java.util.zip.ZipFile.getInputStream(ZipFile.java:346)
    at org.gradle.api.internal.classpath.DefaultModuleRegistry.loadModuleProperties(DefaultModuleRegistry.java:223)
    at org.gradle.api.internal.classpath.DefaultModuleRegistry.loadModule(DefaultModuleRegistry.java:138)
    at org.gradle.api.internal.classpath.DefaultModuleRegistry.getModule(DefaultModuleRegistry.java:127)
    at org.gradle.api.internal.classpath.DefaultModuleRegistry.module(DefaultModuleRegistry.java:168)
    at org.gradle.api.internal.classpath.DefaultModuleRegistry.loadModule(DefaultModuleRegistry.java:139)
    at org.gradle.api.internal.classpath.DefaultModuleRegistry.getModule(DefaultModuleRegistry.java:127)
    at org.gradle.api.internal.DefaultClassPathProvider.findClassPath(DefaultClassPathProvider.java:33)
    at org.gradle.api.internal.DefaultClassPathRegistry.getClassPath(DefaultClassPathRegistry.java:34)
    at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:47)
    at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
    at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    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)

无法在设备上安装该应用程序,请阅读上面的错误了解详情.确保您有一个正在运行的 Android 模拟器或已连接的设备设置你的 Android 开发环境:https://facebook.github.io/react-native/docs/android-setup.html

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

在 Windows 机器上下载并安装 Chocolatey,然后按照此文档 URL 执行以下初始设置,https://facebook.github.io/react-native/docs/getting-started.html

Downloaded and installed Chocolatey on windows machine then executed the following initial setup as per this document URL, https://facebook.github.io/react-native/docs/getting-started.html

  1. choco install nodejs.install
  2. choco 安装 python2
  3. npm install -g react-native-cli
  4. 下载并安装 Android SDK
  5. 系统变量,一种.Android HOME/JRE/JDK URL

AVD - Android 虚拟目录的启动没有任何问题.

AVD - Android Virtual Directory's are launching without any issue.

推荐答案

嘿,我终于可以找到路由原因并能够在 Windows 机器上运行 React Native android 应用程序了.对于我在构建应用程序时的情况,依赖项是从https"下载的.如果仍然有人在此问题上苦苦挣扎,请找到以下步骤来解决它,

Hey finally i can able to find the route-cause and able to run the react native android app on windows machine. For my case while build the application, dependencies are getting downloaded from "https". If still anyone struggling on this issue find the below steps to resolve it,

一些 Gradle 文件丢失所以,

Some Gradle files are missing So,

  1. 删除了 .gradle 目录 (C:/Users/****/.gradle)

将安全连接修改为非安全连接,

Modified secure to non-secure connection,

  1. 在应用程序文件夹下打开android/build.gradle"文件注释来自构建脚本的//jcenter()

应该是这样的,

buildscript {
    repositories {
        //jcenter()
        jcenter { url "http://jcenter.bintray.com/" }
    }

这篇关于Window React Native Android 开发问题 - java.lang.NullPointerException: entry的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆