I am working on MAC, trying to run React Native on android but it throws this error: Task :app:installDebug FAILED. This is the full error:
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.5/userguide/command_line_interface.html#sec:command_line_warnings
27 actionable tasks: 2 executed, 25 up-to-date
FAILURE: Build failed with an exception.
* What went wrong:
A problem was found with the configuration of task ':app:installDebug'.
> File '/Users/vinaysharma/Library/Android/sdk/platform-tools/adb' specified for property 'adbExe' does not exist.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8088
FAILURE: Build failed with an exception.
* What went wrong:
A problem was found with the configuration of task ':app:installDebug'.
> File '/Users/vinaysharma/Library/Android/sdk/platform-tools/adb' specified for property 'adbExe' does not exist.
I've tried reinstalling Android Studio twice as well as creating a new project for RN but that didn't help me out.
I tried this as well: brew cask install android-platform-tools. Thanks.
You need to install adbExe. Please follow steps in this link
Related
I'm newbie using react-native and I've been trying to update the gradle version for a few days now..
Currently I use version 6.5, my react-native version is: 0.60.0 I need to update gradle from version 6.5 to version 7.2, but when trying to run the application using this new version of gradle I get the following error:
> Task :app:generatePackageList FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.2/userguide/command_line_interface.html#sec:command_line_warnings
82 actionable tasks: 1 executed, 81 up-to-date
FAILURE: Build failed with an exception.
* Where:
Script '/projects/xxxxxx/node_modules/#react-native-community/cli-platform-android/native_modules.gradle' line: 137
* What went wrong:
Execution failed for task ':app:generatePackageList'.
> argument type mismatch
In some places I read that possibly the react-native-community version is not compatible with the 7x version of gradle, but I'm still a little lost on the subject and I'm looking for new information.
Thanks in advance for all the help!
My app works fine when I run it or build app packages, but when I try to build apk for release or profile, it gives this message:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':background_location:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.tasks.VerifyLibraryResourcesTask$Action
> Android resource linking failed
ERROR:C:\Users\Misha\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\background_location-0.6.1\android\src\main\AndroidManifest.xml:10:9-15:37: AAPT: error: attribute android:foregroundServiceType not found.
I've already tried flutter clean and flutter pub cache repair, as well as updated my Gradle version. Also, I have AndroidX enabled.
Could somebody please help?
Update: I found a solution here
AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{}],"original":"ERROR:: AAPT: D:\android-basics-kotlin-cupcake-app-starter\app\build\intermediates\processed_res\debug\out\resources-debug.ap_: error: The system cannot find the file specified. (2).\nerror: failed to create archive.\n\n ","tool":"AAPT"}
Task :app:mergeDebugNativeLibs
Task :app:mergeExtDexDebug
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:processDebugResources'.
A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction
Android resource linking failed
ERROR:: AAPT: D:\android-basics-kotlin-cupcake-app-starter\app\build\intermediates\processed_res\debug\out\resources-debug.ap_: error: The system cannot find the file specified. (2).
error: failed to create archive.
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 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.7.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 7s
27 actionable tasks: 26 executed, 1 up-to-date
Can anyone help me to solve this problem...? please...
This is what happens when aapt fails to create an archive.
First make sure you are using the latest IDE and SDK. aapt for packaging is obsolete, and the earlier aapt2 has many bugs.
If they are up to date, try to check if the following processes on your computer have read/write access to the project directory.
[your android sdk path]\build-tools[your sdk version]\aapt.exe
[your android sdk path]\build-tools[your sdk version]\aapt2.exe
[your android studio path]\bin\studio64.exe
[your android studio path]\bin\fsnotifier64.exe
[your android studio path]\jre\bin\java.exe
[your android studio path]\jre\bin\javaw.exe
If you haven't set permissions manually, they are usually blocked by security software.
I recently ran into this problem and spent a lot of time finally found out that the security software on my workstation was not adding aapt2 and aapt to the allowed list for the project repository.
I did the following
react-native init project-name
yarn add react-navigation react-native-gesture-handler and
react-native run-android
The dependencies installed successfully but the app failed to build with the following errors
> Task :react-native-gesture-handler:packageDebugResources FAILED
17 actionable tasks: 8 executed, 9 up-to-date
> FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-gesture-handler:packageDebugResources'.
> Could not resolve all files for configuration ':react-native-gesture-handler:_
internal_aapt2_binary'.
> Failed to transform artifact 'aapt2-windows.jar (com.android.tools.build:aa
pt2:3.4.1-5326820)' to match attributes {artifactType=_internal-android-aapt2-bi
nary, org.gradle.usage=java-runtime-jars}.
> org.gradle.api.GradleException: Could not read path 'C:\Users\DevLewa\.g
radle\caches\transforms-2\files-2.1\3d408b3640f7dfba25695085d22596b0\aapt2-3.4.1
-5326820-windows'.
I have searched all through github issues but found no helping information, how do I resolve this, I have being on it since morning today.
Thanks
I had the same problem with some of my initialized projects using reac-native cli. it would be solved by running: react-native link in your project directory. I hope it would work for you as me.
If it was helpful please vote me up:)
In my android app I has many Espresso's tests.
It's locate in:
/app/src/androidTest/kotlin/com/myproject/android/folder1/
and
/app/src/androidTest/kotlin/com/myproject/android/folder2/
To run all instrumented tests I use this:
gradlew app:connectedAndroidTest
Here output:
10:44:37 V/ddms: execute: returning
> Task :common:connectedAndroidTest
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 SUCCESSFUL in 7m 43s
97 actionable tasks: 25 executed, 8 from cache, 64 up-to-date
Nice.
But I need to start test only in folder2. I use this:
gradlew app:connectedAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=com.myproject.android.activity.*
but I get error:
04:45:23 V/ddms: execute: returning
> Task :app:connectedDebugAndroidTest FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:connectedDebugAndroidTest'.
> Could not generate test report to '\app\build\reports\androidTests\connected'.
Use package instead of class in the test arguments
gradlew app:connectedAndroidTest -Pandroid.testInstrumentationRunnerArguments.package=com.myproject.android.packageName