react native java.lang.RuntimeException: No server to serve request - java

I was just getting started with react native and I encountered some problem while building the app.
Here's the error:
(Complete log)
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
So this is the error
Kindly help me troubleshoot this thing.
Also I tried, re-downloading build-tools 27.0.3 with the sdkmanager cli.

You are trying to run the tools on linux 32 bit, but it is not supported. The supported systems are Windows (both 32 and 64 bit), Mac OS 64 bit and Linux 64 bit.
Here's more info one the Android Studio's page: https://developer.android.com/studio/#downloads

I recommend using https://expo.io, especially if you're just starting out.
It would also fix your resources' problem; you don't need an emulator, as you can test on your actual phone with hot reloading and all the good stuff.

Related

65 17 I try to run react-native app on android studio emulator on my windows. When I write react-native run-android using windows terminal It get

$ npm run android
myfirstproject#0.0.1 android
react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 936 file(s) to forward-jetify. Using 8 workers...
info JS server already running.
info Installing the app...
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring project ':react-native-gradle-plugin'.
java.util.concurrent.ExecutionException: java.lang.IllegalStateException: Unexpected lock protocol found in lock file. Expected 1, found 0.
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 1m 25s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring project ':react-native-gradle-plugin'.
java.util.concurrent.ExecutionException: java.lang.IllegalStateException: Unexpected lock protocol found in lock file. Expected 1, found 0.
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 1m 25s
at makeError (C:\Users\computer\Desktop\PROJECTS\myfirstproject\node_modules\#react-native-community\cli-platform-android\node_modules\execa\index.js:174:9)
at C:\Users\computer\Desktop\PROJECTS\myfirstproject\node_modules\#react-native-community\cli-platform-android\node_modules\execa\index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (C:\Users\computer\Desktop\PROJECTS\myfirstproject\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
at async Command.handleAction (C:\Users\computer\Desktop\PROJECTS\myfirstproject\node_modules\#react-native-community\cli\build\index.js:192:9)
info Run CLI with --verbose flag for more details.

Error building react native app on Android

Hi I´m trying to run my react native app on android but when i build it shows me this error:
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 952 file(s) to forward-jetify. Using 8 workers...
info JS server already running.
info Installing the app...
> Task :react-native-safe-area-context:compileDebugJavaWithJavac 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.9/userguide/command_line_interface.html#sec:command_line_warnings
48 actionable tasks: 2 executed, 46 up-to-date
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-safe-area-context:compileDebugJavaWithJavac'.
> Could not find tools.jar. Please check that /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home contains a valid JDK installation.
* 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 5s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-safe-area-context:compileDebugJavaWithJavac'.
> Could not find tools.jar. Please check that /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home contains a valid JDK installation.
* 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 5s
at makeError (/Users/calebgarcia/Dev/Auth/node_modules/#react-native-community/cli-platform-android/node_modules/execa/index.js:174:9)
at /Users/calebgarcia/Dev/Auth/node_modules/#react-native-community/cli-platform-android/node_modules/execa/index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (/Users/calebgarcia/Dev/Auth/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:106:5)
at async Command.handleAction (/Users/calebgarcia/Dev/Auth/node_modules/#react-native-community/cli/build/index.js:192:9)
info Run CLI with --verbose flag for more details.
It´s a bit puzzling since when i build the app on the ios simulator it runs perfectly.
Do you guys have any idea how i can solve the issue?
Thanks.
npm install react-native-safe-area-context
Try this and build.
If not,
Please check your computer's environment variables and set JAVA_HOME if it has not already been setup.

Could not resolve all files for configuration ':app:androidJdkImage

I am trying to build flutter apk on debug mode from android studio.
Flutter run
I get this error:
Launching lib/main.dart on sdk gphone x86 arm in debug mode...
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
Could not resolve all files for configuration ':app:androidJdkImage'.
Failed to transform core-for-system-modules.jar to match attributes {artifactType=_internal_android_jdk_image, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
> Execution failed for JdkImageTransform: /Users/mac/Library/Android/sdk/platforms/android-30/core-for-system-modules.jar.
> jlink executable /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/jlink does not exist.
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 20s
Exception: Gradle task assembleDebug failed with exit code 1
I solved this issue by downloading the required NDK side by side
package as shown in this screenshot for the required SDK platform.
If you keep getting errors after doing this, please share error logs or screenshots. Thanks.
In my case, I only need update Android Studio to newer version and it's working normally again.

ionic cordova build android - daemon build error, where to find APK?

I'm dying trying to figure this out!
Essentially, I've finished up an Ionic app and am ready to publish it to the Google Play Store. The problem is that I'm having trouble following the directions posted on the Ionic Framework website.
So far, I've created an 'android' folder under 'platforms'.
Error thrown:
Android Studio project detected
ANDROID_HOME=C:\Users\fromf\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files (x86)\java\jdk1.8.0_191
studio
Subproject Path: CordovaLib
Subproject Path: app
Starting a Gradle Daemon (subsequent builds will be faster)
FAILURE: Build failed with an exception.
What went wrong:
Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the user guide chapter on the daemon at https://docs.gradle.org/4.1/userguide/gradle_daemon.html
Please read the following process output to find out more:
Error occurred during initialization of VM
Could not reserve enough space for 2097152KB object heap
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Get more help at https://help.gradle.org
(node:43720) UnhandledPromiseRejectionWarning: Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
My various attempts:
Firstly, that I cannot seem to find the 'build' folder referenced at 'platforms/android/build/outputs/apk'. It simply does not exist.
Having recognised that I'm lacking the 'build' folder, I attempted to change the environment variables according to this website: http://www.tiagoporto.com/blog/environment-setting-tutorial-ionic-android-on-windows/. This did not work.
I followed the directions given on various SoF Q&As, and manually downloaded the needed gradle, called "gradle-2.2.1-all.zip". Still did not work.
I am at my wits ends. Please please please help!

Error:Execution failed for task ':app:mergeDebugResources'. > Error: java.util.concurrent.ExecutionException: java.lang.RuntimeException:

Above error along with these errors and cannot resolve R symbol error.
Error:java.util.concurrent.ExecutionException: java.lang.RuntimeException: No server to serve request.
Check logs for details.
Error:Execution failed for task ':app:mergeDebugResources'.
Error: java.util.concurrent.ExecutionException: java.lang.RuntimeException: No server to serve request.
Check logs for details.
I tried all solutions given like rebuild,invalidate caches and restart, changed dependencies as well and clean project did not used any images. I installed android studio 3.0.1 in ubuntu 14.04 OS type 32-bit
Is this a installed android stdio version mistake please help me out.

Categories

Resources