summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYohann Roussel <yroussel@google.com>2014-07-28 09:07:51 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-07-24 15:35:58 +0000
commit878445a703152fb52e92c159034b738582de9aee (patch)
tree09d4e73b3d9f61f8dd0acf3a3e6f625ebf347bad
parentdf00ef7c3e84761d72801e8c65af92ba67733362 (diff)
parent084b7f109aa96a86a267074f5464732b8062bd5a (diff)
downloadandroid_dalvik-878445a703152fb52e92c159034b738582de9aee.tar.gz
android_dalvik-878445a703152fb52e92c159034b738582de9aee.tar.bz2
android_dalvik-878445a703152fb52e92c159034b738582de9aee.zip
Merge "Do not generate empty dex in multidex." into lmp-dev
-rw-r--r--dx/src/com/android/dx/command/dexer/Main.java5
-rw-r--r--dx/src/com/android/dx/dex/file/DexFile.java2
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;
}