Error Building with Android

Hi,

I am getting the following error when building with Android

Checking Java JDK and Android SDK versions   /
ANDROID_HOME=/home/lethalcyborg/Android/Sdk (recommended setting)
ANDROID_SDK_ROOT=/home/lethalcyborg/Android/Sdk (DEPRECATED)
Using Android SDK: /home/lethalcyborg/Android/Sdk
openjdk version "17.0.13" 2024-10-15
OpenJDK Runtime Environment (build 17.0.13+11-Ubuntu-2ubuntu124.04)
OpenJDK 64-Bit Server VM (build 17.0.13+11-Ubuntu-2ubuntu124.04, mixed mode, sharing)
   Building Cordova app for Android          |
BUILD SUCCESSFUL in 0s
1 actionable task: 1 executed
openjdk version "17.0.13" 2024-10-15         -
OpenJDK Runtime Environment (build 17.0.13+11-Ubuntu-2ubuntu124.04)
OpenJDK 64-Bit Server VM (build 17.0.13+11-Ubuntu-2ubuntu124.04, mixed mode, sharing)

> Configure project :app
Adding classpath: com.google.gms:google-services:4.3.15

> Task :app:mergeReleaseResources FAILED
/home/lethalcyborg/.gradle/caches/transforms-4/03d10d25bdf91f1e03a4061a4963807b/transformed/appcompat-1.6.1/res/values/values.xml:27:4: Invalid <color> for given resource value.
   Building Cordova app for Android          /
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeReleaseResources'.
> A failure occurred while executing com.android.build.gradle.internal.res.ResourceCompilerRunnable
   > Resource compilation failed (Failed to compile values resource file /home/lethalcyborg/LethalAddons/LethalAddons/.meteor/local/cordova-build/platforms/android/app/build/intermediates/incremental/release/mergeReleaseResources/merged.dir/values/values.xml. Cause: java.lang.IllegalStateException: Can not extract resource from com.android.aaptcompiler.ParsedResource@295e4b30.). Check logs for more 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 783ms
19 actionable tasks: 19 executed
=> Errors executing Cordova commands:         
                                              
   While building Cordova app for platform Android:
   Error: Command failed with exit code 1: /home/lethalcyborg/LethalAddons/LethalAddons/.meteor/local/cordova-build/platforms/android/tools/gradlew :app:bundleRelease
   at makeError (/home/lethalcyborg/LethalAddons/LethalAddons/.meteor/local/cordova-build/node_modules/execa/lib/error.js:60:11)
   at handlePromise (/home/lethalcyborg/LethalAddons/LethalAddons/.meteor/local/cordova-build/node_modules/execa/index.js:118:26)
   at processTicksAndRejections (node:internal/process/task_queues:95:5)
   at ProjectBuilder.build (/home/lethalcyborg/LethalAddons/LethalAddons/.meteor/local/cordova-build/node_modules/cordova-android/lib/builders/ProjectBuilder.js:326:20)
   at /tools/cordova/project.js:332:7
   at CordovaProject.runCommands (/tools/cordova/project.js:954:14)
   at CordovaProject.buildForPlatform (/tools/cordova/project.js:330:5)
   at /tools/cli/commands.js:1468:15
   at Object.enterJob (/tools/utils/buildmessage.js:387:12)
   at /tools/cli/commands.js:1451:9
   at Object.capture (/tools/utils/buildmessage.js:282:5)
   at Object.main.captureAndExit (/tools/cli/main.js:275:16)
   at buildCommand (/tools/cli/commands.js:1425:5)
   at /tools/cli/commands.js:1212:18
   at Command.func (/tools/cli/commands.js:1210:10)
   at /tools/cli/main.js:1546:15

Hi @lethalcyborg I am replying to this but I don’t really have an answer. However, wanted to say that with fringe tech such as Cordova, chances to get a reply here are a little limited but surely not impossible.

In general, for this type of problems, you need to align your versions of everything SDKs, JDK, Gradle etc so you need to have control and understand where to find all these versions and make sure those are the actual versions running. For instance, Gradle might be referenced in multiple files with multiple versions.

I think one of the best places to start digging into this is AI. Here is an example from something I use, Perplexity:

https://www.perplexity.ai/search/why-i-get-this-errror-task-app-lnOoK76RT8iBt9Q7iZ8jkg

In the answer, you can see the sources used to answer that.

The issue was in my mobile-config.js

I had the background colour set as 0xFFFFF instead of #FFFFF