adb.exe: error: closed when i run the react native app - javascript

I'm a new in react native so first thing I made is to install react native by running
npm install -g react-native-cli
and after running react-native info
I get this
C:\Users\husam\WebstormProjects\calculator>react-native info
info Fetching system and libraries information...
System:
OS: Windows 10 10.0.18363
CPU: (4) x64 Intel(R) Core(TM) i3-7020U CPU # 2.30GHz
Memory: 815.06 MB / 3.92 GB
Binaries:
Node: 12.16.1 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.1 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.14.4 - C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK:
API Levels: 10, 11, 12, 13, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 7, 8, 9
Build Tools: 19.1.0, 28.0.3, 29.0.3
System Images: android-19 | Intel x86 Atom, android-29 | Google Play Intel x86 Atom
Android NDK: Not Found
IDEs:
Android Studio: Version 3.6.0.0 AI-192.7142.36.36.6308749
Languages:
Java: 1.8.0_231
Python: 3.7.6
npmPackages:
#react-native-community/cli: Not Found
react: 16.11.0 => 16.11.0
react-native: 0.62.2 => 0.62.2
npmGlobalPackages:
*react-native*: Not Found
after that I create a new project with webstorm from here
[https://www.jetbrains.com/help/webstorm/react-native.html
]
after that I launch the emulator with 19 API level
and then I run the App.js file and I get this
"C:\Program Files\nodejs\node.exe" C:\Users\husam\AppData\Roaming\npm\node_modules\react-native-cli run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 960 file(s) to forward-jetify. Using 4 workers...
info JS server already running.
info Installing the app...
> Task :app:generatePackageList
> Task :app:preBuild
> Task :app:preDebugBuild
> Task :app:compileDebugAidl NO-SOURCE
> Task :app:checkDebugManifest UP-TO-DATE
> Task :app:compileDebugRenderscript NO-SOURCE
> Task :app:generateDebugBuildConfig UP-TO-DATE
> Task :app:javaPreCompileDebug UP-TO-DATE
> Task :app:mainApkListPersistenceDebug UP-TO-DATE
> Task :app:bundleDebugJsAndAssets SKIPPED
> Task :app:generateDebugResValues UP-TO-DATE
> Task :app:generateDebugResources UP-TO-DATE
> Task :app:mergeDebugResources UP-TO-DATE
> Task :app:createDebugCompatibleScreenManifests UP-TO-DATE
> Task :app:processDebugManifest UP-TO-DATE
> Task :app:processDebugResources UP-TO-DATE
> Task :app:compileDebugJavaWithJavac UP-TO-DATE
> Task :app:mergeDebugShaders UP-TO-DATE
> Task :app:compileDebugShaders UP-TO-DATE
> Task :app:generateDebugAssets UP-TO-DATE
> Task :app:mergeDebugAssets UP-TO-DATE
> Task :app:copyDebugBundledJs SKIPPED
> Task :app:processDebugJavaRes NO-SOURCE
> Task :app:mergeDebugJavaResource UP-TO-DATE
> Task :app:checkDebugDuplicateClasses UP-TO-DATE
> Task :app:desugarDebugFileDependencies UP-TO-DATE
> Task :app:transformClassesWithDexBuilderForDebug UP-TO-DATE
> Task :app:validateSigningDebug UP-TO-DATE
> Task :app:signingConfigWriterDebug UP-TO-DATE
> Task :app:mergeExtDexDebug UP-TO-DATE
> Task :app:mergeDexDebug UP-TO-DATE
> Task :app:mergeDebugJniLibFolders UP-TO-DATE
> Task :app:mergeDebugNativeLibs UP-TO-DATE
> Task :app:stripDebugDebugSymbols UP-TO-DATE
> Task :app:packageDebug UP-TO-DATE
> Task :app:installDebug
10:21:40 V/ddms: execute: running am get-config
10:21:45 V/ddms: execute 'am get-config' on 'emulator-5554' : EOF hit. Read: -1
10:21:45 V/ddms: execute: returning
Installing APK 'app-debug.apk' on 'MY_phone(AVD) - 4.4.2' for app:debug
10:21:45 D/app-debug.apk: Uploading app-debug.apk onto device 'emulator-5554'
10:21:45 D/Device: Uploading file onto device 'emulator-5554'
10:21:45 D/ddms: Reading file permision of C:\Users\husam\WebstormProjects\calculator\android\app\build\outputs\apk\debug\app-debug.apk as: rwx------
10:21:49 V/ddms: execute: running pm install -r -t "/data/local/tmp/app-debug.apk"
10:22:25 V/ddms: execute 'pm install -r -t "/data/local/tmp/app-debug.apk"' on 'emulator-5554' : EOF hit. Read: -1
10:22:25 V/ddms: execute: returning
10:22:25 V/ddms: execute: running rm "/data/local/tmp/app-debug.apk"
10:22:26 V/ddms: execute 'rm "/data/local/tmp/app-debug.apk"' on 'emulator-5554' : EOF hit. Read: -1
10:22:26 V/ddms: execute: returning
Installed on 1 device.
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.0.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 4m 49s
27 actionable tasks: 2 executed, 25 up-to-date
info Connecting to the development server...
adb.exe: error: closed
info Starting the app on "emulator-5554"...
warn Failed to connect to development server using "adb reverse": Command failed: C:\Users\husam\AppData\Local\Android\Sdk/platform-tools/adb -s emulator-5554 reverse tcp:8081 tcp:8081
WARNING: linker: libdvm.so has text relocations. This is wasting memory and is a security risk. Please fix.
Starting: Intent { cmp=com.calculator/.MainActivity }
the error as showing in the log Is about the adb but I can use the adb command to install and get logcat in both the emulator and the real devices without any error
after searching on the internet I tried to run this two commands
adb reconnect
adb reverse tcp:8081 tcp:8081
but I get the same error as following
C:\Users\husam\WebstormProjects\calculator>adb reconnect
reconnecting 4203605bb24a3200 [device]
C:\Users\husam\WebstormProjects\calculator>adb reverse tcp:8081 tcp:8081
adb.exe: error: closed
the code that I run is the default one that is created by react native
also the app is installed successfully on my emulator but when I run it I get
an error tells me the app will stop
also I noted when I launch the emulator it's gives me this error

