生成我的 apk 后,我aapt dump badging
对其执行命令。我不断收到以下错误:
application: label='Name' icon='res/drawable/icon_128x128.png'
application-debuggable launchable-activity: name='co.package.name.MainActivity' label='Name' icon='' 错误获取'android: name' 属性:属性不是字符串值
我尝试为所有活动添加标签名称并删除 /res 下的所有其他 values-xxx 文件夹,但徒劳无功。但是,如果我创建一个全新的项目并生成一个新的 APK,则可以使用该aapt dump badging
命令成功执行该 APK。
我比较了两个 APK 的打印信息,发现了一个主要区别:
成功消息 apk:
application-label:'AppLabel'
application-icon-160:'res/drawable-xhdpi/icon_128x128.png'
application-icon-240:'res/drawable-xhdpi/icon_128x128.png'
application-icon-320:'res/ drawable-xhdpi/icon_128x128.png'
application: label='AppLabel' icon='res/drawable-xhdpi/icon_128x128.png'
application-debuggable launchable
-activity: name='com.demo.testApp.MainActivity' label=''图标='
APK 失败消息:
application-label:'MyApp'
application-label-ja:'MyApp'
application-label-de:'MyApp'
application-label-he:'MyApp'
application-label-zh:'MyApp'
application-label-fi:' MyApp'
application-label-nl:'MyApp'
..
.. (所有语言都会附加,最后出现错误)
..
application: label='MyApp' icon='res/drawable/icon_128x128.png'
application-可调试
的可启动活动:name='com.name.myapp.MainActivity' label='MyApp' icon=''
错误获取 'android:name' 属性:属性不是字符串值
----- 编辑 ------
我发现与“语言”问题无关。我修改了我的 Manifest 文件并确保没有打印出这样的“application-label-XX”,并且错误仍然相同。
下面是我的清单文件
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="co.package.name"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<supports-screens android:anyDensity="true" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<!-- Location -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<!-- Camera -->
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-feature
android:name="android.hardware.camera"
android:required="true" />
<uses-feature
android:name="android.hardware.camera.front"
android:required="false" />
<uses-feature
android:name="android.hardware.camera.autofocus"
android:required="false" />
<!-- GCM Necessary -->
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<permission
android:name="co.package.name.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="co.package.name.permission.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<!-- Calendar R/W -->
<uses-permission android:name="android.permission.READ_CALENDAR" />
<uses-permission android:name="android.permission.WRITE_CALENDAR" />
<application
android:allowBackup="true"
android:icon="@drawable/icon_128x128"
android:label="@string/app_name"
>
<!-- GCM meta-data -->
<meta-data
android:name="com.arrownock.push.SERVICE_TYPE"
android:value="GCM" />
<meta-data
android:name="com.arrownock.push.gcm.SENDER_ID"
android:value="@string/gcm_project_id" />
<meta-data
android:name="com.arrownock.push.APP_KEY"
android:value="@string/light_appkey" />
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="@string/fb_id" />
<activity
android:name=".Main"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="co.package.name.SplashHP"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
</activity>
<activity
android:name="co.package.name.SettingsHP"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
<intent-filter>
<action android:name="android.intent.action.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="co.package.name.LocationSelect"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
<intent-filter>
<action android:name="android.intent.action.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="co.package.name.SettingOptionAlarm"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
</activity>
<activity
android:name="co.package.name.SettingOptionNotify"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
</activity>
<activity
android:name="co.package.name.SettingOptionShare"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="settingshare"
android:scheme="oauth" />
</intent-filter>
</activity>
<activity
android:name="co.package.name.HpCalendar"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
</activity>
<activity
android:name="co.package.name.SMSList"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
</activity>
<activity
android:name="co.package.name.SMSEditor"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
</activity>
<activity
android:name="co.package.name.SMSChooseToSend"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
</activity>
<activity
android:name="co.package.name.ShareToFB"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
</activity>
<activity
android:name="co.package.name.ActPOI"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
</activity>
<activity
android:name="com.facebook.LoginActivity"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
</activity>
<activity
android:name="co.package.name.LogInOutFB"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
</activity>
<activity
android:name="co.package.name.LoginTwitter"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="t4jsample"
android:scheme="oauth" />
</intent-filter>
</activity>
<receiver
android:name="co.package.name.AlarmReceiver"
android:exported="true" >
<intent-filter>
<action android:name="@string/action_alarm" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<!-- GCM Service -->
<receiver
android:name="com.arrownock.push.AnPushGCMReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="co.package.name" />
</intent-filter>
</receiver>
<service android:name="com.arrownock.push.GCMIntentService" />
<receiver
android:name="co.package.name.ExtendedReceiver"
android:exported="true"
android:icon="@drawable/icon_128x128"
android:label="Receiver" >
<intent-filter>
<action android:name="com.arrownock.push.PushService.MSG_ARRIVAL" />
</intent-filter>
</receiver>
</application>
</manifest>
也许我的清单文件中有错误的格式或拼写错误?
------ 编辑----
我也认为这可能是解码的问题。在我的环境中,我使用 utf-8。在将 XML 转换为二进制文件的构建过程中可能有问题?
如果上面有任何不合理的嫌疑人,我真诚地道歉。我在这个问题上坚持了三天,真的无法取得进展。尝试了很多东西,错误总是一样的。任何建议或评论将不胜感激。