Bug 1255914 - Part 2: mostly back out multiDex (changeset 6972bef6693c). r=sebastian draft
authorNick Alexander <nalexander@mozilla.com>
Sun, 13 Nov 2016 14:43:00 -0800
changeset 442131 cdfb01a47dc05dfafc4ba67cdb30f86dbd5aa4ec
parent 442130 dfc0f983f56ceb5907f9aafcb37d2ac63d50988b
child 537705 be6d5ed0db09ff1e47651f3f4d42ba871104dab0
push id36592
push usernalexander@mozilla.com
push dateMon, 21 Nov 2016 20:02:36 +0000
reviewerssebastian
bugs1255914
milestone53.0a1
Bug 1255914 - Part 2: mostly back out multiDex (changeset 6972bef6693c). r=sebastian Since we're Proguarding the automation build now, we shouldn't need to multiDex anymore -- even in beta. MozReview-Commit-ID: 6Yc73Vi9Fhd
mobile/android/app/build.gradle
mobile/android/base/AppConstants.java.in
mobile/android/base/java/org/mozilla/gecko/GeckoApplication.java
--- a/mobile/android/app/build.gradle
+++ b/mobile/android/app/build.gradle
@@ -76,40 +76,26 @@ android {
         // For API 21+ - with multi dex, this will be faster for local development.
         local {
             // For multi dex, setting `minSdkVersion 21` allows the Android gradle plugin to
             // pre-DEX each module and produce an APK that can be tested on
             // Android Lollipop without time consuming DEX merging processes.
             minSdkVersion 21
             dexOptions {
                 preDexLibraries true
-                // We only call `MultiDex.install()` for the automation build flavor
-                // so this may not work. However, I don't think the multidex support
-                // library is necessary for 21+, so I expect that it will work.
                 multiDexEnabled true
             }
         }
         // For API < 21 - does not support multi dex because local development
         // is slow in that case. Most builds will not require multi dex so this
         // should not be an issue.
         localOld {
         }
         // Automation builds.
         automation {
-            dexOptions {
-                // As of FF48 on beta, the "test", "lint", etc. treeherder jobs fail because they
-                // exceed the method limit. Beta includes Adjust and its GPS dependencies, which
-                // increase the method count & explain the failures. Furthermore, this error only
-                // occurs on debug builds because we don't proguard.
-                //
-                // We enable multidex as an easy, quick-fix with minimal side effects but before we
-                // move to gradle for our production builds, we should re-evaluate this decision
-                // (bug 1286677).
-                multiDexEnabled true
-            }
         }
     }
 
     sourceSets {
         main {
             manifest.srcFile "${project.buildDir}/generated/source/preprocessed_manifest/AndroidManifest.xml"
 
             aidl {
@@ -214,18 +200,16 @@ android {
             // we have tests that start test servers and the bound ports
             // collide.  We'll fix this soon to have much faster test cycles.
             maxParallelForks 1
         }
     }
 }
 
 dependencies {
-    compile 'com.android.support:multidex:1.0.0'
-
     compile "com.android.support:support-v4:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}"
     compile "com.android.support:appcompat-v7:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}"
     compile "com.android.support:cardview-v7:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}"
     compile "com.android.support:recyclerview-v7:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}"
     compile "com.android.support:design:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}"
     compile "com.android.support:customtabs:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}"
     compile "com.android.support:palette-v7:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}"
 
--- a/mobile/android/base/AppConstants.java.in
+++ b/mobile/android/base/AppConstants.java.in
@@ -1,21 +1,17 @@
 //#filter substitution
 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 package org.mozilla.gecko;
 
-import android.content.Context;
 import android.os.Build;
-//#ifdef MOZ_BUILD_MOBILE_ANDROID_WITH_GRADLE
-import android.support.multidex.MultiDex;
-//#endif
 
 /**
  * A collection of constants that pertain to the build and runtime state of the
  * application. Typically these are sourced from build-time definitions (see
  * Makefile.in). This is a Java-side substitute for nsIXULAppInfo, amongst
  * other things.
  *
  * See also SysInfo.java, which includes some of the values available from
@@ -318,32 +314,15 @@ public class AppConstants {
     true;
 //#else
     false;
 //#endif
 
     // (bug 1266820) Temporarily disabled since no one is working on it.
     public static final boolean SCREENSHOTS_IN_BOOKMARKS_ENABLED = false;
 
-    /**
-     * Enables multidex depending on build flags. For more information,
-     * see `multiDexEnabled true` in mobile/android/app/build.gradle.
-     *
-     * As a method, this shouldn't be in AppConstants, but it's
-     * the only semi-relevant Java file that we pre-process.
-     */
-    public static void maybeInstallMultiDex(final Context context) {
-//#ifdef MOZ_BUILD_MOBILE_ANDROID_WITH_GRADLE
-        if (BuildConfig.FLAVOR.equals("automation")) {
-            MultiDex.install(context);
-        }
-//#else
-        // Do nothing.
-//#endif
-    }
-
     public static final boolean MOZ_ANDROID_ACTIVITY_STREAM =
 //#ifdef MOZ_ANDROID_ACTIVITY_STREAM
         true;
 //#else
         false;
 //#endif
 }
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoApplication.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoApplication.java
@@ -142,22 +142,16 @@ public class GeckoApplication extends Ap
 
         GeckoBatteryManager.getInstance().start(this);
         GeckoNetworkManager.getInstance().start(this);
 
         mInBackground = false;
     }
 
     @Override
-    protected void attachBaseContext(Context base) {
-        super.attachBaseContext(base);
-        AppConstants.maybeInstallMultiDex(base);
-    }
-
-    @Override
     public void onCreate() {
         Log.i(LOG_TAG, "zerdatime " + SystemClock.uptimeMillis() + " - Fennec application start");
 
         mRefWatcher = LeakCanary.install(this);
 
         final Context context = getApplicationContext();
         GeckoAppShell.setApplicationContext(context);
         HardwareUtils.init(context);