In React-Native documentation, it is mentioned that it is better to remove react-native-cli because it is causing some issues.
I had the same problem, and it is solved when I changed the API of the emulator from 19 to 29. So, the problem is the API version.
But Also make sure that you run >npm install.
Also, I used genymotion for the emulator, I suggest that you use it, and open the emulator. and open two terminals, in the first one type >react-native start
and in another terminal type >npx react-native run-android. Moreover, make sure that you don't have any problem with the port.
Hope this helps.

Related

How to Install React- Naitve project after uninstalling it from physical device

I have recently uninstalled the react native project to rebuild the project in the physical device.
Installing APK 'app-debug.apk' on 'ZenFone Max Pro M1 - 10' for app:debug
Installed on 1 device.
BUILD SUCCESSFUL in 26s
167 actionable tasks: 2 executed, 165 up-to-date
info Connecting to the development server...
info Starting the app on "C4ATAS000000"...
but it would not initialize the project. after showing this error.
Starting: Intent { cmp=com.newproject/.MainActivity }
Error type 3
Error: Activity class {com.newproject/com.newproject.MainActivity} does not exist.
Done in 37.23s.
What should i do to install it again in the physical device.
My Gratefulness in advance
This is a common error that occurs sometimes, Have a try with the below commands which might help you
Uninstall the old app
open project and then open terminal
cd android
./gradlew clean
cd ..
npx react-native run-android

React Native, why react-native run-android not working?

