soot-oss / soot

Soot - A Java optimization framework
GNU Lesser General Public License v2.1
2.84k stars 708 forks source link

New option: Ignore dex overflows #2048

Open beerphilipp opened 5 months ago

beerphilipp commented 5 months ago

This pull request addresses the issue where Soot fails to build large Android applications with a minSdkVersion < 22 due to the absence of multi-dex support for API versions < 22, resulting in Soot throwing a RuntimeException. Given that Android API versions >= 22 come with built-in multi-dex support, these applications would theoretically work on devices running newer Android versions.

To allow Soot users to build such APKs, this pull request introduces an option to explicitly ignore dex overflows. The option can be enabled by calling Options.v().set_ignore_dex_overflow(true).

An APK that results in such a RuntimeException is attached below. [Uploading com.mathgamesplayground.zip…]()

StevenArzt commented 5 months ago

Soot already checks whether the target APK targets the ART engine instead of Dalvik. In other words, if your target SDK version is large enough, this exception should not be thrown. I'm not sure that producing an APK with a low target SDK version but a requirement on ART's multidex support is a good idea.

Additionally, the options Java file is generated from the options XML. Any code changes will be overwritten. If you want to introduce a new option value, you need to put it into the XML.