Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java exception when doing an android build #1552

Closed
3 tasks done
jondspa opened this issue Jan 26, 2023 · 1 comment
Closed
3 tasks done

Java exception when doing an android build #1552

jondspa opened this issue Jan 26, 2023 · 1 comment

Comments

@jondspa
Copy link

jondspa commented Jan 26, 2023

Bug Report

Problem

Getting a Java exception when doing a build on a freshly installed system. I've been trying to update my Cordova app to API 31. I've been having trouble so decided to do a fresh install on a new machine. Loaded everything new but getting the below errors.

Many thanks for any advice!
Jon

What is expected to happen?

Build would succeed.

What does actually happen?

Getting this error message on first build. The error continues for another 100 or so lines. Repeated several times.

Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/03 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Not a number: 33x:
java.lang.NumberFormatException: Not a number: 33x
at com.sun.xml.bind.DatatypeConverterImpl._parseInt(DatatypeConverterImpl.java:95)
at com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$18.parse(RuntimeBuiltinLeafInfoImpl.java:712)
at com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$18.parse(RuntimeBuiltinLeafInfoImpl.java:710)
at com.sun.xml.bind.v2.runtime.unmarshaller.TextLoader.text(TextLoader.java:39)
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.text(UnmarshallingContext.java:560)
at com.sun.xml.bind.v2.runtime.unmarshaller.SAXConnector.processText(SAXConnector.java:183)
at com.sun.xml.bind.v2.runtime.unmarshaller.SAXConnector.endElement(SAXConnector.java:146)
at java.xml/org.xml.sax.helpers.XMLFilterImpl.endElement(XMLFilterImpl.java:570)
at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:610)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1718)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2883)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)

On subsequent builds:

Execution failed for task ':app:mergeReleaseResources'.

Multiple task action failures occurred:
A failure occurred while executing com.android.build.gradle.internal.res.Aapt2CompileRunnable
> AAPT2 aapt2-4.2.2-7147631-osx Daemon #3: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
A failure occurred while executing com.android.build.gradle.internal.res.Aapt2CompileRunnable
> AAPT2 aapt2-4.2.2-7147631-osx Daemon #0: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
A failure occurred while executing com.android.build.gradle.internal.res.Aapt2CompileRunnable
> AAPT2 aapt2-4.2.2-7147631-osx Daemon #2: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
A failure occurred while executing com.android.build.gradle.internal.res.Aapt2CompileRunnable
> AAPT2 aapt2-4.2.2-7147631-osx Daemon #1: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
A failure occurred while executing com.android.build.gradle.internal.res.Aapt2CompileRunnable
> AAPT2 aapt2-4.2.2-7147631-osx Daemon #6: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
A failure occurred while executing com.android.build.gradle.internal.res.Aapt2CompileRunnable
> AAPT2 aapt2-4.2.2-7147631-osx Daemon #4: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.
A failure occurred while executing com.android.build.gradle.internal.res.Aapt2CompileRunnable
> AAPT2 aapt2-4.2.2-7147631-osx Daemon #5: Daemon startup failed
This should not happen under normal circumstances, please file an issue if it does.

Information

Command or Code

Cordova build android --release

Environment, Platform, Device

Mac OS 12.5

Version information

Cordova version 11.1.0
Cordova-android 10.1.2
target SDK version 31
Gradle version 7.6
Gradle wrapper 7.1
Android build tools 30.0.3
Java version 11.0.17

Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above
@breautek
Copy link
Contributor

Compiling/targeting API 31+ requires build tools 31+. I believe this is why AAPT is failing.

Cordova-android@10 doesn't officially support targeting API 31+. The project should be upgraded to cordova-android@11.

Build tools 31+ also requires Java11, which I see you are already using.

If it's not possible or feasible to upgrade, then you might be able to get by by setting android-targetSdkVersion to 31, and android-buildToolsVersion to 31.0.0 (version should match the installed version identically... so if yoi have version 31.0.1 installed then the preference value should match. As cordova-android@10 doesn't support API 31, your mileage may vary.

If neither upgrading to cordova-android@11 or my hack workaround works for you, then like the error says a bug should be reported, but it should be reported to the Android SDK, which can be done here.

If you have further questions, don't hesitate to ask, but I'll be closing this issue as the reported stack trace indicates a bug with AAPT, not Cordova.

@breautek breautek closed this as not planned Won't fix, can't repro, duplicate, stale Jan 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants