首页
社区
课程
招聘
[原创]apktool2.0.0rc3解决打包资源错误方法之一
2015-1-19 19:30 19551

[原创]apktool2.0.0rc3解决打包资源错误方法之一

2015-1-19 19:30
19551
在分析apk时,apktool2.0.0rc3反编译成功,但重新打包出错如下:
I: Checking whether sources has changed...
I: Smaling smali folder into classes.dex...
I: Checking whether resources has changed...
I: Building resources...

\res\values-v19\styles.xml:11: error: Error: No resource found that matches the given name: attr 'android:actionModeFindDrawable'.
\res\values-v19\styles.xml:10: error: Error: No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
\res\values-v19\styles.xml:21: error: Error: No resource found that matches the given name: attr 'android:actionModeFindDrawable'.
\res\values-v19\styles.xml:20: error: Error: No resource found that matches the given name: attr 'android:actionModeShareDrawable'.

Exception in thread "main" brut.androlib.AndrolibException: brut.androlib.AndrolibException: brut.common.BrutException:
could not exec command: .....
        at brut.androlib.Androlib.buildResourcesFull(Androlib.java:437)
        at brut.androlib.Androlib.buildResources(Androlib.java:374)
        at brut.androlib.Androlib.build(Androlib.java:277)
        at brut.androlib.Androlib.build(Androlib.java:250)
        at brut.apktool.Main.cmdBuild(Main.java:225)
        at brut.apktool.Main.main(Main.java:84)
Caused by: brut.androlib.AndrolibException: brut.common.BrutException: could not
exec command: .....
        at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.jav
a:488)
        at brut.androlib.Androlib.buildResourcesFull(Androlib.java:423)
        ... 5 more
Caused by: .....
        at brut.util.OS.exec(OS.java:89)
        at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.jav
a:482)
        ... 6 more

打开提示的文件
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="ptt_invisible" parent="@style/ptt">
        <item name="android:windowBackground">@android:color/transparent</item>
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowIsTranslucent">true</item>
        <item name="android:windowContentOverlay">@null</item>
        <item name="android:windowAnimationStyle">@android:style/Animation</item>
        <item name="android:colorBackgroundCacheHint">@null</item>
        <item name="android:actionModeFindDrawable">true</item>
        <item name="android:actionModeShareDrawable">true</item>
    </style>
    <style name="ptt_light_invisible" parent="@style/ptt_light">
        <item name="android:windowBackground">@android:color/transparent</item>
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowIsTranslucent">true</item>
        <item name="android:windowContentOverlay">@null</item>
        <item name="android:windowAnimationStyle">@android:style/Animation</item>
        <item name="android:colorBackgroundCacheHint">@null</item>
        <item name="android:actionModeFindDrawable">true</item>
        <item name="android:actionModeShareDrawable">true</item>
    </style>
</resources>

既然提示无法识别资源标识,那尝试删除看看。

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="ptt_invisible" parent="@style/ptt">
        <item name="android:windowBackground">@android:color/transparent</item>
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowIsTranslucent">true</item>
        <item name="android:windowContentOverlay">@null</item>
        <item name="android:windowAnimationStyle">@android:style/Animation</item>
        <item name="android:colorBackgroundCacheHint">@null</item>
    </style>
    <style name="ptt_light_invisible" parent="@style/ptt_light">
        <item name="android:windowBackground">@android:color/transparent</item>
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowIsTranslucent">true</item>
        <item name="android:windowContentOverlay">@null</item>
        <item name="android:windowAnimationStyle">@android:style/Animation</item>
        <item name="android:colorBackgroundCacheHint">@null</item>
    </style>
</resources>

重新打包成功。

完全没有技术含量,只是说明了一个问题,碰到apktool出错,不用慌,有的错误是很好解决的。

[培训]《安卓高级研修班(网课)》月薪三万计划,掌握调试、分析还原ollvm、vmp的方法,定制art虚拟机自动化脱壳的方法

收藏
点赞0
打赏
分享
最新回复 (13)
雪    币: 1413
活跃值: (401)
能力值: (RANK:270 )
在线值:
发帖
回帖
粉丝
Claud 6 2015-1-20 03:23
2
0
不同level的API问题吧,这样删除确实是一个办法,是不是还可以在apktool的时候指定api level?
雪    币: 3898
活跃值: (5485)
能力值: ( LV13,RANK:550 )
在线值:
发帖
回帖
粉丝
我是小三 11 2015-1-20 03:57
3
0
不错,以前总遇到这种问题。
雪    币: 427
活跃值: (59)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
pwelyn 2015-1-20 11:08
4
0
这种其实在反编译之前把C:\Users\xxxx\apktool\framework文件夹下面的1.apk删除也可以,因为apktool rc3已经采用了api21的framework.jar里面的arsc
雪    币: 163
活跃值: (1233)
能力值: ( LV5,RANK:60 )
在线值:
发帖
回帖
粉丝
学编程 1 2015-1-20 14:12
5
0
内置在apktool.jar吗?
雪    币: 427
活跃值: (59)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
pwelyn 2015-1-20 16:04
6
0
是的,在源码的这个目录:brut.apktool/apktool-lib/src/main/resources/brut/androlib/android-framework.jar

如果是apktool.jar就在:apktool.jar\brut\androlib\
雪    币: 163
活跃值: (1233)
能力值: ( LV5,RANK:60 )
在线值:
发帖
回帖
粉丝
学编程 1 2015-1-20 16:44
7
0
经过实践,删除C:\Users\用户名\apktool\framework\1.apk确实可行。
apktool会释放自己得版本到此目录
雪    币: 163
活跃值: (1233)
能力值: ( LV5,RANK:60 )
在线值:
发帖
回帖
粉丝
学编程 1 2015-1-20 17:02
8
0
补充 下,1.apk其实就是android-framework.jar
雪    币: 427
活跃值: (59)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
pwelyn 2015-1-20 17:09
9
0
对的 反编译时候apktool自己会释放1.apk按照你使用的apktool.jar里面的android-framework.jar释放
雪    币: 225
活跃值: (14)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
runapp 2015-1-20 17:39
10
0
一般不是应该直接拽出来自己手机上的android-framework.jar然后用aktool的install功能吗……
雪    币: 427
活跃值: (59)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
pwelyn 2015-1-20 18:22
11
0
你说的是系统自带的app在反编译的时候需要if 系统自带的framework-res.apk文件,如果非系统app就是apktool自带的
雪    币: 163
活跃值: (1233)
能力值: ( LV5,RANK:60 )
在线值:
发帖
回帖
粉丝
学编程 1 2015-1-21 09:54
12
0
涨知识了,还没有分析过自带的,所有系统自带的apk都要?
雪    币: 427
活跃值: (59)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
pwelyn 2015-1-21 15:13
13
0
只要是系统自带的系统应用 都需要if系统的框架,有的是一个有的是两个
雪    币: 105
活跃值: (196)
能力值: ( LV5,RANK:60 )
在线值:
发帖
回帖
粉丝
lcweik 1 2015-1-21 17:42
14
0
这个方法不完美,最佳的办法是从sdk里,把android.jar挖出来,覆盖掉个人目录下的apktool/1.apk文件。
游客
登录 | 注册 方可回帖
返回