"Invalid attribute name" when cordova build android

1,314 views
Skip to first unread message

Steve Husting

unread,
Aug 3, 2015, 12:20:04 AM8/3/15
to phonegap
I decided to roll back to an earlier Cordova version to see if I can break through my console error from an Android app.

I rolled back from 5.1.1 to 5.0.0. When I do cordova build android, I get this pretty puzzle:

Error: Invalid attribute name

Line: 15

Column: 67

Char: 2

    at error (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/elementtree/node_modules/sax/lib/sax.js:347:8)

    at strictFail (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/elementtree/node_modules/sax/lib/sax.js:364:22)

    at Object.write (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/elementtree/node_modules/sax/lib/sax.js:876:16)

    at XMLParser.feed (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/elementtree/lib/parsers/sax.js:48:15)

    at ElementTree.parse (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/elementtree/lib/elementtree.js:263:10)

    at Object.exports.XML (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/elementtree/lib/elementtree.js:593:13)

    at Object.module.exports.parseElementtreeSync (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/util/xml-helpers.js:123:38)

    at ConfigFile_load [as load] (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/util/ConfigFile.js:69:33)

    at new ConfigFile (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/util/ConfigFile.js:48:10)

    at ConfigKeeper_get [as get] (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/util/ConfigKeeper.js:51:23)


I don't know what to make of it. Doesn't seem to have anything to do with my app, per se. 


My environment:

Using cordova 5.0.0 CLI

Mac OS X Yosemite 10.10.4

Building android

Not using any JS frameworks

Kerri Shotts

unread,
Aug 3, 2015, 12:29:03 AM8/3/15
to phonegap
What the...!?

I'd bet it's something off with the AndroidManifest.xml file or config.xml file. Care to share?

jcesarmobile

unread,
Aug 3, 2015, 2:05:54 AM8/3/15
to phonegap
Did you downgrade the project android version too? or just the CLI?

Steve Husting

unread,
Aug 3, 2015, 11:03:27 AM8/3/15
to phonegap
JCesar,
I have no idea how to downgrade android platform files (didn't occur to me to do so). I also don't know how to match up an android version with the cordova CLI version. Is this latter possible?

Kerri,
When I get back to my home system, I'll share.

Steve Husting

unread,
Aug 3, 2015, 9:08:54 PM8/3/15
to phonegap
Kerri,

AndroidManifest:

<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="130000" android:versionName="13.0.0" package="com.stevehusting.appname" xmlns:android="http://schemas.android.com/apk/res/android">
    <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <application android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name" android:supportsRtl="true">
        <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.Black.NoTitleBar" android:windowSoftInputMode="adjustResize">
            <intent-filter android:label="@string/launcher_name">
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
    <uses-sdk android:minSdkVersion="17 android:targetSdkVersion="22" />
</manifest>

config.xml:

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.stevehusting.appname" version="13.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>appname</name>
    <description>
        Pocket Hymnal - 395 hymns in your pocket!
    </description>
    <author email="" href="">
    </author>
    <content src="index.html" />
    <access origin="*" launch-external="yes" />
    <access origin="mailto:*" launch-external="yes" />
    <preference name="InAppBrowserStorageEnabled" value="true" />
    <preference name="keepRunning" value="false" />
    <preference name="SplashScreen" value="splash" />
    <preference name="SplashScreenDelay" value="2000" />
    <plugin name="cordova-plugin-device" spec="^1.0.0" />
    <plugin name="cordova-plugin-dialogs" spec="^1.1.0" />
    <plugin name="cordova-plugin-inappbrowser" spec="^1.0.0" />
    <plugin name="cordova-plugin-splashscreen" spec="^2.0.0" />
    <plugin name="cordova-plugin-vibration" spec="^1.1.0" />
    <platform name="android"> 
         <icon src="res/drawable-ldpi/icon.png" density="ldpi" />
         <icon src="res/drawable-mdpi/icon.png" density="mdpi" />
         <icon src="res/drawable-hdpi/icon.png" density="hdpi" />
         <icon src="res/drawable-xhdpi/icon.png" density="xhdpi" />
         <icon src="res/drawable-xxhdpi/icon.png" density="xxhdpi" />
    </platform>
</widget>

jcesarmobile

unread,
Aug 4, 2015, 2:27:44 AM8/4/15
to phonegap
Steve, to see the platform versions you are using, use this command

cordova platform version

As you downgraded the CLI but you don't downgraded the android platform version, there might be some inconsistencies

Try downgrading the android platform too, to the one that was included in the CLI you use now

cordova platform update android

Not sure if downgrading a platform is allowed

Steve Husting

unread,
Aug 7, 2015, 12:28:46 AM8/7/15
to phonegap
I reverted back. No dice. So I updated everything and tried cordova build android again. Got:

Error: Could not find gradle wrapper within android sdk. Might need to update your Android SDK.

Looked here: /Users/Steve/Developer/android-sdk-mac_x86/tools/templates/gradle/wrapper


I looked in that location and there is was no /templates under /tools. I'm using Android Studio and had just updated it before this message. 


cordova -v = 5.1.1

cordova platform version android = android 4.0.2


Wow. Just wow.

Reply all
Reply to author
Forward
0 new messages