Getting issues with ADB for react-native run-android - java

I've been trying to follow the react-native tutorial on udemy, but I've been having trouble getting started: When I try to run the react-native run-android, I've been getting this error:
app:installDebug FAILEDnstallDebug
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: Could not create ADB Bridge.
ADB location: C:\Users\(USERNAME)\AppData\Local\Android\Sdk\platform-tools\adb.exe
I've been using the latest android studio client; I have been using an emulator to simulate a Google Nexus 5, and using the java version that is compatible for the project (the latest, 9.0.9, has been causing problems). I have no familiarity with Genymotion, as it has not been mentioned in the class or is said to be a necessary application; any solutions involving this has not been of any use so far.
Thanks for reading.

Related

React native gradle build failed

I cloned a react-native project from github and below are the steps that I followed in order to make it work on my local ubuntu 20.04 machine:
(The project was expo managed earlier, but now it is ejected because there are android and ios folders)
created my local feature branch -> git checkout -b feature
installed all the packages in package.json -> yarn install
ran npx react-native run-android to run the app on android emulator
1st Encountered error:-
Could not write standard input to Gradle build daemon.
java.io.IOException: Stream closed
* 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 read the following process output to find out more:
-----------------------
Unrecognized VM option 'MaxPermSize=512m'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
In order to solve this issue, I used this https://stackoverflow.com/a/69630720/11685381 answer and removed -XX:MaxPermSize=512m from my gradle.properties
2nd Encountered error:-
Again used npx react-native run-android and ran into another build error:-
* What went wrong:
Could not open settings generic class cache for settings file '/home/user/project/android/settings.gradle' (/home/user/.gradle/caches/6.9/scripts/5bii70nilhgbvb8zyo7v963b7).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 61
To fix this, I used this solution: https://www.codegrepper.com/code-examples/whatever/BUG!+exception+in+phase+'semantic+analysis'+in+source+unit+'_BuildScript_'+Unsupported+class+file+major+version+61
3rd Encountered error:-
Again ran npx react-native run-android and ran into these 2 build error this time:
1: Task failed with an exception.
-----------
* Where:
Build file '/home/user/project/node_modules/expo-gl-cpp/android/build.gradle' line: 307
* What went wrong:
Default side-by-side NDK installation is not found.
Set $ANDROID_NDK_HOME environment variable correctly or setup ndk.dir in local.properties.
> NDK is not installed
2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':expo'.
> compileSdkVersion is not specified. Please add it to build.gradle
To solve the 1st issue i.e. NDK is not installed (it is installed though), I created a local.properties inside project/android directory and pasted the following path:
sdk.dir=/home/user/Android/Sdk
ndk.dir=/home/user/Android/Sdk/ndk/24.0.8215888
4th Encountered error:-
> Task :app:generatePackageList FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
* Where:
Script '/home/user/project/node_modules/#react-native-community/cli-platform-android/native_modules.gradle' line: 131
* What went wrong:
Execution failed for task ':app:generatePackageList'.
> argument type mismatch
To solve this, I tried this solution: https://stackoverflow.com/a/68180959/11685381 but this again downloaded the gradle 6.9 which I had earlier also, and again to the 2nd Encountered error
I've been doing this since 2 days, can someone please help me out here what am I doing wrong?
Try updating build.grade from
classpath("com.android.tools.build:gradle:3.5.3")
To
classpath("com.android.tools.build:gradle:3.5.4")
It's just an example. try to update Gradle.

Unknown error in android studio while installing the debug apk

