Android 2.3.3           Eclipse Version: 3.7.0           LogCat

Console 报错信息:

[2012-02-15 13:16:21 - tmall] ------------------------------[2012-02-15 13:16:21 - tmall] Android Launch![2012-02-15 13:16:21 - tmall] adb is running normally.[2012-02-15 13:16:21 - tmall] Performing com.taobao.htc.Start activity launch[2012-02-15 13:16:21 - tmall] Automatic Target Mode: using existing emulator 'emulator-5554' running compatible AVD 'nokia'[2012-02-15 13:16:21 - tmall] Uploading taobao.apk onto device 'emulator-5554'[2012-02-15 13:16:26 - tmall] Installing tmall.apk...[2012-02-15 13:16:29 - tmall] Installation error: INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION[2012-02-15 13:16:29 - tmall] Please check logcat output for more details.[2012-02-15 13:16:29 - tmall] Launch canceled!

发生错误原因分析:

安装解析失败,遇到未知错误。

分析AndroidManifest.xml,发现android:versionCode引用自定义资源

<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android"package="com.tmall.nokia" android:versionCode="@string/app_versionCode" android:versionName="@string/app_versionName">

在strings.xml中也有app_versionCode对应值

<?xml version="1.0" encoding="utf-8"?><resources><string name="app_versionCode">2</string>


在Eclipse中未提示错误。

根据在AndroidManifest.xml中直接配置versionCode值的经验,其应为整数,否则Eclipse报错。

error: Error: String types not allowed (at 'versionCode' with value 'a2.0').
error: Error: Float types not allowed (at 'versionCode' with value '2.0').
error: Error: Boolean types not allowed (at 'versionCode' with value 'false').

解决办法:

修改xml配置

<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android"package="com.tmall.nokia" android:versionCode="@integer/app_versionCode" android:versionName="@string/app_versionName">

<?xml version="1.0" encoding="utf-8"?><resources><integer name="app_versionCode">2</integer>

重新运行,通过。

不管是直接配置,还是使用引用资源,android:versionCode的值都只能是整数。

引用资源,一定要使用可用的数据类型。

PS:Eclipse的Problems并不是万能,不是所有错误都能提前提示。

更多相关文章

  1. android studio常见错误及异常处理记录
  2. android studio 错误总结
  3. Android 编译错误::app:transformClassesWithPreJackPackagedLib
  4. Android中drawable使用Shape资源
  5. Android各种资源详解
  6. android中资源整理
  7. Android中String资源文件的format方法
  8. Android 启动模拟器是出现“Failed to allocate memory: 8”错误

随机推荐

  1. Android调用相机相册并显示照片在ImageVi
  2. Android:监听WIFI网络状态
  3. What Android(安卓)Chipset Can Support
  4. Android(安卓)获取CPU架构(指令集)
  5. Android(安卓)使用广播(BroadcastReceiver
  6. Android(安卓)创建与解析XML(五)—— Dom4j
  7. Android(安卓)自定义seekbar
  8. Android(安卓)代码中实现返回键功能
  9. Android中ContextMenu的使用
  10. android 对话框总结