apache / cordova-android

Apache Cordova Android
https://cordova.apache.org/
Apache License 2.0
3.59k stars 1.52k forks source link

Execution failed for task ':app:mergeReleaseResources'. #1702

Closed Venegrad closed 3 days ago

Venegrad commented 3 weeks ago

Cordova resion --- 12.0.0 (cordova-lib@12.0.1) Java -- openjdk 11.0.22 2024-01-16

Im trying to clean test cordova. Intall latest cordova and latest java. But when im trying to build app im getting an error:

* 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 resource file: /Users/venegrad/Projects/freex/cordova/platforms/android/app/src/main/res/xml/config.xml: . Cause: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[11,69]
     Message: http://www.w3.org/TR/1999/REC-xml-names-19990114#AttributePrefixUnbound?uses-permission&android:name&android). Check logs for more details.

My config.xml is clean:

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.freex.freex" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>APP</name>
    <description>APP App</description>
    <author email="dev@cordova.apache.org" href="https://cordova.apache.org">
        Apache Cordova Team
    </author>
    <access origin="*" />
    <preference name="ResolveServiceWorkerRequests" value="true" />
    <preference name="AndroidPersistentFileLocation" value="Compatibility" />
    <preference name="iosScheme" value="https" />
    <preference name="Scheme" value="https" />
    <preference name="StatusBarOverlaysWebView" value="true" />
    <platform name="android">
        <allow-intent href="market:*"/>
    </platform>
    <platform name="ios">
        <allow-intent href="itms:*"/>
        <allow-intent href="itms-apps:*"/>
    </platform>
    <content src="index.html" />
    <config-file target="AndroidManifest.xml" parent="/*" mode="merge">
        <uses-permission android:name="android.permission.CAMERA" />
        <uses-feature android:name="android.hardware.camera" />
        <uses-feature android:name="android.hardware.camera.autofocus" />
    </config-file>
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
</widget>

Andoid version:

Using cordova-fetch for cordova-android
Adding android project...
Creating Cordova project for the Android platform:
        Path: platforms/android
        Package: com.example.app
        Name: APP
        Activity: MainActivity
        Android Target SDK: android-33
        Android Compile SDK: 33
Subproject Path: CordovaLib
Subproject Path: app
Android project created with cordova-android@12.0.1
erisu commented 3 weeks ago

Could you try adding the Android XML namespace to the widget and try again?

xmlns:android="http://schemas.android.com/apk/res/android"
breautek commented 3 days ago

Closing as stale / not a bug.

The provided XML was missing the android: namespace declaration and is likely the issue.