APK加固(加壳)问题

兰卡威 2016-11-15 09:55:23
使用加壳的方式对apk进行加固,demo没有问题,但是demo中apk是没有逻辑代码,application中更是什么都没有的,所以没有实际意义。然后就用应用市场上下载的apk来加壳(反编译成功证明该apk为被加壳)当然了,我替换apk也替换了相关的一些代码,包名,资源,Manifest(不知道还需不需要什么)。替换apk后就会出现问题,多为空指针,问题都是出在启动源程序application时。

Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.ImageView.startAnimation(android.view.animation.Animation)' on a null object reference
at com.xxx.ActivityWelcome.createView(ActivityWelcome.java:77)
at com.xxx.ActivityWelcome.onCreate(ActivityWelcome.java:63)
at android.app.Activity.performCreate(Activity.java:6068)

由于加壳的apk都是网上下载的,所以也没有源代码,只有反编译后的代码。下面是报错地点的代码片段

private void createView()
{
this.ll_load = ((LinearLayout)findViewById(2131624309));
this.iv_load = ((ImageView)findViewById(2131624310));
this.tv_load = ((TextView)findViewById(2131624311));
this.tv_info = ((TextView)findViewById(2131624048));
this.animation = AnimationUtils.loadAnimation(this.mCont
this.iv_load.startAnimation(this.animation);
this.local_version = Util.getVersionName(this.mContext);



上面是其中一个错误日志,另外还有报findViewById的,等等。感觉问题应该是我漏掉了什么东西导致的.

加壳方式参考博客http://blog.csdn.net/jiangwei0910410003/article/details/48415225

加壳demo地址http://download.csdn.net/detail/jiangwei0910410003/9102741

望高手指点一二,谢谢!
...全文
323 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
兰卡威 2016-11-16
  • 打赏
  • 举报
回复
引用 4 楼 u013268154 的回复:
private void createView() { this.ll_load = ((LinearLayout)findViewById(2131624309)); this.iv_load = ((ImageView)findViewById(2131624310)); this.tv_load = ((TextView)findViewById(2131624311)); this.tv_info = ((TextView)findViewById(2131624048)); this.animation = AnimationUtils.loadAnimation(this.mCont this.iv_load.startAnimation(this.animation); this.local_version = Util.getVersionName(this.mContext); 你这个createView方法中findID的代码放在onCreate中试试
这个代码是反编译的市场上的APK,我没法改代码呀,我现在发现问题是在imageview身上,我自己写的加固的demo是可以运行并且加固的,但是如果添加一个imageview并在代码中使用,就会报错。而把imageview换成textview,其他代码不变则不会有问题。不知道imageview为什么会在动态加载的act中报错
  • 打赏
  • 举报
回复
private void createView() { this.ll_load = ((LinearLayout)findViewById(2131624309)); this.iv_load = ((ImageView)findViewById(2131624310)); this.tv_load = ((TextView)findViewById(2131624311)); this.tv_info = ((TextView)findViewById(2131624048)); this.animation = AnimationUtils.loadAnimation(this.mCont this.iv_load.startAnimation(this.animation); this.local_version = Util.getVersionName(this.mContext); 你这个createView方法中findID的代码放在onCreate中试试
  • 打赏
  • 举报
回复
在你启动的动画的代码前面判断一下你含有那个Imageview的Activity的对象是否存在。
兰卡威 2016-11-16
  • 打赏
  • 举报
回复
发现问题为动态加载activity导致,动态加载的activity中含有动画就会报错。请问有高手遇到过吗,能帮忙解答如果解决吗
_周星星 2016-11-15
  • 打赏
  • 举报
回复
我们都是 用第三方进行加固 例如爱加密 360 百度都是可以的

80,351

社区成员

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

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