everyone, please help me. im running ionic cordova run android. then an error occured. before install plugin facebook4 things are going well, after instal the plugin im can not build or run android. i have running cordova clean and cordova build not solved my problem.
:app:transformClassesWithDesugarForDebug
:app:transformClassesWithDexBuilderForDebug
:app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED
42 actionable tasks: 40 executed, 2 up-to-date
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 2m 49s
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.
Note: E:\PROJECT\spectraapp\platforms\android\app\src\main\java\org\apache\cordova\file\AssetFilesystem.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 2m 49s
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd build android --device exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
Try removing platform and re-add it.
ionic cordova platform remove android
ionic cordova platform add android
then try
ionic cordova run android
If still have some issue
check it
solved. iam remove plugin facebook and add again with version #1.7.4
ionic cordova plugin add cordova-plugin-facebook4#1.7.4 --variable APP_ID="appid" --variable APP_NAME="appname"
add resource strings.xml in platforms/android/app/src/main/res/values/strings.xml
<string name="fb_app_id">appid</string>
<string name="fb_app_name">appname</string>
ionic cordova run android
Related
~/RNSTAMPY react-native run-android 1 ✘ ╱ took 41s ╱ at 10:24:15 PM
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
(node:4459) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use node --trace-warnings ... to show where the warning was created)
Jetifier found 1119 file(s) to forward-jetify. Using 8 workers...
info JS server already running.
info Launching emulator...
info Successfully launched emulator.
info Installing the app...
Task :app:compileDebugJavaWithJavac 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.3.3/userguide/command_line_interface.html#sec:command_line_warnings
93 actionable tasks: 2 executed, 91 up-to-date
/Users/leeseungsup/RNSTAMPY/android/app/src/main/java/com/rnstampy/MainActivity.java:2: error: class, interface, or enum expected
package com.rnstampy;
^
1 error
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app: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
BUILD FAILED in 3s
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
/Users/leeseungsup/RNSTAMPY/android/app/src/main/java/com/rnstampy/MainActivity.java:2: error: class, interface, or enum expected
package com.rnstampy;
^
1 error
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app: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
BUILD FAILED in 3s
at makeError (/Users/leeseungsup/RNSTAMPY/node_modules/#react-native-community/cli-platform-android/node_modules/execa/index.js:174:9)
at /Users/leeseungsup/RNSTAMPY/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 (/Users/leeseungsup/RNSTAMPY/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:109:5)
at async Command.handleAction (/Users/leeseungsup/RNSTAMPY/node_modules/#react-native-community/cli/build/index.js:192:9)
info Run CLI with --verbose flag for more details.
run-ios is ok
run-android => android emulator opens but can't install my app.
When I ran android emulator in EXPO cli, it worked well!
but in react-native-cli environment, it doesn't work!!
react-native-cli: 2.0.1
react-native: 0.69.3
please help me~~
I solved my problem.
/Users/leeseungsup/RNSTAMPY/android/app/src/main/java/com/rnstampy/MainActivity.java:2: error: class, interface, or enum expected package com.rnstampy; ^ 1 error
this was my problem.
I moved [package com.rnstampy;] on the TOP. that's all.
It worked.
Hello, I use Ionic for my app. I can serve it but cant built. Here this problem:
Please, help me if you can
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileReleaseJavaWithJavac'.
> 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 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.1.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 30s
47 actionable tasks: 8 executed, 39 up-to-date
Command failed with exit code 1: C:\Users\Darkhan\Downloads\GrandTovarPlus\pvl\platforms\android\gradlew :app:bundleRelease -b C:\Users\Darkhan\Downloads\GrandTovarPlus\pvl\platforms\android\build.gradle
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd build android --release exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
I'm currently using React Native to code my final year project. I have an issue when build and install it to virtual/physical devices althought a month ago it worked fine. Can someone explain to me wwhat wrongs with my code or files? Does it get corrupted? Because I tried to created a blank new file I still get the same errors.
My error:
> Task :app:processDebugResources 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.2/userguide/command_line_interface.html#sec:command_line_warnings
183 actionable tasks: 2 executed, 181 up-to-date
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.tasks.Workers$ActionFacade
> Android resource linking failed
C:\Users\minht\SmartRoom\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>.
* 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 11s
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
Seems like you need upgrade Gradle from Android studio and then try if you can run your project from Android Studio.
I’m getting issue follow while taking android build.
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug’
Task :CordovaLib:compileDebugShaders UP-TO-DATE
Task :CordovaLib:generateDebugAssets UP-TO-DATE
Task :CordovaLib:packageDebugAssets UP-TO-DATE
Task :app:mergeDebugAssets
Task :app:validateSigningDebug UP-TO-DATE
Task :app:signingConfigWriterDebug UP-TO-DATE
Task :app:transformClassesWithDexBuilderForDebug UP-TO-DATE
Task :app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED
D8: Program type already present: android.support.v4.os.ResultReceiver$MyResultReceiver
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
com.android.builder.dexing.DexArchiveMergerException: 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: android.support.v4.os.ResultReceiver$MyResultReceiver
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 22s
35 actionable tasks: 3 executed, 32 up-to-date
/Users/panmoh/Documents/mobile-app/platforms/android/gradlew: Command failed with exit code 1 Error output:
D8: Program type already present: android.support.v4.os.ResultReceiver$MyResultReceiver
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
com.android.builder.dexing.DexArchiveMergerException: 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: android.support.v4.os.ResultReceiver$MyResultReceiver
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 22s
[ERROR] An error occurred while running subprocess cordova.
cordova build android exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
Note : I tried cordova clean android and remove and add android platfoem as well
To fix this issue for those using Phonegap/Cordova
Install the “cordova-plugin-androidx” plugin
cordova plugin add cordova-plugin-androidx
Install “cordova-plugin-androidx-adapter” plugin
cordova plugin add cordova-plugin-androidx-adapter
Add these lines in your gradle.properties :
android.useAndroidX=true
android.enableJetifier=true
After this, make a build: cordova -d build android and check the result
solutions is following : make sure the following :
Upgrade com.android.tools.build:gradle to v3.2.1 or later.
Upgrade compileSdkVersion to 28 or later. . Update your app to use
Jetpack (AndroidX); follow the instructions in Migrating to AndroidX.
For Cordova/Ionic project just add the following plugins:
https://github.com/dpa99c/cordova-plugin-androidx
https://github.com/dpa99c/cordova-plugin-androidx-adapter
Those plugins will fix build error. and everything will work fine :)..
The solution accepted here is the true solution. I stuck with this issue for a week and than on last weekend i decided no matter what happens a'll find solution for it.
All credit goes to this person named (ProdoElmit) who answered it here.
Attaching screenshots for above solution to make it easier to follow:
Here my project name was app
In my case it was FCM which was using androidx and causing this issue. Hope this will help someone to resolve their issue as well.
I am having trouble in building my ionic 3 app. Every time I try to build the android app it gives the following error.
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
Try:
37 actionable tasks: 10 executed, 27 up-to-date
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Get more help at https://help.gradle.org
BUILD FAILED in 35s
(node:5924) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): 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 unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Picked up _JAVA_OPTIONS: -Xmx512M
Picked up _JAVA_OPTIONS: -Xmx512M
Picked up _JAVA_OPTIONS: -Xmx512M
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Get more help at https://help.gradle.org
BUILD FAILED in 35s
Picked up _JAVA_OPTIONS: -Xmx512M
(node:5924) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Can anyone help me with the issue?
cordova clean android should fix your problem.
I solved it by removing platform and adding it again:
ionic cordova platform rm android
ionic cordova platform rm ios
ionic cordova platform add android
ionic cordova platform add ios
If the cordova clean command does not solve this problem for you, it might be related to the new implementation of AndroidX in some of your libraries.
In my case it was cordova-plugin-firebase-analytics
Follow these steps:
0 / Remove your android platform
cordova platform rm android
1 / Remove all plugins related to support / gradle / firebase versions control (Optional -- I didn't need to remove any plugins. So if you are not sure about how to do this, just skip this step)
2 / Add the AndroidX plugins from #dpa99c :
# add plugin to enable AndroidX in the project
cordova plugin add cordova-plugin-androidx
# add plugin to patch existing plugin source that uses the Android Support Library to use AndroidX
cordova plugin add cordova-plugin-androidx-adapter
3 / Add your android platform
cordova platform add android
Thanks to #MathieuNa : https://forum.ionicframework.com/t/d8-program-type-already-present/166812/4?u=carlosglegaspi
Delete this folder: "../app/build"