问题 运行 设备上的 React Native
Problem running React Native on the device
我正尝试在我的 Android phone 上 运行 一个 React Native 项目,当我 运行 'npx react-native run-android' 时它给了我这个问题。但如果我使用 Android Studio 模拟器,它会正常工作:
08:57:53 V/ddms: execute: running am get-config
08:57:53 V/ddms: execute 'am get-config' on '2b704600a21c7ece' : EOF hit. Read: -1
08:57:53 V/ddms: execute: returning
Installing APK 'app-debug.apk' on 'SM-G9650 - 10' for app:debug
08:57:53 D/app-debug.apk: Uploading app-debug.apk onto device '2b704600a21c7ece'
08:57:53 D/Device: Uploading file onto device '2b704600a21c7ece'
08:57:53 D/ddms: Reading file permision of /home/thadeucesario/Documents/Thadeu/Code/ReactNative/mobile/android/app/build/outputs/apk/debug/app-debug.apk as: rw-rw-r--
08:57:54 V/ddms: execute: running pm install -r -t "/data/local/tmp/app-debug.apk"
08:57:57 V/ddms: execute 'pm install -r -t "/data/local/tmp/app-debug.apk"' on '2b704600a21c7ece' : EOF hit. Read: -1
08:57:57 V/ddms: execute: returning
> Task :app:installDebug FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.2/userguide/command_line_interface.html#sec:command_line_warnings
27 actionable tasks: 2 executed, 25 up-to-date
Unable to install /home/thadeucesario/Documents/Thadeu/Code/ReactNative/mobile/android/app/build/outputs/apk/debug/app-debug.apk
com.android.ddmlib.InstallException: Unknown failure: Exception occurred while executing:
android.os.ParcelableException: java.io.IOException: Requested internal only, but not enough space
at android.util.ExceptionUtils.wrap(ExceptionUtils.java:34)
at com.android.server.pm.PackageInstallerService.createSession(PackageInstallerService.java:562)
at com.android.server.pm.PackageManagerShellCommand.doCreateSession(PackageManagerShellCommand.java:2700)
at com.android.server.pm.PackageManagerShellCommand.runInstall(PackageManagerShellCommand.java:1061)
at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:169)
at android.os.ShellCommand.exec(ShellCommand.java:104)
at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:26690)
at android.os.Binder.shellCommand(Binder.java:881)
at android.os.Binder.onTransact(Binder.java:765)
at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:5433)
at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:5012)
at android.os.Binder.execTransactInternal(Binder.java:1021)
at android.os.Binder.execTransact(Binder.java:994)
Caused by: java.io.IOException: Requested internal only, but not enough space
at com.android.internal.content.PackageHelper.resolveInstallVolume(PackageHelper.java:531)
at com.android.internal.content.PackageHelper.resolveInstallVolume(PackageHelper.java:447)
at com.android.internal.content.PackageHelper.resolveInstallVolume(PackageHelper.java:462)
at com.android.server.pm.PackageInstallerService.createSessionInternal(PackageInstallerService.java:742)
at com.android.server.pm.PackageInstallerService.createSession(PackageInstallerService.java:560)
... 11 more
有人可以帮助我吗?
谢谢
尝试用 Android Studio 打开 android 路径并用它构建,控制台可能会显示错误所在。
使用 Android Studio,您还可以前往:
File > Ivalidate Caches/Restart...
然后单击“无效并重新启动”。之后再次尝试 运行 您的项目:
npx react-native run-android
在您终端机的倒数第 6 行 Caused by: java.io.IOException: Requested internal only, but not enough space
。当您的物理设备中没有足够的 space 来安装和 运行 应用程序时,这基本上会发生。
确保您已打开开发者模式并打开调试器,并且您的物理 android 设备上还剩下足够的 space。
尝试使用 adb devices
检查所有连接的设备(如果没有,则必须先安装 adb)。
然后强行关闭模拟器或者以防万一 windows 或 linux 模拟器 .
然后运行npx react-native run-android
我认为这将非常适合您。
我正尝试在我的 Android phone 上 运行 一个 React Native 项目,当我 运行 'npx react-native run-android' 时它给了我这个问题。但如果我使用 Android Studio 模拟器,它会正常工作:
08:57:53 V/ddms: execute: running am get-config
08:57:53 V/ddms: execute 'am get-config' on '2b704600a21c7ece' : EOF hit. Read: -1
08:57:53 V/ddms: execute: returning
Installing APK 'app-debug.apk' on 'SM-G9650 - 10' for app:debug
08:57:53 D/app-debug.apk: Uploading app-debug.apk onto device '2b704600a21c7ece'
08:57:53 D/Device: Uploading file onto device '2b704600a21c7ece'
08:57:53 D/ddms: Reading file permision of /home/thadeucesario/Documents/Thadeu/Code/ReactNative/mobile/android/app/build/outputs/apk/debug/app-debug.apk as: rw-rw-r--
08:57:54 V/ddms: execute: running pm install -r -t "/data/local/tmp/app-debug.apk"
08:57:57 V/ddms: execute 'pm install -r -t "/data/local/tmp/app-debug.apk"' on '2b704600a21c7ece' : EOF hit. Read: -1
08:57:57 V/ddms: execute: returning
> Task :app:installDebug FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.2/userguide/command_line_interface.html#sec:command_line_warnings
27 actionable tasks: 2 executed, 25 up-to-date
Unable to install /home/thadeucesario/Documents/Thadeu/Code/ReactNative/mobile/android/app/build/outputs/apk/debug/app-debug.apk
com.android.ddmlib.InstallException: Unknown failure: Exception occurred while executing:
android.os.ParcelableException: java.io.IOException: Requested internal only, but not enough space
at android.util.ExceptionUtils.wrap(ExceptionUtils.java:34)
at com.android.server.pm.PackageInstallerService.createSession(PackageInstallerService.java:562)
at com.android.server.pm.PackageManagerShellCommand.doCreateSession(PackageManagerShellCommand.java:2700)
at com.android.server.pm.PackageManagerShellCommand.runInstall(PackageManagerShellCommand.java:1061)
at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:169)
at android.os.ShellCommand.exec(ShellCommand.java:104)
at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:26690)
at android.os.Binder.shellCommand(Binder.java:881)
at android.os.Binder.onTransact(Binder.java:765)
at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:5433)
at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:5012)
at android.os.Binder.execTransactInternal(Binder.java:1021)
at android.os.Binder.execTransact(Binder.java:994)
Caused by: java.io.IOException: Requested internal only, but not enough space
at com.android.internal.content.PackageHelper.resolveInstallVolume(PackageHelper.java:531)
at com.android.internal.content.PackageHelper.resolveInstallVolume(PackageHelper.java:447)
at com.android.internal.content.PackageHelper.resolveInstallVolume(PackageHelper.java:462)
at com.android.server.pm.PackageInstallerService.createSessionInternal(PackageInstallerService.java:742)
at com.android.server.pm.PackageInstallerService.createSession(PackageInstallerService.java:560)
... 11 more
有人可以帮助我吗?
谢谢
尝试用 Android Studio 打开 android 路径并用它构建,控制台可能会显示错误所在。
使用 Android Studio,您还可以前往:
File > Ivalidate Caches/Restart...
然后单击“无效并重新启动”。之后再次尝试 运行 您的项目:
npx react-native run-android
在您终端机的倒数第 6 行 Caused by: java.io.IOException: Requested internal only, but not enough space
。当您的物理设备中没有足够的 space 来安装和 运行 应用程序时,这基本上会发生。
确保您已打开开发者模式并打开调试器,并且您的物理 android 设备上还剩下足够的 space。
尝试使用 adb devices
检查所有连接的设备(如果没有,则必须先安装 adb)。
然后强行关闭模拟器或者以防万一 windows 或 linux 模拟器 .
然后运行npx react-native run-android
我认为这将非常适合您。