I'm a beginner in Android studio, and I beg pardon for and writing errors. While trying an ecommerce app to install, I'm getting this error, however I tried searching web for the same, yet could not find it. Can you please help me what this error is about? Earlier this project used Session manager to authenticate, I tried to use Firebase when I faced this issue. Please post any related link.
10/01 13:04:25: Launching 'app' on Micromax Micromax Q391.
Installation did not succeed.
The application could not be installed.
List of apks: [0]
'D:\SearchLocally\SerchLocally\app\build\outputs\apk\debug\app-debug.apk'
Installation failed due to: ''pm install-create -r -t -S 9779378'
returns error 'Unknown failure: java.lang.UnsatisfiedLinkError: No
implementation found for java.lang.String
android.os.SystemProperties.native_get(java.lang.String) (tried
Java_android_os_SystemProperties_native_1get and
Java_android_os_SystemProperties_native_1get__Ljava_lang_String_2) at
android.os.SystemProperties.native_get(Native Method) at
android.os.SystemProperties.get(SystemProperties.java:52) at
android.os.Environment.getCanonicalPathOrNull(Environment.java:832) at
android.os.Environment.(Environment.java:78) at
android.os.Environment.getLegacyExternalStorageDirectory(Environment.java:419)
at android.os.Debug.(Debug.java:96) at
android.ddm.DdmHandleHello.handleHELO(DdmHandleHello.java:164) at
android.ddm.DdmHandleHello.handleChunk(DdmHandleHello.java:91) at
org.apache.harmony.dalvik.ddmc.DdmServer.dispatch(DdmServer.java:171)
java.lang.UnsatisfiedLinkError: android.os.Debug at
android.ddm.DdmHandleHello.handleFEAT(DdmHandleHello.java:176) at
android.ddm.DdmHandleHello.handleChunk(DdmHandleHello.java:93) at
org.apache.harmony.dalvik.ddmc.DdmServer.dispatch(DdmServer.java:171)
java.lang.UnsatisfiedLinkError: android.os.Debug at
android.ddm.DdmHandleProfiling.handleMPRQ(DdmHandleProfiling.java:187)
at
android.ddm.DdmHandleProfiling.handleChunk(DdmHandleProfiling.java:88)
at
org.apache.harmony.dalvik.ddmc.DdmServer.dispatch(DdmServer.java:171)''
Retry
Disabling MIUI optimization from developed options will work:
Settings - Developer options - MIUI optimization
Disable it and it will ask to reboot the device, after that the app can be installed

React Native Splash Screen Issue - after modifying xml files in android folder

I would like to create a splash screen in my React Native app (not Expo) using Android Studio's emulator.
I was trying to add a splash_screen.xml file into android/app/src/main/res/drawable folder. When I put a new .xml file into the android folder the React compiler shows the following error message:
iMac:newtest Dora$ react-native run-android
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...
Configure project :app
WARNING: The specified Android SDK Build Tools version (28.0.2) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.2.1.
Android SDK Build Tools 28.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '28.0.2'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
Task :app:mergeDebugResources FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:mergeDebugResources'.
com.android.build.gradle.tasks.ResourceException (no error message)
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 2s
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
Command failed: ./gradlew installDebug
Error: Command failed: ./gradlew installDebug
at checkExecSyncError (child_process.js:637:11)
at Object.execFileSync (child_process.js:655:13)
at runOnAllDevices (/Users/Dora/Documents/code/react native/newtest/node_modules/react-native/local-cli/runAndroid/runAndroid.js:299:19)
at buildAndRun (/Users/Dora/Documents/code/react native/newtest/node_modules/react-native/local-cli/runAndroid/runAndroid.js:135:12)
at isPackagerRunning.then.result (/Users/Dora/Documents/code/react native/newtest/node_modules/react-native/local-cli/runAndroid/runAndroid.js:65:12)
at processTicksAndRejections (internal/process/next_tick.js:81:5)
Thank you for taking your time to help me to solve this issue!
Cheers,
Alex
Well, finally I have managed to solve this issue. It is for those who will encounter this problem during Android development.
So, what i did exactly:
1. cd into android folder and run this: ./gradlew installDebug
After this command finished without any errors
go back to the root directory and start the app using: react-native run-android
Conclusion, if you add or change any xml files in android folder, you have to do the above procedure.
That's all!
Alex

Task :react-native-workers:compileDebugJavaWithJavac FAILED

I am trying to run a react-native android application using react-native-cli, whenever I try to run the application using react-native run-android I am getting following error,
Task :react-native-workers:compileDebugJavaWithJavac FAILED
is this related to Gralde or react-native?

Android app with Oracle MAF, build.xml not found

I'm currently developing an Android (API 21) app on Eclipse OEPE (Mars) using a 64-bit Win7. The SDK was downloaded and installed by Android Studio (with all the platform-tools and build-tools). I have had no trouble writing the app, but as soon as I try to debug it as described here (Step 6), I get the following error:
BUILD FAILED
{WorkspacePath}\HelloWorld\.main.android.1\bin\build.xml:3: The following error occurred while executing this line:
{WorkspacePath}\HelloWorld\.main.android.1\bin\build-set-globals.xml:67: Cannot find C:\AndroidSdk\tools\ant\build.xml imported from {WorkspacePath}\HelloWorld\.main.android.1\bin\build-set-globals.xml
Total time: 895 milliseconds
(I'm the one who replaced the path to the workspace with {WorkspacePath}).
I have no idea what's going on and couldn't find anything on internet; any suggestion?
EDIT: I forgot to mention it, but the thing that is bothering me the most is that there's no "ant" folder in {SDKPath}/tools

Categories