关于Launcher源码调试仿真的问题,非改包名吗?

中才德创 2015-04-03 02:44:58
一:这二者的区别,主要反映在AndroidManifest.xml
<!--普通的apk-->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

<!--Launcher的apk-->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.MONKEY" />
</intent-filter>


二:不知道为什么,adb remount了,新Launcher的apk,根本无法发布到机器上。旧的删除了,倒可以发布到机器了,但机器无法启动。试了System/app,data/app下存放也不管用。

三:总而言之,这个带android.intent.category.HOME属性的apk,要想实现调试,非改包名了。

四:改包名的方法:
1)项目环境菜单-》Android Tools-》Rename Application Package,将aaa.bbb.ccc修改成aaa.bbb.ccc2,按提示操作就行了。
2)删除AndroidManifest.xml里面的android:sharedUserId="android.uid.system"属性【若有的话】。
3)清除编译期错误,比如以下几行删除
<uses-permission android:name="android.permission.DELETE_PACKAGES" />
<uses-permission android:name="android.permission.INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />

4)清除运行期错误,比如以下1行删除
mEthernetManager.setEthernetEnabled(true);
5)此时可以Refresh/Clean/Run发布运行单步了。
6)改完代码,调试结束后,回到第1步,将aaa.bbb.ccc2修改成aaa.bbb.ccc。
7)此时,用比对工具,将代码修改合入。

五:除了改包名实现调试仿真这类apk,有没有更简洁的办法呢?
...全文
142 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

80,349

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