反应本地java.lang.RuntimeException:没有服务器可以处理请求

时间:2018-10-22 18:09:22

标签: java react-native gradle

我刚开始使用本机响应,并且在构建应用程序时遇到了一些问题。

这是错误: (完整日志)

Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug)...
AAPT err(Facade for 33021040): /home/srijan/Android/build-tools/27.0.3/aapt2: 1: /home/srijan/Android/build-tools/27.0.3/aapt2: Syntax error: "(" unexpected
Slave 33021040 failed to start
java.lang.RuntimeException: AAPT slave failed to start. Please make sure the current build tools (located at /home/srijan/Android/build-tools/27.0.3/aapt2) are not corrupted.
    at com.android.builder.png.AaptProcess.waitForReadyOrFail(AaptProcess.java:193)
    at com.android.builder.internal.aapt.AaptQueueThreadContext.creation(AaptQueueThreadContext.java:56)
    at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:250)
    at java.lang.Thread.run(Thread.java:748)
AAPT err(Facade for 26937763): /home/srijan/Android/build-tools/27.0.3/aapt2: 1: /home/srijan/Android/build-tools/27.0.3/aapt2: Syntax error: "(" unexpected
Slave 26937763 failed to start
java.lang.RuntimeException: AAPT slave failed to start. Please make sure the current build tools (located at /home/srijan/Android/build-tools/27.0.3/aapt2) are not corrupted.
    at com.android.builder.png.AaptProcess.waitForReadyOrFail(AaptProcess.java:193)
    at com.android.builder.internal.aapt.AaptQueueThreadContext.creation(AaptQueueThreadContext.java:56)
    at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:250)
    at java.lang.Thread.run(Thread.java:748)
Exception in thread "queued-resource-processor_2"     java.util.MissingFormatArgumentException: Format specifier '%1$s'
    at java.util.Formatter.format(Formatter.java:2525)
    at java.util.Formatter.format(Formatter.java:2455)
    at java.lang.String.format(String.java:2940)
    at com.android.build.gradle.internal.aapt.AaptGradleFactory$FilteringLogger.shouldDowngrade(AaptGradleFactory.java:156)
    at com.android.build.gradle.internal.aapt.AaptGradleFactory$FilteringLogger.error(AaptGradleFactory.java:122)
    at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:253)
    at java.lang.Thread.run(Thread.java:748)
Exception in thread "queued-resource-processor_1"  

java.util.MissingFormatArgumentException: Format specifier '%1$s'
    at java.util.Formatter.format(Formatter.java:2525)
    at java.util.Formatter.format(Formatter.java:2455)
    at java.lang.String.format(String.java:2940)
    at com.android.build.gradle.internal.aapt.AaptGradleFactory$FilteringLogger.shouldDowngrade(AaptGradleFactory.java:156)
    at com.android.build.gradle.internal.aapt.AaptGradleFactory$FilteringLogger.error(AaptGradleFactory.java:122)
    at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:253)
    at java.lang.Thread.run(Thread.java:748)

> Task :app:mergeDebugResources FAILED
Error: java.util.concurrent.ExecutionException: java.lang.RuntimeException: No server to serve request. Check logs for details.


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Error: java.util.concurrent.ExecutionException: java.lang.RuntimeException: No server to serve request. Check logs for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 4s
9 actionable tasks: 1 executed, 8 up-to-date
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/getting-started.html

这是错误 请帮助我解决此问题。

我也尝试过,使用sdkmanager cli重新下载构建工具27.0.3。

2 个答案:

答案 0 :(得分:1)

您正在尝试在32位linux上运行这些工具,但不支持该工具。受支持的系统是Windows(32位和64位),Mac OS 64位和Linux 64位。

有关Android Studio页面的更多信息,请访问https://developer.android.com/studio/#downloads

答案 1 :(得分:0)

我建议使用https://expo.io,尤其是刚开始使用时。

这还将解决您的资源问题;您不需要模拟器,因为您可以通过热重装和所有不错的东西在实际的电话上进行测试。