diff --git a/tables_app/build.gradle b/tables_app/build.gradle index 5db5e89b..94501fe0 100644 --- a/tables_app/build.gradle +++ b/tables_app/build.gradle @@ -29,6 +29,8 @@ android { testApplicationId(groupId + tablesName + testNameSuffix) testInstrumentationRunner(instrumentationRunner) + + multiDexEnabled true } flavorDimensions "stage", "testing" @@ -134,6 +136,8 @@ dependencies { transitive =true; } + implementation 'androidx.multidex:multidex:2.0.1' + if (libraryProjectPath.exists() && gradle.useLocal) { // Local project is favoured implementation project(libraryProjectName) } else { diff --git a/tables_app/src/main/java/org/opendatakit/tables/application/Tables.java b/tables_app/src/main/java/org/opendatakit/tables/application/Tables.java index afb32077..11c74c8f 100644 --- a/tables_app/src/main/java/org/opendatakit/tables/application/Tables.java +++ b/tables_app/src/main/java/org/opendatakit/tables/application/Tables.java @@ -14,6 +14,10 @@ package org.opendatakit.tables.application; +import android.content.Context; + +import androidx.multidex.MultiDex; + import com.crashlytics.android.Crashlytics; import com.google.firebase.analytics.FirebaseAnalytics; import io.fabric.sdk.android.Fabric; @@ -44,6 +48,13 @@ public static Tables getInstance() { return ref.get(); } + @Override + protected void attachBaseContext(Context base) { + super.attachBaseContext(base); + MultiDex.install(this); + } + + @Override public int getApkDisplayNameResourceId() { return R.string.app_name; diff --git a/tables_app/src/main/java/org/opendatakit/tables/preferences/DefaultViewTypePreference.java b/tables_app/src/main/java/org/opendatakit/tables/preferences/DefaultViewTypePreference.java index 22c6bb5e..86145d11 100644 --- a/tables_app/src/main/java/org/opendatakit/tables/preferences/DefaultViewTypePreference.java +++ b/tables_app/src/main/java/org/opendatakit/tables/preferences/DefaultViewTypePreference.java @@ -58,9 +58,9 @@ public class DefaultViewTypePreference extends ListPreference { */ public DefaultViewTypePreference(Context context, AttributeSet attrs) { super(context, attrs); - mContext = ((ContextThemeWrapper) context).getBaseContext(); - if (mContext instanceof IAppAwareActivity) { - mAppName = ((IAppAwareActivity) mContext).getAppName(); + if (context instanceof IAppAwareActivity) { + mContext = context; + mAppName = ((IAppAwareActivity) context).getAppName(); } else { throw new IllegalArgumentException("Must be in an activity that knows the app name"); }