在新的 React-Native 项目中,我想在 Android 设备上运行默认应用程序,但我有这个 Java 异常:
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
WARNING: The specified Android SDK Build Tools version (26.0.1) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.4.
Android SDK Build Tools 27.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '26.0.1'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
Exception in thread "DisconnectableInputStream source reader" org.gradle.api.UncheckedIOException: java.io.IOException: Resource temporarily unavailable
at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:57)
at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:40)
at org.gradle.util.DisconnectableInputStream$1.run(DisconnectableInputStream.java:125)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.IOException: Resource temporarily unavailable
at java.io.FileInputStream.readBytes(Native Method)
at java.io.FileInputStream.read(FileInputStream.java:255)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:286)
at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
at org.gradle.util.DisconnectableInputStream$1.run(DisconnectableInputStream.java:96)
... 1 more
该应用已在设备上运行,但在 Metro Bundler 上出现错误 500。
谁能帮我解决这个异常?我在 Linux 环境下。
感谢社区!
最佳答案
您需要为您的应用创建一个包。
mkdir android/app/src/main/assets
react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle - -assets-dest android/app/src/main/res
然后你就可以在你的安卓上运行它了。
希望这对您有所帮助。
关于java - React-Native DisconnectableInputStream java异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54529678/