baksmali反编译出现:UNEXPECTED TOP-LEVEL ERROR:....Too many open files
Posted yangykaifa
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了baksmali反编译出现:UNEXPECTED TOP-LEVEL ERROR:....Too many open files相关的知识,希望对你有一定的参考价值。
解包大型apk文件,可能会出现例如以下错误,
UNEXPECTED TOP-LEVEL ERROR:
java.util.concurrent.ExecutionException: java.io.FileNotFoundException/./Contacts/com/google/common/base/Optional$1.smali (Too many open files)
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:188)
at org.jf.smali.main.main(main.java:219)
Caused by: java.io.FileNotFoundException:/./Contacts/com/google/common/base/Optional$1.smali (Too many open files)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:146)
at java.io.FileInputStream.<init>(FileInputStream.java:101)
at org.jf.smali.main.assembleSmaliFile(main.java:268)
at org.jf.smali.main.access$000(main.java:56)
at org.jf.smali.main$1.call(main.java:210)
at org.jf.smali.main$1.call(main.java:208)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
这是因为Linux文件数限制导致的错误.
能够使用Ulimit -a查看:
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 20
file size (blocks, -f) unlimited
pending signals (-i) 16382
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) unlimited
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
解决办法就是提高这个上限数,切换到root账户,运行ulimit -n 4096
然后就在root以下运行baksmali就能够.
假设在root下没有java环境,仅仅要source一下java环境设置就能够了.比如我的环境设置文件为:
---------------setup.sh------------------------------
JAVA_HOME=/opt/jdk1.7.0_71
export JAVA_HOME
android_JAVA_HOME=/opt/jdk1.7.0_71
export ANDROID_JAVA_HOME
PATH=/opt/jdk1.7.0_71/binPATH
export PATH
仅仅须要source setup.sh就能够了,这是由于仅仅要离开root账户,或者重开terminal, ulimit的设置就无效了.
以上是关于baksmali反编译出现:UNEXPECTED TOP-LEVEL ERROR:....Too many open files的主要内容,如果未能解决你的问题,请参考以下文章
微信小程序反编译报SyntaxError: Unexpected token ‘}‘ 不完美的解决方法