Skip to content

Commit 4335b23

Browse files
committed
Add multidex support
1 parent 09562f3 commit 4335b23

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

WordPress/build.gradle

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ android {
3737
minSdkVersion 16
3838
targetSdkVersion 24
3939

40+
multiDexEnabled true
4041
vectorDrawables.useSupportLibrary = true
4142
buildConfigField "boolean", "IN_APP_BILLING_AVAILABLE", "false"
4243
}
@@ -52,18 +53,20 @@ android {
5253
wasabi { // "hot" version, can be installed along release, alpha or beta versions
5354
buildConfigField "boolean", "IN_APP_BILLING_AVAILABLE", "true"
5455
applicationId "org.wordpress.android.beta"
56+
minSdkVersion 21 // to take advantage of "fast" multi dex (pre-dex each module)
5557
}
5658
}
5759

5860
buildTypes {
5961
release {
60-
// Proguard is only used to fix an issue with some Samsung device
61-
// https://github.com/wordpress-mobile/WordPress-Android/issues/2151
62+
// Proguard is used to shrink our apk, and reduce the number of methods in our final apk,
63+
// but we don't obfuscate the bytecode.
6264
minifyEnabled true
6365
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard.cfg'
6466
}
6567

6668
debug {
69+
minifyEnabled false
6770
buildConfigField "String", "APP_PN_KEY", "\"org.wordpress.android.debug.build\""
6871
ext.enableCrashlytics = false
6972
}
@@ -85,6 +88,7 @@ dependencies {
8588
}
8689
compile 'com.google.code.gson:gson:2.6.+'
8790
compile 'org.ccil.cowan.tagsoup:tagsoup:1.2.1'
91+
compile 'com.android.support:multidex:1.0.1'
8892
compile 'com.android.support:support-v13:24.0.0'
8993
compile 'com.android.support:appcompat-v7:24.0.0'
9094
compile 'com.android.support:cardview-v7:24.0.0'

WordPress/src/main/java/org/wordpress/android/WordPress.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
import android.os.Bundle;
1414
import android.os.StrictMode;
1515
import android.os.SystemClock;
16+
import android.support.multidex.MultiDex;
17+
import android.support.multidex.MultiDexApplication;
1618
import android.text.TextUtils;
1719
import android.util.AndroidRuntimeException;
1820
import android.webkit.WebSettings;
@@ -88,7 +90,7 @@
8890
import de.greenrobot.event.EventBus;
8991
import io.fabric.sdk.android.Fabric;
9092

91-
public class WordPress extends Application {
93+
public class WordPress extends MultiDexApplication {
9294
public static String versionName;
9395
public static Blog currentBlog;
9496
public static WordPressDB wpDB;
@@ -109,8 +111,13 @@ public class WordPress extends Application {
109111
private static Context mContext;
110112
private static BitmapLruCache mBitmapCache;
111113

114+
protected void attachBaseContext(Context base) {
115+
super.attachBaseContext(base);
116+
MultiDex.install(this);
117+
}
118+
112119
/**
113-
* Updates Options for the current blog in background.
120+
* Updates Options for the current blog in background.
114121
*/
115122
public static RateLimitedTask sUpdateCurrentBlogOption = new RateLimitedTask(SECONDS_BETWEEN_OPTIONS_UPDATE) {
116123
protected boolean run() {

0 commit comments

Comments
 (0)