我想在他們的開發人員站點上的示例中使用我的Android應用程序中的C2DM。不過,我不斷收到 「安裝錯誤:INSTALL_PARSE_FAILED_MANIFEST_MALFORMED」 嘗試啓動我的應用程序時:C2DM permission.C2D_MESSAGE給出安裝錯誤
[2011-06-01 9時19分09秒 - xVoice]安裝錯誤:INSTALL_PARSE_FAILED_MANIFEST_MALFORMED [2011-06-01 09:19: 09 - xVoice]請查看logcat輸出瞭解更多詳情。 [2011-06-01 09:19:09 - xVoice]發佈取消!
而且logcat中給了我以下警告: 9月6日至1日:18:47.882:WARN/PackageParser(2488):/data/app/vmdl46038.tmp(在二進制XML文件中的行#8):錯誤的類名Telenet.xVoice.permission.C2D_MESSAGE包Telenet.xVoice
任何人都可以看到問題是什麼?
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="Telenet.xVoice"
android:versionCode="1"
android:versionName="1.0">
<!-- Only this application can receive the messages and registration result -->
<permission android:name="Telenet.xVoice.permission.C2D_MESSAGE" android:protectionLevel="signature"/>
<uses-permission android:name="Telenet.xVoice.permission.C2D_MESSAGE" />
<!-- This app has permission to register and receive message -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission>
<uses-sdk android:minSdkVersion="8"></uses-sdk>
<application android:label="@string/app_name" android:icon="@drawable/logo" android:name="xVoiceApp">
<activity android:name=".xVoice" android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver android:name=".xVoiceAppWidgetProvider" android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
<action android:name="android.net.wifi.STATE_CHANGE" />
<action android:name="android.net.wifi.supplicant.CONNECTION_CHANGE" />
<action android:name="android.net.wifi.WIFI_STATE_CHANGED" />
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.HOME"/>
</intent-filter>
<!-- Receive the actual message -->
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="Telenet.xVoice" />
</intent-filter>
<!-- Receive the registration id -->
<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="Telenet.xVoice" />
</intent-filter>
<meta-data android:name="android.appwidget.provider" android:resource="@xml/xvoice_appwidgetprovider_info" />
</receiver>
<activity android:name=".xVoicemail"></activity>
<activity android:name=".xCallLog"></activity>
<activity android:name=".xConfiguration"></activity>
<activity android:name=".xVoiceIncomming" android:theme="@android:style/Theme.Dialog" android:noHistory="true" ></activity>
<service android:name=".xVoiceService" />
</application>
</manifest>
在生成的代碼,我發現下面的類:
/* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package Telenet.xVoice;
public final class Manifest {
public static final class permission {
/** Only this application can receive the messages and registration result
*/
public static final String C2D_MESSAGE="Telenet.xVoice.permission.C2D_MESSAGE";
}
}
我發現了我的問題的原因。 似乎是,如果你用大寫字母 開始你的包名稱,例如, package =「Telenet.xVoice」 權限的類構建器返回錯誤。 至少在Android 2.2中。 由於Google允許我註冊C2DM的軟件包名稱,在我看來這似乎是一個錯誤。 – Gert 2011-06-01 11:09:07