Failed to install the app in android emulator in React Native - android

I'm trying to run my react native CLI app in an android emulator but it getting errors to install in the emulator.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource linking failed
E:\Program Files\React Native CLI\testDemo\android\CLI\testDemo\node_modules\react-native-image-crop-picker\android\build\intermediates\library_manifest\debug\AndroidManifest.xml:10:5-14:15: AAPT: error: unexpected element <queries> found in <manifest>.
And already installed this dependency react-native-image-crop-picker in react native, I have perfectly set up the environment variables which are mentioned by Facebook. And this error is showing up
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
Manifest File has no error you see it
Kindly please what should I do to resolve this issue.

Acording to here its look like known issue.Try to upgrade gradle and rebuild.
buildscript
{
...
dependencies {
// classpath 'com.android.tools.build:gradle:4.0.0'
classpath 'com.android.tools.build:gradle:4.0.1'
}
...
}

Related

React Native Drawer Navigation Reanimated Problem

I try to use drawer navigator on react native, first i have installed all necessary packages and i am using reanimated-1 but app can not be built and gives this error. If i try to use reanimated-2 everything is fine but while i am using reanimaed-1 i am getting this error.
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.
Where:
Build file 'C:\Users\fikre\Desktop\reactnative\drawerNavDemo\node_modules\react-native-reanimated\android\build.gradle' line: 64
What went wrong:
A problem occurred configuring project ':react-native-reanimated'.
Configuration with name 'compile' not found.

React Native suddenly throwing May 09 2022

I am currently working on a React Native project that has been previously worked on by other devs. it was compiling fine as before May 09 2022 then I tried to compile it now and it's now throwing
BUILD FAILED in 41s
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:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not resolve com.facebook.android:facebook-android-sdk:9.0.+.
Required by:
project :app > project :react-native-fbsdk-next
> Failed to list versions for com.facebook.android:facebook-android-sdk.
> Unable to load Maven meta-data from https://jcenter.bintray.com/com/facebook/android/facebook-android-sdk/maven-metadata.xml.
> Could not HEAD 'https://jcenter.bintray.com/com/facebook/android/facebook-android-sdk/maven-metadata.xml'.
> org.apache.http.client.ClientProtocolException (no error message)
No new packages were added, I even tried to revert to old commits just to confirm if it's package related and it still threw this error. Was there any changes or update with Maven recently? I have other devs that are on Mac and theirs seem to be compiling just fine
I am not an expert in react native, I only started using it and I also have the same issue from 9th may 2022. But I am able to fixed it.
You can follow the below steps and may be it will work for you too.
Open this file node_modules/react-native-fbsdk-next/android/build.gradle and change Line no 48 with below line
def FACEBOOK_SDK_VERSION = safeExtGet('facebookSdkVersion', '9.0.0')

Ionic 4 Build Issue when add cordova-firebase plugin

When I create basic IONIC 4 application and run > ionic cordova build android
it works fine and apk generated.
When I add plugin firebase > ionic cordova plugin add cordova-plugin-firebase
It failed to build application.
ERROR:
\platforms\android\gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
What went wrong:
Failed to capture fingerprint of input files for task ':app:preDebugBuild' property 'compileManifests' during up-to-date check.
The library com.google.android.gms:play-services-measurement-base is being requested by various other libraries at [[16.5.0,16.5.0], [16.4.0,16.4.0]], but resolves to 16.5.0. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.

Cordova build to Android error

