1

),我尝试运行我的第一个 PhoneGap APP,并按照此页面上的步骤操作:

http://www.adobe.com/devnet/html5/articles/getting-started-with-phonegap-in-eclipse-for-android.html

看来我做的一切都很好,但是当我尝试在 Eclipse 上作为 Android 应用程序运行时,我收到以下错误:

[2013-01-21 13:13:02 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] C:\Users\Inaki\workspace\AppPrueba\AndroidManifest.xml 的解析器异常:元素提示“清单”debe ir seguido de una de estas especificaciones de atributo: ">" o "/>"。[2013-01-21 13:13:02 - AppPrueba] XML 文件中的错误:正在中止构建。

它是西班牙语,所以翻译基本上是说“清单”后面必须跟着“>”或“/>”。我做了教程中指定的清单修改,我想因为我不了解 XML,所以我一定搞砸了一些东西。这是我的清单:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.appprueba"
android:versionCode="1"
android:versionName="1.0" 
<supports-screens                        /*this line eclipse displays the error*/
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:resizeable="true"
android:anyDensity="true"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS/>
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
>

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="17" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:configChanges="orientation|keyboardHidden" 
        android:name="com.example.appprueba.MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity 
        android:name="org.apache.cordova.DroidGap" 
        android:label="@string/app_name" 
        android:configChanges="orientation|keyboardHidden"> 
        <intent-filter></intent-filter> 
    </activity>
</application>

</manifest>
4

2 回答 2

1

它应该如下所示:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.appprueba"
android:versionCode="1"
android:versionName="1.0" >

<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:resizeable="true"
android:anyDensity="true"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS/>
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.BROADCAST_STICKY" />

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="17" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:configChanges="orientation|keyboardHidden" 
        android:name="com.example.appprueba.MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity 
        android:name="org.apache.cordova.DroidGap" 
        android:label="@string/app_name" 
        android:configChanges="orientation|keyboardHidden"> 
        <intent-filter></intent-filter> 
    </activity>
</application>

</manifest>

supports-screens应该是清单内容的一部分,而不是作为某种清单属性。

于 2013-01-21T16:40:38.360 回答
0

对我来说,这是因为华为图书馆没有更新。看这里:更新 Gradle 到 7.0.2 后,元素类型“manifest”必须后跟任一属性规范,“>” 或“/>”错误

于 2021-12-29T11:09:36.620 回答