How to fix "Program type already present: com.reactlibrary.BuildConfig" after installing Appodeal - react-native

Is there anyone who tried to install the Appodeal? I'm trying to install the Appodeal to our React Native 0.60 project but I encountered this error "Program type already present: com.reactlibrary.BuildConfig". I can't find which, where is something wrong.
Here's the plugin that I used.
https://github.com/appodeal/react-native-appodeal
Here's the error that I got:
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':app:multiDexListDebug'.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
Error while merging dex archives:
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: com.reactlibrary.BuildConfig
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 2m 36s
at checkExecSyncError (child_process.js:601:13)
at execFileSync (child_process.js:621:13)
at runOnAllDevices (D:\Projects\Mobile\React Native\catholicconnect\node_modules\#react-native-community\cli-platform-androi
Get more help at https://help.gradle.org
BUILD FAILED in 2m 36s
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.bat app:installDebug -PreactNativeDevServerPort=8081 Note:
Some input files use or override a deprecated API. Note: Recompile
with -Xlint:deprecation for details. D8: Program type already present:
com.reactlibrary.BuildConfig
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':app:multiDexListDebug'.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
Error while merging dex archives:
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: com.reactlibrary.BuildConfig
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 2m 36s
at checkExecSyncError (child_process.js:601:13)
at execFileSync (child_process.js:621:13)
at runOnAllDevices (D:\Projects\Mobile\React Native\catholicconnect\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:74:39)
at buildAndRun (D:\Projects\Mobile\React Native\catholicconnect\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\index.js:158:41)
at then.result (D:\Projects\Mobile\React Native\catholicconnect\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\index.js:125:12)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)

Related

Build failed with an exception error in react-native-community/cli