I made an app with Construct 2 and I exported to Intel XDK. Then I exported to cordova and everytime I try to build with "cordova build android" I get this error:
ERROR: In FontFamilyFont, unable to find attribute android:t
tcIndex
FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':processDebugResources'.
com.android.ide.common.process.ProcessException: Failed to execute aapt
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.
BUILD FAILED
Total time: 47.337 secs
Command finished with error code 1: cmd /s /c "C:\Users\Gustavo\app\platfo
rms\android\gradlew.bat cdvBuildDebug -b C:\Users\Gustavo\app\platforms\an
droid\build.gradle -Dorg.gradle.daemon=true -Dorg.gradle.jvmargs=-Xmx2048m -Pand
roid.useDeprecatedNdk=true"
Error: cmd: Command failed with exit code 1 Error output:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
ERROR: In <declare-styleable> FontFamilyFont, unable to find attribute android:fontVariationSettings
ERROR: In <declare-styleable> FontFamilyFont, unable to find attribute android:ttcIndex
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':processDebugResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt
It's my first time posting here, so if I am doing something wrong, please tell me.
Thanks for the help!
I got a build successful by adding this in the build-extras.gradle file:
configurations.all {
resolutionStrategy {
force 'com.android.support:support-v4:27.1.0'
}
}
And by installing the cordova-android-support-gradle-release.
Gustavo,
Its is possible that you have a conflict in cordova plugins or platform. A second possiblity is that, you have added components via npm but haven't installed it. For both scenario, I suggest that you list out the current versions installed, note them down then do an update to cordova. Here is how to list out the versions, like what I have.
cd projectfolder
$ cordova plugin
cordova-plugin-console 1.1.0 "Console"
cordova-plugin-device 2.0.1 "Device"
cordova-plugin-whitelist 1.3.3 "Whitelist"
$ cordova platform
Installed platforms:
android 7.0.0
browser 5.0.3
Available platforms:
ios ~4.5.4
osx ~4.0.1
windows ~5.0.0
www ^3.12.0
$ npm -v
3.10.10
Here is how you update cordova for the project. This example assumes you are using android platform. If you have other plugins/platform, do the necessary.
npm install
npm update
cordova platform rm android --nosave
cordova platform add android
Alternatively
cordova platform update android
If you notice a specific plugin with version error, remove and the plugin with required version.

How to make Android Cordova project built with Gradle build offline?

I have a Ionic/Cordova project, builds for Android are done with Gradle.
I installed all necessary Android SDKs and the project was building fine for many months, but today it fails with the following error:
Running: d:\git\myproject\platforms\android\gradlew cdvBuildDebug -b d:\git\myproject\platforms\android\build.gradle -Dorg.gradle.daemon=true
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:1.0.0+.
Required by:
BUILD FAILED
Total time: 26.792 secs
:android:unspecified
> Failed to list versions for com.android.tools.build:gradle.
> Unable to load Maven meta-data from https://repo1.maven.org/maven2/com/android/tools/build/gradle/maven-metadata.xml.
> Could not GET 'https://repo1.maven.org/maven2/com/android/tools/build/gradle/maven-metadata.xml'.
> Connection to https://repo1.maven.org refused
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
d:\git\myproject\platforms\android\cordova\node_modules\q\q.js:126
throw e;
^
Error code 1 for command: cmd with args: /s /c "d:\git\myproject\platforms\android\gradlew cdvBuildDebug -b d:\git\myproject\platforms\android\build.gradle -Dorg.gradle.daemon=true"
Error: cmd: Command failed with exit code 1
Cordova command failed with error code 1, aborting!
Clearly, since the project was building just fine for months, everything needed to have it build is already on disk, but the build is probably checking if there are updated version of artifacts in the Maven repo, and this is failing.
This is not a very desired behavior sometimes.
Is it possible to configure the build to always build offline?
So I grepped my repo for com.android.tools.build:gradle and I found it in a few files:
D:\git\myproject\platforms\android\build.gradle\build.gradle
D:\git\myproject\platforms\android\cordova\lib\plugin-build.gradle\plugin-build.gradle
D:\git\myproject\platforms\android\CordovaLib\build.gradle\build.gradle
I changed
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0+'
}
to
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
Hopefully this solves my issue, although the problem is gone now even with 1.0.0+, so I can't really verify that easily.
You can check which exact version of com.android.tools.build:gradle you have available locally in the following folder when on Windows:
$HOME\.gradle\caches\modules-2\files-2.1\com.android.tools.build\gradle

Categories

Resources