diff options
-rw-r--r-- | dx/src/com/android/dx/command/dexer/Main.java | 5 | ||||
-rw-r--r-- | dx/src/com/android/dx/dex/file/DexFile.java | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/dx/src/com/android/dx/command/dexer/Main.java b/dx/src/com/android/dx/command/dexer/Main.java index 406e2673b..c5f9c94f6 100644 --- a/dx/src/com/android/dx/command/dexer/Main.java +++ b/dx/src/com/android/dx/command/dexer/Main.java @@ -712,7 +712,10 @@ public class Main { int maxFieldIdsInDex = numFieldIds + constantPoolSize + cf.getFields().size() + MAX_FIELD_ADDED_DURING_DEX_CREATION; - if (args.multiDex && ((maxMethodIdsInDex > args.maxNumberOfIdxPerDex) || + if (args.multiDex + // Never switch to the next dex if current dex is already empty + && (outputDex.getClassDefs().items().size() > 0) + && ((maxMethodIdsInDex > args.maxNumberOfIdxPerDex) || (maxFieldIdsInDex > args.maxNumberOfIdxPerDex))) { DexFile completeDex = outputDex; createDexFile(); diff --git a/dx/src/com/android/dx/dex/file/DexFile.java b/dx/src/com/android/dx/dex/file/DexFile.java index 01a5e4b50..103985ce5 100644 --- a/dx/src/com/android/dx/dex/file/DexFile.java +++ b/dx/src/com/android/dx/dex/file/DexFile.java @@ -323,7 +323,7 @@ public final class DexFile { * * @return {@code non-null;} the class definitions section */ - /*package*/ ClassDefsSection getClassDefs() { + public ClassDefsSection getClassDefs() { return classDefs; } |