I'm trying to run react native run-android after I update my project file, but whenever I run react-native it throws an error. When I created that project and that command it worked fine but when I edit and add some files like apps/redux, apps/components, screens etc it stopped working. Can anyone tell me why it's not working?
error Failed to launch emulator. Reason: Could not start emulator within 30 seconds..
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
info Installing the app...
> Task :app:compileDebugJavaWithJavac
> Task :app:stripDebugDebugSymbols UP-TO-DATE
Compatible side by side NDK version was not found.
> 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.3/userguide/command_line_interface.html#sec:command_line_warnings
27 actionable tasks: 6 executed, 21 up-to-date
Note: C:\Users\Danger World\ReactProject\android\app\src\debug\java\com\reactproject\ReactNativeFlipper.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: No connected devices!
* 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 11s
error Failed to install the app. Make sure you have an Android emulator running or a device connected. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
Note: C:\Users\Danger World\ReactProject\android\app\src\debug\java\com\reactproject\ReactNativeFlipper.java uses or overrides a deprecated API.
you either need to create a virtual device or connect a physical device with USB debuging enabled (https://developer.android.com/studio/debug/dev-options).
To create a virtual device, open android studio and select AVD manager from Configure menu and create a new virtual device downloading required packages.
In case you are using a virtual device with Android studio then try to manually run the emulator BEFORE react-native run-android.
(open android studio > Tools > AVD Manager > Create Virtual Device)
https://developer.android.com/studio/run/managing-avds#createavd
Or repeat the official installation guide:
https://reactnative.dev/docs/environment-setup

How can I delete Android Studio project located in ionic project?

I have an ionic project, and for now the unique platform that i am built for is android, all features in project were working fine, previously when i export to APK this project, also works perfectly, the project in that time already had an android studio project linked in, but despite this everything worked fine.
Recently, looking in a page I saw that a project of ionic can be easily imported in android studio clicking on "Import project (Gradle, Eclipse, ADT, etc.)", so I clicked on that option and looked for my .gradle file.
Once I found it, I opened this in Android Studio, some message was displayed importing the project, something like "This version of gradle seems to be older, we recommend to update gradle, click here to update gradle", so i clicked in, but doesn't install successfully, for other errors...
As I didn't know what to do, I simply closed Android Studio, and tried to build APK once again but from the CMD, my APK was successfully built.
But now when I install the APK, run the APK and try to use the functionality of 2 plugins, one plugin simple doesn't works, but don't close me the application (imagePicker).
In case of the other plugin (googleMaps), when i try to change to the page where i using googleMaps, the app will simple got closed.
(I think was android studio gradle opened and attempted to upgrade and this break the plugins functionality).
Other thing that was changed is that previously when i run command:
ionic cordova build android -c
the output APK looks like:
app-debug.apk
now when i run this command the name is something like:
android-debug.apk
This thing means that I will never be able to run command:
ionic cordova run android
because the installation apk name that is recognized for the command is app-debug, not android-debug.
This is the output, but if i try to remove android platform and add it again, an error happens if y try to run:
ionic cordova build android -c
this is the output that i'm getting using android 6.4.0:
cordova-android-support-gradle-release: Android platform: V6
cordova-android-support-gradle-release: Wrote custom version '27.+' to C:\xampp\htdocs\MyQuestApp\myquestapp\platforms\android\build.gradle
cordova-android-support-gradle-release: Wrote custom version '27.+' to C:\xampp\htdocs\MyQuestApp\myquestapp\platforms\android\cordova-android-support-gradle-release\starter-cordova-android-support-gradle-release.gradle
cordova-android-support-gradle-release: Android platform: V6
cordova-android-support-gradle-release: Wrote custom version '27.+' to C:\xampp\htdocs\MyQuestApp\myquestapp\platforms\android\build.gradle
cordova-android-support-gradle-release: Wrote custom version '27.+' to C:\xampp\htdocs\MyQuestApp\myquestapp\platforms\android\cordova-android-support-gradle-release\starter-cordova-android-support-gradle-release.gradle
ANDROID_HOME=C:\Users\angela\AppData\Local\Android\Sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_221
Subproject Path: CordovaLib
Starting a Gradle Daemon (subsequent builds will be faster)
+-----------------------------------------------------------------
| cordova-android-support-gradle-release: 27.+
+-----------------------------------------------------------------
Configuration 'compile' in project ':' is deprecated. Use 'implementation' instead.
config.xml
../config.xml
../../config.xml
preference = 10
name = ScrollEnabled, value = false
name = android-minSdkVersion, value = 19
name = BackupWebStorage, value = none
name = SplashMaintainAspectRatio, value = true
name = FadeSplashScreenDuration, value = 300
name = SplashShowOnlyFirstTime, value = false
name = SplashScreen, value = screen
name = SplashScreenDelay, value = 3000
name = AndroidPersistentFileLocation, value = Compatibility
name = GOOGLE_MAPS_ANDROID_API_KEY, value = AIzaSyAP7l8T_EYdETsJfpwtotTE5iDCoMebJlY
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
at build_1v9usha2n179nr38j15ea2rs.run(C:\xampp\htdocs\MyQuestApp\myquestapp\platforms\android\build.gradle:146)
publishNonDefault is deprecated and has no effect anymore. All variants are now published.
:preBuild UP-TO-DATE
:CordovaLib:preBuild UP-TO-DATE
:CordovaLib:preDebugBuild UP-TO-DATE
:CordovaLib:checkDebugManifest UP-TO-DATE
:CordovaLib:processDebugManifest UP-TO-DATE
:preDebugBuild UP-TO-DATE
:CordovaLib:compileDebugAidl UP-TO-DATE
:compileDebugAidl UP-TO-DATE
:CordovaLib:packageDebugRenderscript NO-SOURCE
:compileDebugRenderscript UP-TO-DATE
:checkDebugManifest UP-TO-DATE
:generateDebugBuildConfig UP-TO-DATE
:prepareLintJar UP-TO-DATE
:generateDebugResValues UP-TO-DATE
:generateDebugResources UP-TO-DATE
:CordovaLib:compileDebugRenderscript UP-TO-DATE
:CordovaLib:generateDebugResValues UP-TO-DATE
:CordovaLib:generateDebugResources UP-TO-DATE
:CordovaLib:packageDebugResources UP-TO-DATE
:mergeDebugResources UP-TO-DATE
:createDebugCompatibleScreenManifests UP-TO-DATE
:processDebugManifest UP-TO-DATE
:splitsDiscoveryTaskDebug UP-TO-DATE
:CordovaLib:platformAttrExtractor UP-TO-DATE
:CordovaLib:processDebugResources UP-TO-DATE
:processDebugResources UP-TO-DATE
:generateDebugSources UP-TO-DATE
:CordovaLib:generateDebugBuildConfig UP-TO-DATE
:CordovaLib:prepareLintJar UP-TO-DATE
:CordovaLib:generateDebugSources UP-TO-DATE
:CordovaLib:javaPreCompileDebug UP-TO-DATE
:CordovaLib:compileDebugJavaWithJavac UP-TO-DATE
:CordovaLib:processDebugJavaRes NO-SOURCE
:CordovaLib:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug UP-TO-DATE
:javaPreCompileDebug UP-TO-DATE
:compileDebugJavaWithJavac UP-TO-DATE
:compileDebugNdk NO-SOURCE
:compileDebugSources UP-TO-DATE
:mergeDebugShaders UP-TO-DATE
:compileDebugShaders UP-TO-DATE
:generateDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugShaders UP-TO-DATE
:CordovaLib:compileDebugShaders UP-TO-DATE
:CordovaLib:generateDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugAssets UP-TO-DATE
:mergeDebugAssets UP-TO-DATE
:transformClassesWithDexBuilderForDebug UP-TO-DATE
:transformDexArchiveWithExternalLibsDexMergerForDebug UP-TO-DATE
:transformDexArchiveWithDexMergerForDebug UP-TO-DATE
:mergeDebugJniLibFolders UP-TO-DATE
:CordovaLib:compileDebugNdk NO-SOURCE
:CordovaLib:mergeDebugJniLibFolders UP-TO-DATE
:CordovaLib:transformNativeLibsWithMergeJniLibsForDebug UP-TO-DATE
:CordovaLib:transformNativeLibsWithIntermediateJniLibsForDebug UP-TO-DATE
:transformNativeLibsWithMergeJniLibsForDebug UP-TO-DATE
:processDebugJavaRes NO-SOURCE
:transformResourcesWithMergeJavaResForDebug UP-TO-DATE
:validateSigningDebug
:packageDebug UP-TO-DATE
:assembleDebug UP-TO-DATE
:cdvBuildDebug UP-TO-DATE
BUILD SUCCESSFUL in 2m 50s
44 actionable tasks: 1 executed, 43 up-to-date
Built the following apk(s):
C:/xampp/htdocs/MyQuestApp/myquestapp/platforms/android/build/outputs/apk/debug/android-debug.apk
But this is the different output that i'm getting if i uninstall platform android and re-add it with:
ionic cordova platform add android
Output when i run ionic cordova build android:
cordova-android-support-gradle-release: Android platform: V7+
cordova-android-support-gradle-release: Wrote custom version '27.+' to C:\xampp\htdocs\MyQuestApp\myquestapp\platforms\android\app\build.gradle
cordova-android-support-gradle-release: Wrote custom version '27.+' to C:\xampp\htdocs\MyQuestApp\myquestapp\platforms\android\cordova-android-support-gradle-release\starter-cordova-android-support-gradle-release.gradle
cordova-android-support-gradle-release: Android platform: V7+
cordova-android-support-gradle-release: Wrote custom version '27.+' to C:\xampp\htdocs\MyQuestApp\myquestapp\platforms\android\app\build.gradle
cordova-android-support-gradle-release: Wrote custom version '27.+' to C:\xampp\htdocs\MyQuestApp\myquestapp\platforms\android\cordova-android-support-gradle-release\starter-cordova-android-support-gradle-release.gradle
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=C:\Users\angela\AppData\Local\Android\Sdk (DEPRECATED)
Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details
> Task :wrapper
BUILD SUCCESSFUL in 1m 23s
1 actionable task: 1 executed
Subproject Path: CordovaLib
Subproject Path: app
Starting a Gradle Daemon (subsequent builds will be faster)
> Configure project :app
+-----------------------------------------------------------------
| cordova-android-support-gradle-release: 27.+
+-----------------------------------------------------------------
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
config.xml
../config.xml
../../config.xml
../../../config.xml
preference = 10
name = ScrollEnabled, value = false
name = android-minSdkVersion, value = 19
name = BackupWebStorage, value = none
name = SplashMaintainAspectRatio, value = true
name = FadeSplashScreenDuration, value = 300
name = SplashShowOnlyFirstTime, value = false
name = SplashScreen, value = screen
name = SplashScreenDelay, value = 3000
name = AndroidPersistentFileLocation, value = Compatibility
name = GOOGLE_MAPS_ANDROID_API_KEY, value = AIzaSyAP7l8T_EYdETsJfpwtotTE5iDCoMebJlY
> Task :app:preBuild UP-TO-DATE
> Task :CordovaLib:preBuild UP-TO-DATE
> Task :CordovaLib:preDebugBuild UP-TO-DATE
> Task :CordovaLib:checkDebugManifest
> Task :CordovaLib:processDebugManifest
> Task :app:preDebugBuild
> Task :CordovaLib:compileDebugAidl NO-SOURCE
> Task :app:compileDebugAidl NO-SOURCE
> Task :CordovaLib:packageDebugRenderscript NO-SOURCE
> Task :app:compileDebugRenderscript
> Task :app:checkDebugManifest
> Task :app:generateDebugBuildConfig
> Task :app:prepareLintJar
> Task :app:generateDebugSources
> Task :CordovaLib:compileDebugRenderscript
> Task :CordovaLib:generateDebugBuildConfig
> Task :CordovaLib:generateDebugResValues
> Task :CordovaLib:generateDebugResources
> Task :CordovaLib:packageDebugResources
> Task :CordovaLib:generateDebugRFile
> Task :CordovaLib:prepareLintJar
> Task :CordovaLib:generateDebugSources
> Task :CordovaLib:javaPreCompileDebug
Note: C:\xampp\htdocs\MyQuestApp\myquestapp\platforms\android\CordovaLib\src\org\apache\cordova\engine\SystemCookieManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
> Task :CordovaLib:compileDebugJavaWithJavac
> Task :CordovaLib:processDebugJavaRes NO-SOURCE
> Task :CordovaLib:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug
> Task :app:javaPreCompileDebug
> Task :app:mainApkListPersistenceDebug
> Task :app:generateDebugResValues
> Task :app:generateDebugResources
> Task :app:mergeDebugResources
> Task :app:createDebugCompatibleScreenManifests
> Task :app:processDebugManifest
> Task :app:processDebugResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
23 actionable tasks: 23 executed
> Android resource linking failed
C:\xampp\htdocs\MyQuestApp\myquestapp\platforms\android\app\build\intermediates\merged_manifests\debug\AndroidManifest.xml:34: AAPT: error: resource xml/network_security_config (aka io.ionic.starter:xml/network_security_config) not found.
error: failed processing manifest.
* 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 3m 5s
C:\xampp\htdocs\MyQuestApp\myquestapp\platforms\android\gradlew: Command failed with exit code 1 Error output:
Note: C:\xampp\htdocs\MyQuestApp\myquestapp\platforms\android\CordovaLib\src\org\apache\cordova\engine\SystemCookieManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> Android resource linking failed
C:\xampp\htdocs\MyQuestApp\myquestapp\platforms\android\app\build\intermediates\merged_manifests\debug\AndroidManifest.xml:34: AAPT: error: resource xml/network_security_config (aka io.ionic.starter:xml/network_security_config) not found.
error: failed processing manifest.
* 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 3m 5s
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd build android exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
The reason i want to delete the android studio project located in ionic project is that i think that the ionic builder is not using the ionic project configurations, ionic is using android studio project configs now to make the apk build, and i think this is the error, but i don't know about any command that 'removes' the android studio project config of an ionic project.

React Native Fails When I Try To Run on Emulator

today I just created my first React Native project but when I tried to run it on my avd just like;
react-native run-android
but it always gives this:
info JS server already running.
info Building and installing the app on the device (cd android && ./gradlew app:installDebug)...
Starting a Gradle Daemon, 1 incompatible and 2 stopped Daemons could not be reused, use --status for details
> Task :app:preBuild UP-TO-DATE
> Task :app:preDebugBuild UP-TO-DATE
> Task :app:compileDebugAidl NO-SOURCE
> Task :app:compileDebugRenderscript NO-SOURCE
> Task :app:checkDebugManifest UP-TO-DATE
> Task :app:generateDebugBuildConfig UP-TO-DATE
> Task :app:bundleDebugJsAndAssets SKIPPED
> Task :app:prepareLintJar UP-TO-DATE
> Task :app:generateDebugSources UP-TO-DATE
> Task :app:javaPreCompileDebug
> Task :app:mainApkListPersistenceDebug UP-TO-DATE
> Task :app:generateDebugResValues
> Task :app:generateDebugResources
> Task :app:mergeDebugResources
> Task :app:createDebugCompatibleScreenManifests UP-TO-DATE
> Task :app:processDebugManifest UP-TO-DATE
> Task :app:processDebugResources
> Task :app:compileDebugJavaWithJavac FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Could not find tools.jar. Please check that /usr/lib/jvm/java-8-openjdk/jre 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
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.1.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 26s
12 actionable tasks: 5 executed, 7 up-to-date
error 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
error Command failed: ./gradlew app:installDebug. Run CLI with --verbose flag for more details.
I don't know what should I do and I totally need your help.
Thanks for your attention.
It was a problem with system looking at the JRE folder i.e. /usr/lib/jvm/java-8-openjdk/jre. If we look in there, there is no Tools.jar, hence the error.
You can create environment variables JAVA_HOME :
Inside Variable value add your JDK in place of jdk1.8.0_11
Now edit yout PATH variable to add JAVA_HOME :
Now try to run the command again .
OR
Check this path C:\Program Files\Android\Android Studio\jre\lib if you find tools.jar there then try setting JAVA_HOME=C:\Program Files\Android\Android Studio\jre in above enviroment variable.
For Linux Users -
Edit the system Path file /etc/profile
sudo gedit /etc/profile
Add following lines in end
JAVA_HOME=/usr/lib/jvm/jdk1.7.0
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export JAVA_HOME
export JRE_HOME
export PATH
In place of jdk1.7.0 add your JDK version.
Then Log out and Log in ubuntu for setting up the paths...
Hope it works !
Hi. You need to check if JDK is properly installed and verify that you have added the environment variables JAVA_HOME & JDK_HOME.

the development server returned response error code 500 on my emulator

I am installing the react-native environment to start developing but when I run the command react-native run-android I have this error.
root#pc:~/l3/s2/DevMobMultipltm/Wakapp# `
Scanning folders for symlinks in /root/l3/s2/DevMobMultipltm/Wakapp/node_modules (166ms)
Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug)...
Incremental java compilation is an incubating feature.
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72301Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42301Library UP-TO-DATE
:app:prepareComFacebookFbuiTextlayoutbuilderTextlayoutbuilder100Library UP-TO-DATE
:app:prepareComFacebookFrescoDrawee130Library UP-TO-DATE
:app:prepareComFacebookFrescoFbcore130Library UP-TO-DATE
:app:prepareComFacebookFrescoFresco130Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipeline130Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipelineBase130Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipelineOkhttp3130Library UP-TO-DATE
:app:prepareComFacebookReactReactNative0553Library UP-TO-DATE
:app:prepareComFacebookSoloaderSoloader010Library UP-TO-DATE
:app:prepareOrgWebkitAndroidJscR174650Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:mergeDebugShaders UP-TO-DATE
:app:compileDebugShaders UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:bundleDebugJsAndAssets SKIPPED
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:incrementalDebugJavaCompilationSafeguard UP-TO-DATE
:app:compileDebugJavaWithJavac UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources UP-TO-DATE
:app:transformClassesWithDexForDebug UP-TO-DATE
:app:mergeDebugJniLibFolders UP-TO-DATE
:app:transformNative_libsWithMergeJniLibsForDebug UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
:app:transformResourcesWithMergeJavaResForDebug UP-TO-DATE
:app:validateSigningDebug
:app:packageDebug UP-TO-DATE
:app:assembleDebug UP-TO-DATE
:app:installDebug
01:20:32 E/adb: adb server version (36) doesn't match this client (39); killing...
01:20:35 E/adb: * daemon started successfully
Installing APK 'app-debug.apk' on 'Phone(AVD) - 6.0' for app:debug
Installed on 1 device.
BUILD SUCCESSFUL
Total time: 1 mins 12.012 secs
This build could be faster, please consider using the Gradle Daemon: https://docs.gradle.org/2.14.1/userguide/gradle_daemon.html
Running adb -s emulator-5554 reverse tcp:8081 tcp:8081
Starting the app on emulator-5554 (adb -s emulator-5554 shell am start -n com.wakapp/com.wakapp.MainActivity)...
Starting: Intent { cmp=com.wakapp/.MainActivity }
I think that is at the level of
:app:bundleDebugJsAndAssets SKIPPED
the mistake
On my emulator :
the development server returned response error code 500
someone to help me
Thank you in advance !!
NB: I am on Linux.
What stands out from the error message is the following line:
adb server version (36) doesn't match this client (39); killing...
Your issue seems like a duplicate of ADB server version (36) doesn't match this client (39) and adb server version doesn't match this client

Categories