From e1478b5fdcddbe21a725248c65f514bffaefd1f7 Mon Sep 17 00:00:00 2001 From: Philipp Beer Date: Thu, 8 Feb 2024 13:46:41 +0100 Subject: [PATCH] Added switch to ignore dex overflows --- src/main/generated/options/soot/options/Options.java | 11 ++++++++++- src/main/java/soot/toDex/MultiDexBuilder.java | 5 ++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/main/generated/options/soot/options/Options.java b/src/main/generated/options/soot/options/Options.java index 560a71a052e..9e5e250b1e2 100644 --- a/src/main/generated/options/soot/options/Options.java +++ b/src/main/generated/options/soot/options/Options.java @@ -1443,6 +1443,10 @@ else if (false || option.equals("no-writeout-body-releasing") ) no_writeout_body_releasing = true; + else if (false + || option.equals("ignore-dex-overflow") + ) + ignore_dex_overflow = true; else { G.v().out.println("Invalid option -" + option); return false; @@ -1842,6 +1846,10 @@ public List dynamic_package() { private boolean no_writeout_body_releasing = false; public void set_no_writeout_body_releasing(boolean setting) { no_writeout_body_releasing = setting; } + public boolean ignore_dex_overflow() { return ignore_dex_overflow; } + private boolean ignore_dex_overflow = false; + public void set_ignore_dex_overflow(boolean setting) { ignore_dex_overflow = setting; } + public String getUsage() { return "" + "\nGeneral Options:\n" @@ -1996,7 +2004,8 @@ public String getUsage() { + "\nMiscellaneous Options:\n" + padOpt("-time", "Report time required for transformations") + padOpt("-subtract-gc", "Subtract gc from time") - + padOpt("-no-writeout-body-releasing", "Disables the release of method bodies after writeout. This flag is used internally."); + + padOpt("-no-writeout-body-releasing", "Disables the release of method bodies after writeout. This flag is used internally.") + + padOpt("-ignore-dex-overflow", "Ignore DEX overflows"); } diff --git a/src/main/java/soot/toDex/MultiDexBuilder.java b/src/main/java/soot/toDex/MultiDexBuilder.java index bc6daab1cad..254f94e5929 100644 --- a/src/main/java/soot/toDex/MultiDexBuilder.java +++ b/src/main/java/soot/toDex/MultiDexBuilder.java @@ -32,6 +32,7 @@ import org.jf.dexlib2.iface.ClassDef; import org.jf.dexlib2.writer.io.FileDataStore; import org.jf.dexlib2.writer.pool.DexPool; +import soot.options.Options; /** * @author Manuel Benz created on 26.09.17 @@ -93,7 +94,9 @@ protected boolean hasOverflowed() { // (https://developer.android.com/studio/build/multidex.html, // http://www.fasteque.com/deep-dive-into-android-multidex/) if (!opcodes.isArt()) { - throw new RuntimeException("Dex file overflow. Splitting not support for pre Lollipop Android (Api 22)."); + if (!Options.v().ignore_dex_overflow()) { + throw new RuntimeException("Dex file overflow. Splitting not support for pre Lollipop Android (Api 22)."); + } } return true;