Failed to install the app in react-native - android

Android
My application was running perfectly before and after some changes in some js files this error appeared
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException: INSTALL_FAILED_INSUFFICIENT_STORAGE
* 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 0s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
Unable to install C:\projects\Maheema\android\app\build\outputs\apk\debug\app-debug.apk

Try
Gradlew clean
In android directory of your project
And then run on device again
.

Related

Error connecting to emulator in react-native project

info JS server already running.
/bin/sh: 1: adb: not found
info Launching emulator...
error Failed to launch emulator. Reason: The emulator (Pixel_4_XL) quit before it finished opening. You can try starting the emulator manually from the terminal with: emulator #Pixel_4_XL.
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
info Installing the app...
5 actionable tasks: 5 up-to-date
FAILURE: Build failed with an exception.
What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
SDK location not found. Define a valid SDK location with an ANDROID_HOME environment variable or by setting the sdk.dir path in your project's local properties file at '/home/oem/AwesomeProject/android/local.properties'.
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
BUİLD FAILED in 7s
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:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
SDK location not found. Define a valid SDK location with an ANDROID_HOME environment variable or by setting the sdk.dir path in your project's local properties file at '/home/oem/AwesomeProject/android/local.properties'.
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
BUİLD FAILED in 7s
at makeError (/home/oem/AwesomeProject/node_modules/execa/index.js:174:9)
at /home/oem/AwesomeProject/node_modules/execa/index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async runOnAllDevices (/home/oem/AwesomeProject/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:85:5)
at async Command.handleAction (/home/oem/AwesomeProject/node_modules/react-native/node_modules/#react-native-community/cli/build/index.js:108:9)
info Run CLI with --verbose flag for more details.
I'm using linuxmint. npx can't connect to emulator in react-native run-android code, what's the problem?

Cannot build flutter applications on other locations than disc C

Flutter app successfully runs on local disc C but if I create the app on any other location and run the app the following error shows.
The app successfully runs only if I create the app on Local Disc C. I created the app on disk D and tried to run the app on an emulator but the build failed and the following error showed.
Launching lib\main.dart on sdk gphone x86 arm in debug mode...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
> java.io.FileNotFoundException: F:\Educational\practicals\Flutter\socio_app\build\app\intermediates\manifest_merge_blame_file\debug\manifest-merger-blame-debug-report.txt (Access is denied)
* 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 44s
[!] Gradle threw an error while downloading artifacts from the network. Retrying to download...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
> java.io.FileNotFoundException: F:\Educational\practicals\Flutter\socio_app\build\app\intermediates\manifest_merge_blame_file\debug\manifest-merger-blame-debug-report.txt (Access is denied)
* 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 7s
[!] Gradle threw an error while downloading artifacts from the network. Retrying to download...
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)

React Native project can't be open with android emulator

I'm a newbie to react native. I started a new project and followed all the steps. I had Android Studio before and I started the emulator with it. After running npx react-native run-android command I get this error.
**FAILURE: Build failed with an exception.
* What went wrong:
Task 'installDebug' not found in project ':app'.
* Try:
Run gradlew tasks to get a list of available tasks. 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 34s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* What went wrong:
Task 'installDebug' not found in project ':app'.
* Try:
Run gradlew tasks to get a list of available tasks. 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 34s**
Then I ran abd -d command and I get this.
Android Debug Bridge version 1.0.41
Version 29.0.6-6198805
Installed as C:\Users\User\AppData\Local\Android\Sdk\platform-tools\adb.exe
Can you please help me with this?
As said here, you can try running the following command on the root folder of your project:
cd android && ./gradlew installDevDebug && cd .. && react-native run-android --variant=DevDebug
After this your project should run on your Android sucessfully.
If not, open your project with android studio one time, and then recompile with react-native run-android
If even after this all your project doesnt work, make sure you already have the ANDROID_HOME variable on your PATH variables

Build failed with an exception java.io.IOException: Permission denied

I'm trying to get a React Native project to run on my Linux Mint PC but I'm struggling to do so as I'm getting the following error message:
yarn android
yarn run v1.21.1
$ react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 977 file(s) to forward-jetify. Using 4 workers...
info Starting JS server...
/bin/sh: 1: /user/local/Android/Sdk/platform-tools/adb: not found
info Launching emulator...
error Failed to launch emulator. Reason: No emulators found as an output of `emulator -list-avds`.
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
info Installing the app...
FAILURE: Build failed with an exception.
* Wh
at went wrong:
java.io.IOException: Permission denied
* 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
error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* What went wrong:
java.io.IOException: Permission denied
* 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
at checkExecSyncError (child_process.js:603:11)
at execFileSync (child_process.js:621:15)
at runOnAllDevices (/home/guilherme/Workspace/soccerama/soccerama-mobile-rn/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:39)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 977 file(s) to forward-jetify. Using 4 workers...
info Starting JS server...
info Installing the app...
FAILURE: Build failed with an exception.
* What went wrong:
java.io.IOException: Permission denied
* 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
error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* What went wrong:
java.io.IOException: Permission denied
* 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
at checkExecSyncError (child_process.js:603:11)
at execFileSync (child_process.js:621:15)
at runOnAllDevices (/home/guilherme/Workspace/soccerama/soccerama-mobile-rn/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:39)
at buildAndRun (/home/guilherme/Workspace/soccerama/soccerama-mobile-rn/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/index.js:158:41)
at /home/guilherme/Workspace/soccerama/soccerama-mobile-rn/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/index.js:125:12
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async Command.handleAction (/home/guilherme/Workspace/soccerama/soccerama-mobile-rn/node_modules/#react-native-community/cli/build/index.js:164:9)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
As far as I know It's something related to the gradle's permissions and I've tried the following:
chown -R username ./android/gradlew
chmod 777 -R ./android
chmod +x ./android/gradlew
But none of these seems to solve my problem. I'd appreciate if someone could help me out here.
try this:
1 - build the gradle. if no issue, proceed on access the android folder of your app. i.e c:\folder\app\android
2 - type in ./gradlew clean
3 - run react-native run-android

react-native run-android fails with error

i'm getting the following errors in my console.
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
What went wrong:
Execution failed for task ':react-native-video:compileDebugJavaWithJavac'.
Compilation failed; see the compiler error output 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.
2: Task failed with an exception.
What went wrong:
Execution failed for task ':react-native-firebase:compileDebugJavaWithJavac'.
Compilation failed; see the compiler error output 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
Deprecated Gradle features were used in this build, making it
incompatible with Gradle 5.0. Use '--warning-mode all' to show the
individual deprecation warnings. See
https://docs.gradle.org/4.10.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 10s 151 actionable tasks: 13 executed, 138 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.
Is your android device is connected. Check it with
adb devices
If no device name shows then, no device is connected, try to connect your device correctly and run
react-native run-android
and in different terminal run
npm start

Categories

Resources