I am trying to integrate react-native-device-info to my project and when I install the module and link it an error comes up like this
```
* What went wrong:
Execution failed for task ':app:preDebugBuild'.
> Android dependency 'com.google.android.gms:play-services-base' has different version for the compile (15.0.1) and runtime (16.0.1) classpath. You should manually set the same version via DependencyResolution
* 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 6s
13 actionable tasks: 1 executed, 12 up-to-date
```
And when I configure the project manually same error comes up.But when I unlink react native device info, the project runs well.
Add this block in your app/build.gradle file below buildTypes{} block and run the app again
configurations.all {
resolutionStrategy {
force 'com.google.android.gms:play-services-base:16.0.1'
}
}
Related
I am having issue with my react native app android build having this error message pop up
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':react-native-reanimated'.
> com.android.builder.errors.EvalIssueException: CMake '3.18.1' was not found in SDK, PATH, or by cmake.dir property.
* 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
and then the build fails if anyone knows this issue please could help me solve this , im using metro not expo
Try to add this line below presets in babel.config.js file.
plugins: [
'react-native-reanimated/plugin',
],
Open SDK Manager
Switch to the SDK Tools tab
Install CMake (select the version highlighted in your error)
I installed react-native stripe sdk with the following command:
npm install #stripe/stripe-react-native
After I try to build the app I get the following two errors:
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* Where:
Build file 'C:\xampp\htdocs\SoFood\node_modules\#stripe\stripe-react-native\android\build.gradle' line: 18
* What went wrong:
A problem occurred evaluating project ':stripe_stripe-react-native'.
> Failed to apply plugin [id 'kotlin-android']
> The current Gradle version 5.4.1 is not compatible with the Kotlin Gradle plugin. Please use Gradle 6.1 or newer, or the previous version of the Kotlin plugin.
* 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:
A problem occurred configuring project ':stripe_stripe-react-native'.
> compileSdkVersion is not specified.
* 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 40s
Any idea what could it be?
It's saying that your current version of Gradle is not compatible with the package requirements.
Try to upgrade the version of your Gradle.
How to do that :
In android/build.gradle you have to edit this line
classpath 'com.android.tools.build:gradle:x.y.z'
Modify the x and y and z with the version they suggested. for example :
classpath 'com.android.tools.build:gradle:6.1.0'
Edit it with Android Studio then click Sync now
I tried launch my app in React Native with npx react-native run-android on terminal and this error happen
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_warning
Picked up _JAVA_OPTIONS: -Xmx512M
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* Where:
Build file 'C:\Users\mikae\Desktop\AppDentista\android\app\build.gradle' line: 87
* What went wrong:
A problem occurred evaluating project ':app'.
> Could not read script 'C:\Users\mikae\Desktop\AppDentista\node_modules\expo-updates\scripts\create-manifest-android.gradle' as it does not exist.
* 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:
A problem occurred configuring project ':app'.
> compileSdkVersion is not specified.
* 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 45s
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
Picked up _JAVA_OPTIONS: -Xmx512M
I wanna start and install my application on Android emulator, but this error always happen when I try. This says something is missing, but I don't know what. I didn't find the same problem as mine elsewhere on the internet
I already got, if you have the same problem. Do you need install all dependencies again (Android Studio, React and Java). After that, create a project with npx react-native init Project, and finish!
I'm trying to generate a signed APK for android on react native, but I'm not getting it, the terminal is returning this error below:
> Task :app:bundleReleaseJsAndAssets
warning: the transform cache was reset.
Welcome to React Native!
Learn once, write anywhere
info Writing bundle output to:, C:\Users\paulo\Documents\Sperio\speriomob\android\app\build\generated\assets\react\release\index.android.bundle
info Writing sourcemap output to:, C:\Users\paulo\Documents\Sperio\speriomob\android\app\build\generated\sourcemaps\react\release\index.android.bundle.map
info Done writing bundle output
info Done writing sourcemap output
info Copying 10 asset files
info Done copying assets
> Task :app:processReleaseGoogleServices
Parsing json file: C:\Users\paulo\Documents\Sperio\speriomob\android\app\google-services.json
> Task :app:lintVitalRelease
Calling mockable JAR artifact transform to create file: C:\Users\paulo\.gradle\caches\transforms-2\files-2.1\7b924f61dca3b36e28aeb94601753e06\android.jar with input C:\Android\Sdk\platforms\android-29\android.jar
> Task :app:validateSigningRelease FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:validateSigningRelease'.
> Keystore file not set for signing config release
* 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.2/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 5m 46s
249 actionable tasks: 249 executed
Has anyone experienced this error and can help me, I'm desperate):
If you haven't signed your app. Follow generating an upload key in this link:
https://reactnative.dev/docs/signed-apk-android
Otherwise, check if you have placed your keystore in /android/app/ folder
The libary I'm using is yarn add react-native-photo-upload from https://www.npmjs.com/package/react-native-photo-upload
and it's throwing the following error:
**/home/haseeb/Desktop/RN/myProject/node_modules/react-native-image-picker/android/build/intermediates/res/merged/release/values-v26/values-v26.xml:15:21-54: AAPT: No resource found that matches the given name: attr 'android:keyboardNavigationCluster'.
/home/haseeb/Desktop/RN/myProject/node_modules/react-native-image-picker/android/build/intermediates/res/merged/release/values-v26/values-v26.xml:15: error: Error: No resource found that matches the given name: attr 'android:keyboardNavigationCluster'.
:react-native-image-picker:processReleaseResources FAILED
**FAILURE**: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-image-picker:processReleaseResources'.
> 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: 5.653 secs
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**
i tried android.enableAapt2=false in gradle.properties of react-native-image-picker but no gain...same error
plz help to resolve it!
Be sure to follow the instructions of the library, after running yarn add react-native-photo-upload
, you need to make sure to link the package and build the project again:
react-native link react-native-image-picker
react-native link react-native-image-resizer
react-native link react-native-fs
After that, you can go to yourProject/android/settings.gradle and verify if all modules have been added. It may look like:
include ':module-name'
project(':module-name').projectDir = new File(rootProject.projectDir,
'../node_modules/module-name/android')
You may also go to yourProject/android/app/build.gradle to check if the modules are present on the dependencies:
dependencies {
compile project(':module-name')
}