i got error after i install npm i #react-native-community/cli-platform-android and uninstall it
i am using the latest react native 0.7.1
$ npx react-native run-android
info Starting JS server...
info Installing the app...
FAILURE: Build failed with an exception.
Where:
Settings file 'C:\Users\ASUS\Documents\contra\android\settings.gradle' line: 2
What went wrong:
A problem occurred evaluating settings 'contra'.
Could not read script 'C:\Users\ASUS\Documents\contra\node_modules#react-native-community\cli-platform-android\native_modules.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.
Get more help at https://help.gradle.org
BUILD FAILED in 989ms
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:
Settings file 'C:\Users\ASUS\Documents\contra\android\settings.gradle' line: 2
What went wrong:
A problem occurred evaluating settings 'contra'.
Could not read script 'C:\Users\ASUS\Documents\contra\node_modules#react-native-community\cli-platform-android\native_modules.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.
Get more help at https://help.gradle.org
BUILD FAILED in 989ms
at makeError (C:\Users\ASUS\Documents\contra\node_modules\execa\index.js:174:9)
at C:\Users\ASUS\Documents\contra\node_modules\execa\index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (C:\Users\ASUS\Documents\contra\node_modules\react-native\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
at async Command.handleAction (C:\Users\ASUS\Documents\contra\node_modules\#react-native-community\cli\build\index.js:142:9)
info Run CLI with --verbose flag for more details.
i try install it and uninstall it still cant run

Execution failed for task ':app:checkDebugAarMetadata'. react native

PS D:\MOTOR\kawawamotorsreactapp> npx react-native run-android
warn Package react-native-vector-icons contains invalid configuration: "dependency.assets" is not allowed.
Please verify it's properly linked using "react-native config" command and contact the package maintainers
about this.
info Starting JS server...
info Installing the app...
Task :app:checkDebugAarMetadata FAILED
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.9/userguide/command_line_interface.html#sec:command_line_warnings
94 actionable tasks: 41 executed, 53 up-to-date
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
The minCompileSdk (31) specified in a
dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
is greater than this module's compileSdkVersion (android-30).
Dependency: androidx.appcompat:appcompat:1.4.1.
AAR metadata file: C:\Users\BIBEK.gradle\caches\transforms-3\0e660b8bafa777eda46724d78ef391ea\transformed\appcompat-1.4.1\META-INF\com\android\build\gradle\aar-metadata.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
BUILD FAILED in 1m 12s
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'.
A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
The minCompileSdk (31) specified in a
dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
is greater than this module's compileSdkVersion (android-30).
Dependency: androidx.appcompat:appcompat:1.4.1.
AAR metadata file: C:\Users\BIBEK.gradle\caches\transforms-3\0e660b8bafa777eda46724d78ef391ea\transformed\appcompat-1.4.1\META-INF\com\android\build\gradle\aar-metadata.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
BUILD FAILED in 1m 12s
at makeError (D:\MOTOR\kawawamotorsreactapp\node_modules\execa\index.js:174:9)
at D:\MOTOR\kawawamotorsreactapp\node_modules\execa\index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (D:\MOTOR\kawawamotorsreactapp\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
at async Command.handleAction (D:\MOTOR\kawawamotorsreactapp\node_modules\#react-native-community\cli\build\index.js:142:9)
info Run CLI with --verbose flag for more details.

Configure project :react-native-reanimated

Configure project :react-native-reanimated
FAILURE: Build failed with an exception.
Where:
Build file 'D:\Projects\Vow\iye_react_native_user_app\node_modules\react-native-reanimated\android\build.gradle' line: 152
What went wrong:
A problem occurred evaluating project ':react-native-reanimated'.
Could not get unknown property 'rnMinorVersion' for project ':react-native-reanimated' of type org.gradle.api.Project.
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 14s
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 'D:\Projects\Vow\iye_react_native_user_app\node_modules\react-native-reanimated\android\build.gradle' line: 152
What went wrong:
A problem occurred evaluating project ':react-native-reanimated'.
Could not get unknown property 'rnMinorVersion' for project ':react-native-reanimated' of type org.gradle.api.Project.
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 14s
at makeError (D:\Projects\Vow\iye_react_native_user_app\node_modules\execa\index.js:174:9)
at D:\Projects\Vow\iye_react_native_user_app\node_modules\execa\index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async runOnAllDevices (D:\Projects\Vow\iye_react_native_user_app\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
at async Command.handleAction (D:\Projects\Vow\iye_react_native_user_app\node_modules\react-native\node_modules\#react-native-community\cli\build\index.js:192:9)
info Run CLI with --verbose flag for more details.
Check this thread
https://github.com/software-mansion/react-native-reanimated/issues/3319
It's already been reported
Install version 2.9.0 or above to fixed this issue:
"react-native-reanimated": "^2.9.1"

A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$Task Action

I am very new to react native and I am just trying to build to a device. I keep getting a failed project at the point mentioned above the build seems to fail at this point "Execution failed for task ':app:processDebugResources'".
When I look at the build file for the android manifest there is a lot of errors, I have looked online but i cannot find anything. I have checked build.grade folder to ensure that the sdk tools and those numbers match and are installed as well as cleaning the project, rebuilding and syncing the gradle.
Any help would be very much appreciated I am just so new to all of this! below is the full code error message as well as a picture of the errors from the manifest.Picture of the errors in AndroidManifest.xml
BUILD FAILED in 33s
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:processDebugResources'.
A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$Task
Action
Android resource linking failed
ERROR:C:\Windows\System32\test\android\app\build\intermediates\packaged_manifests\debug\AndroidManifest.xml: A
APT: error: failed to load XML file: The system cannot find the file specified. (2).
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 33s
at makeError (C:\Windows\System32\test\node_modules\#react-native-community\cli-platform-android\node_modules\execa\index.js:174:9)
at C:\Windows\System32\test\node_modules\#react-native-community\cli-platform-android\node_modules\execa\index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (C:\Windows\System32\test\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
at async Command.handleAction (C:\Windows\System32\test\node_modules\#react-native-community\cli\build\index.js:192:9)
info Run CLI with --verbose flag for more details.

React Native can't build APK file

I have successfully build react-native app folder according to this http://facebook.github.io/react-native/docs/getting-started documentation
But, when I am running react-native run-android in cmd, it is showing me this -
info Starting JS server...
info Installing the app...
> Task :app:mergeDebugResources FAILED
9 actionable tasks: 8 executed, 1 up-to-date
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Specified AAPT2 executable does not exist: C:\Users\DE\.gradle\caches\transforms-2\files-2.1\e3571e1615ccf7c32524cbf1a8ed0eb8\aapt2-3.4.1-5326820-windows\aapt2.exe
* 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 55s
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.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Specified AAPT2 executable does not exist: C:\Users\DE\.gradle\caches\transforms-2\files-2.1\e3571e1615ccf7c32524cbf1a8ed0eb8\aapt2-3.4.1-5326820-windows\aapt2.exe
* 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 55s
at checkExecSyncError (child_process.js:621:11)
at execFileSync (child_process.js:639:15)
at runOnAllDevices (C:\Users\DE\AwesomeApp\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:75:39)
at buildAndRun (C:\Users\DE\AwesomeApp\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\index.js:137:41)
at C:\Users\DE\AwesomeApp\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\index.js:103:12
at processTicksAndRejections (internal/process/task_queues.js:89:5)
at async Command.handleAction (C:\Users\DE\AwesomeApp\node_modules\#react-native-community\cli\build\cliEntry.js:160:7)```
I have resolved this problem by deleting the cache of .gradle folder. The path is C:\Users\DE\.gradle\caches . After that, apps are building.
I had the same problem. I tried going to the application directory the second one with cmd and running "react-native start". This solved my problem.