Cordova Failing To Build - android

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'

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

Cordova Android build broken after gradle dependencies update issue

JAVA_HOME=C:\Program Files\Java\jdk1.8.0_111
TargetSDKVersion:25
Cordova Android build broken after gradle dependencies update: Execution failed for task ‘:processDebugResources’. > com.android.ide.common.process.ProcessException: Failed to execute aapt
I recently ran the command “cordova build android” and gradle tried to download some dependecies:
Incremental java compilation is an incubating feature.
Download https://maven.google.com/com/android/support/support-v4/27.0.0/support-v4-27.0.0.pom
Download https://maven.google.com/com/android/support/customtabs/27.0.0/customtabs-27.0.0.pom
Download https://maven.google.com/com/android/support/support-compat/27.0.0/support-compat-27.0.0.pom
Download https://maven.google.com/com/android/support/support-media-compat/27.0.0/support-media-compat-27.0.0.pom
Download https://maven.google.com/com/android/support/support-core-utils/27.0.0/support-core-utils-27.0.0.pom
Download https://maven.google.com/com/android/support/support-core-ui/27.0.0/support-core-ui-27.0.0.pom
Download https://maven.google.com/com/android/support/support-fragment/27.0.0/support-fragment-27.0.0.pom
Download https://maven.google.com/com/android/support/support-annotations/27.0.0/support-annotations-27.0.0.pom
After that, at the end the build fails with this message:
ERROR: In FontFamilyFont, unable to find attribute android:font
ERROR: In FontFamilyFont, unable to find attribute android:fontStyle
ERROR: In FontFamilyFont, unable to find attribute android:fontWeight
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.
[ERROR] An error occurred while running cordova run android (exit code 1)
I tried to find a solution but I didn’t find any post with this.
Any idea???
Remove platform/android then run Cordova build android again

Ionic Build failed :app:transformClassesWithDesugarForDebug

FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:transformClassesWithDesugarForDebug'.
com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: Error while executing java process with main class com.google.devtools.build.android.desugar.Desugar with arguments {#C:\MobileApp.Ionic\platforms\android\app\build\intermediates\tmp\desugar_args3140882361716595656}
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 1m 9s
(node:28480) [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.
try command cordova clean android make sure the user executes command has admin privilage

error when ionic cordova run android in ionic

error in my terminal
Android Studio project detected
ANDROID_HOME=C:\Users\FUJIN\AppData\Local\Android\Sdk\tools
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_161\
studio
Subproject Path: CordovaLib
Subproject Path: app
FAILURE: Build failed with an exception.
Where:
Script 'C:\Users\FUJIN\hilih\platforms\android\CordovaLib\cordova.gradle' line: 68
What went wrong:
A problem occurred evaluating project ':CordovaLib'.
No installed build tools found. Install the Android build tools version 19.1.0 or higher.
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 0s
(node:15572) UnhandledPromiseRejectionWarning: Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
Where:
Script 'C:\Users\FUJIN\hilih\platforms\android\CordovaLib\cordova.gradle' line: 68
What went wrong:
A problem occurred evaluating project ':CordovaLib'.
No installed build tools found. Install the Android build tools version 19.1.0 or higher.
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 0s
at ChildProcess.whenDone (C:\Users\FUJIN\hilih\platforms\android\cordova\node_modules\cordova-common\src\superspawn.js:169:23)
at ChildProcess.emit (events.js:180:13)
at maybeClose (internal/child_process.js:936:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5) (node:15572)
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:15572) [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. [02:00:48] lint finished
in 4.01 s
[OK] Your app has been deployed.
Did you know you can live-reload changes from your app with --livereload?

Categories

Resources