Baksmali anti-compilation appears: unexpected top-level error: .... Too Many open files

Source: Internet
Author: User

Unpacking a large apk file, you may receive the following error,

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)


This is due to a limitation of the number of Linux files.

You can use Ulimit-a to view:
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 (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
The solution is to increase the maximum number, switch to the root account, execute ulimit-n 4096
Then you can execute Baksmali under root.
If you do not have a Java environment under root, just source the Java environment settings. For example, my environment settings file is:
---------------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
Only the source setup.sh is required, because the Ulimit setting is invalid if you leave the root account or re-open the terminal.

Baksmali anti-compilation appears: unexpected top-level error: .... Too Many open files

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.