How to fix Error: Duplicate resources when generate android build - android

Here i am trying to generate build for android device and i get an error which is defined below, my project is in ionic with fire-store(beta version).
Can any one help me to fix it:
BUILD FAILED in 2s
[string/google_api_key] ...............\platforms\android\app\src\main\res\values\strings.xml [string/google_api_key] ...............\platforms\android\app\build\generated\res\google-services\debug\values\values.xml: Error: Duplicate resources
:app:mergeDebugResources FAILED
22 actionable tasks: 2 executed, 20 up-to-date
(node:6472) UnhandledPromiseRejectionWarning: Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> [string/google_app_id] ................\platforms\android\app\src\main\res\values\strings.xml [string/google_app_id] ................\platforms\android\app\build\generated\res\google-services\debug\values\values.xml: Error: Duplicate resources
[string/google_api_key] ................\platforms\android\app\src\main\res\values\strings.xml [string/google_api_key] ................\platforms\android\app\build\generated\res\google-services\debug\values\values.xml: Error: Duplicate resources
* 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 2s
at ChildProcess.whenDone (..............\platforms\android\cordova\node_modules\cordova-common\src\superspawn.js:169:23)
at ChildProcess.emit (events.js:160:13)
at maybeClose (internal/child_process.js:943:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
(node:6472) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:6472) [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.

I had a similar error with cordova-plugin-facebook4.
The documentation had suggested I add:
<config-file parent="/resources" target="./res/values/strings.xml">
<string name="fb_app_id">XXX</string>
<string name="fb_app_name">XXX</string>
</config-file>
along with the specific plugin config:
<plugin name="cordova-plugin-facebook4" spec="^3.1.0">
<variable name="APP_ID" value="XXX" />
<variable name="APP_NAME" value="XXX" />
</plugin>
Since something updated, the config-file version causes this issue.
Remove the related items from config-file.

Related

ionic cordova build android --prod --release Error :app:transformDexWithDexForRelease

Yesterday I used this command and it was generated correctly, today I put sentry and now this command does not work,
is it because of the sing that applied yesterday?
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':app:transformDexWithDexForRelease'.
com.android.build.api.transform.TransformException:
com.android.ide.common.process.ProcessException:
java.util.concurrent.ExecutionException:
com.android.dex.DexIndexOverflowException: Cannot merge new index
66590 into a non-jumbo instruction!
Try: 37 actionable tasks: 2 executed, 35 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 7s (node:13676) UnhandledPromiseRejectionWarning:
Error: cmd: Command failed with exit code 1 Error output: FAILURE:
Build failed with an exception.
What went wrong: Execution failed for task ':app:transformDexWithDexForRelease'.
com.android.build.api.transform.TransformException:
com.android.ide.common.process.ProcessException:
java.util.concurrent.ExecutionException:
com.android.dex.DexIndexOverflowException: Cannot merge new index
66590 into a non-jumbo instruction!
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 7s
at ChildProcess.whenDone (C:\Goubun\Noediiler\neodiiler-ionic\platforms\android\cordova\node_modules\cordova-common\src\superspawn.js:169:23)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5) (node:13676)
UnhandledPromiseRejectionWarning: Unhandled promise rejection. This
error originated either by throwing inside of an async function
without a catch block, or by rejecting a promise which was not handled
with .catch(). (rejection id: 1) (node:13676) [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.
Run this command in the root of your project :
cordova plugin add https://github.com/jwall149/cordova-multidex --save
It will install cordova-multidex and your build will work fine.

IONIC apk Generate Issue

I have getting this error when I run ionic cordova build --release android
but yesterday it was running perfectly im not change anything about configuration only build distribution I think it is version issue but I unable to find how to resolve it please help
here is console log
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all files for configuration ':app:releaseCompileClasspath'.
> Could not find any version that matches com.google.firebase:firebase-measurement-connector:[10.2.1,12.1.0[.
Versions that do not match:
17.0.0
16.0.0
15.0.0
Required by:
project :app > com.google.firebase:firebase-messaging:17.0.0
* 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 41s
11 actionable tasks: 11 executed
(node:15826) UnhandledPromiseRejectionWarning: Error: /home/chamikara/Projects/freelance/ionic/beachlines/notifications/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all files for configuration ':app:releaseCompileClasspath'.
> Could not find any version that matches com.google.firebase:firebase-measurement-connector:[10.2.1,12.1.0[.
Versions that do not match:
17.0.0
16.0.0
15.0.0
Required by:
project :app > com.google.firebase:firebase-messaging:17.0.0
* 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 41s
at ChildProcess.whenDone (/home/chamikara/Projects/freelance/ionic/beachlines/notifications/platforms/android/cordova/node_modules/cordova-common/src/superspawn.js:169:23)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
(node:15826) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:15826) [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.
Related to this answer : https://stackoverflow.com/a/51779975/279326 I fixed by going back to ionic#4.0.3 npm i -g ionic#4.0.3

Execution failed for task ':processDebugGoogleServices'. IONIC 3

BUILD FAILED in 4s
11 actionable tasks: 1 executed, 10 up-to-date
(node:5457) UnhandledPromiseRejectionWarning: Error: /Users/lucaszimmermann/Desktop/www/****/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':processDebugGoogleServices'.
Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 9.0.0.
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 4s
at ChildProcess.whenDone (/Users/lucaszimmermann/Desktop/www/****/platforms/android/cordova/node_modules/cordova-common/src/superspawn.js:169:23)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
(node:5457) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:5457) [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.

Ionic Fails To build and deploy apk to physical device

I'm trying to build an app that I have tested on other devices and computers using ionic 2. I keep getting this error followed by build completed and app deployed even though it is not.
(node:11125) UnhandledPromiseRejectionWarning: Error: /Users/kieran/Desktop/finalyearproject/frontendrest/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugAssets'.
> java.io.IOException: Could not delete path '/Users/kieran/Desktop/finalyearproject/frontendrest/platforms/android/app/build/intermediates/assets/debug/www/index.html'.
* 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 2s
at ChildProcess.whenDone (/Users/kieran/Desktop/finalyearproject/frontendrest/platforms/android/cordova/node_modules/cordova-common/src/superspawn.js:169:23)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
(node:11125) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:11125) [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.
[OK] Your app has been deployed.
Did you know you can live-reload changes from your app with --livereload?
MacOSs-MacBook-Pro:frontendrest kieran$
Sometimes I have similar problems.
Just delete intermediates folder in your path:
/Users/kieran/Desktop/finalyearproject/frontendrest/platforms/android/app/build/intermediates
Kill 'java' process in your task manager.

Cordova Failing To Build

I am a front-end developer and I am working on a app for a tech company. Because I do primarily front-end html/css/js work I'm somewhat unfamiliar on what to do when cordova fails to build, though I usually get through it by searching, I cannot find a solution to my problem. Any help is appreciated!
When I tried to run the app I got a console error informing me I needed to install the ai.api.apiai plugin so I installed it via the command line and it is appearing in the config.xml file.
This is where my trouble began.
When I run this in command line:
cordova build
I get this error:
:transformClassesWithDexForDebug FAILED
BUILD FAILED
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException:
java.util.concurrent.ExecutionException: com.android.dex.DexException:
Multiple dex files define
Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat;
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Total time: 15.9 secs (node:6184) UnhandledPromiseRejectionWarning: Unhandled promise
rejection (rejection id: 1): Error: cmd: Command failed with exit code
1 Error output: FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException:
java.util.concurrent.ExecutionException: com.android.dex.DexException:
Multiple dex files define
Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat;
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. (node:6184) [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.
Now I did try a couple of attempts such as adding to my gradle file this line of code:
defaultConfig{
multiDexEnabled true
}
But this caused another error during the build so I got rid of this line of code.
Please add this dependency if not present, in build.gradle -> compile 'com.android.support:multidex:1.0.0'

Categories

Resources