Apktool编译出现“error: Public symbol aaa/bbb declared here is not defined.”的解决办法
2015-01-15 11:37
1361 查看
在用Apktool反编译一个应用的时候正常,没做任何修改,但是在回编译的时候出现了大量的“error: Public symbol aaa/bbb declared here is not defined.”这种错误,费了一些功夫搜了不少答案,终于把问题解决了。
首先贴一下apktool官网上的FAQ:
"error: Public symbol aaa/bbb declared here is not defined."
Usually this isn't an issue by itself, but it's a symptom of other issue. It's general error which may be caused by various specific ones. If you are building an application and there is an error in one of files, this file is ignored and building procedure
goes on. Then you get plenty of above errors cause of missing files.
Just look above these errors, there you should find another, real ones. This is general rule for reading error messages: earlier messages are always more important, they might cause later ones.
If error messages are bigger than console/window buffer, so you can't read first lines of output, you will have to increase buffer size. Search for this in console properties.
大致意思就是要找到第一个出现错误的地方,后边的那一系列错误都是由第一个错误引起的。因为Ubuntu的控制台没办法一下子容纳那么多的错误信息,会把前边的报错信息冲掉,所以要把错误信息重定向到一个文件里。控制台里输入 apktool b XXXX 2>errlog.txt 就可以把报错信息打印到这个errlog.txt文件中了。
打开errlog.txt文件,前两行的报错信息大概是:
libpng error: Not a PNG file
ERROR: Failure processing PNG image /res/drawable/XXXX.png
因为应用不同,所以第二条信息会有一些偏差,但大意就是res文件夹下某个png文件不是合法png文件。
用file命令查看这个png文件,发现这其实并不是png格式,比如我遇到的这个图片信息就是 share_er_icon.png: JPEG image data, JFIF standard 1.01, comment: "CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), quality = 70" 。因为Apktool在回编译的时候会先检查是否是png后缀的文件,所有png后缀文件都会按png文件进行重打包处理,这样对于实际上不是png格式的文件来说,肯定会出错,所以把后缀名改成本来的样子就好了,比如我遇到的这个图片后缀名改成jpg就可以成功打包了。
首先贴一下apktool官网上的FAQ:
"error: Public symbol aaa/bbb declared here is not defined."
Usually this isn't an issue by itself, but it's a symptom of other issue. It's general error which may be caused by various specific ones. If you are building an application and there is an error in one of files, this file is ignored and building procedure
goes on. Then you get plenty of above errors cause of missing files.
Just look above these errors, there you should find another, real ones. This is general rule for reading error messages: earlier messages are always more important, they might cause later ones.
If error messages are bigger than console/window buffer, so you can't read first lines of output, you will have to increase buffer size. Search for this in console properties.
大致意思就是要找到第一个出现错误的地方,后边的那一系列错误都是由第一个错误引起的。因为Ubuntu的控制台没办法一下子容纳那么多的错误信息,会把前边的报错信息冲掉,所以要把错误信息重定向到一个文件里。控制台里输入 apktool b XXXX 2>errlog.txt 就可以把报错信息打印到这个errlog.txt文件中了。
打开errlog.txt文件,前两行的报错信息大概是:
libpng error: Not a PNG file
ERROR: Failure processing PNG image /res/drawable/XXXX.png
因为应用不同,所以第二条信息会有一些偏差,但大意就是res文件夹下某个png文件不是合法png文件。
用file命令查看这个png文件,发现这其实并不是png格式,比如我遇到的这个图片信息就是 share_er_icon.png: JPEG image data, JFIF standard 1.01, comment: "CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), quality = 70" 。因为Apktool在回编译的时候会先检查是否是png后缀的文件,所有png后缀文件都会按png文件进行重打包处理,这样对于实际上不是png格式的文件来说,肯定会出错,所以把后缀名改成本来的样子就好了,比如我遇到的这个图片后缀名改成jpg就可以成功打包了。
相关文章推荐
- html-webpack-plugin2.22.0、Webpack与gulp结合时出现ReferenceError: window is not defined错误的解决办法
- Chrome调试JS报错“Uncaught ReferenceError: xl_chrome_menu is not defined”的解决办法
- 编译时出现fatal error C1853: "debug/xxx.pch" is not a precomplied header file with......错误的原因及解决办法(转)
- jQuery 关于Uncaught ReferenceError: $ is not defined 错误的解决办法
- 使用ec编译cocos项目是出现Android.mk文件报错Are you sure your NDK_MODULE_PATH variable is properly defined 的解决办法
- Python编译时提示“NameError: name 'Popen' is not defined”及”NameError: name 'PIPE' is not defined“错误的解决
- 获取jQuery对象 Uncaught ReferenceError: jQuery is not defined(…) 的解决办法
- Uncaught ReferenceError: $ is not defined 错误的解决办法
- MPI编译C++程序出现#error "SEEK_SET is #defined but must not be for the C++ binding of MPI" 的解决方法
- javascript报错:ReferenceError: $ is not defined解决办法
- Chrome调试JS报错“Uncaught ReferenceError: xl_chrome_menu is not defined”的解决办法
- 用ccs编译文件后出现如下错误: error: symbol _USER10_ISR is defined multiple times: D:\CCStudio_v3.1\MyProjects\BL
- ueditor Uncaught ReferenceError: errorHandler is not defined解决办法
- Chrome调试JS报错“Uncaught ReferenceError: xl_chrome_menu is not defined”的解决办法
- Android在编译和反编译时出现error: Error: String types not allowed错误的解决办法
- JavaEE项目导入eclipse后出现红叉或者Target runtime Apache Tomcat v7.0 is not defined.等的解决办法
- Python 出现错误TypeError: ‘NoneType’ object is not iterable解决办法
- zookeeper 集群启动时 出现 Error contacting service. It is probably not running 的解决办法
- MNIST-NameError: name ‘input_data’ is not defined解决办法
- ASP.NET在调用js方法时出现Uncaught ReferenceError:PageMethods is not defined的解决方法