android: Enable multidex, update com.google.android.material to 1.7.0

Release notes:
https://github.com/material-components/material-components-android/releases/tag/1.7.0

With the material update in place, multidex needs to be enabled since the
app has minSdkVersion 16 (i.e. smaller than 21) and now references
more then 65,536 methods, see [1] for more background.

Therefore, carry out the changes to support multidex
as mentioned in [2].

Without enabling multidex, the build would fail like this:

    > Task :mergeExtDexStrippedUIDebug FAILED
    ERROR:D8: Cannot fit requested classes in a single dex file (# methods: 68864 > 65536)
    com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
    The number of method references in a .dex file cannot exceed 64K.
    Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html
            at com.android.builder.dexing.D8DexArchiveMerger.getExceptionToRethrow(D8DexArchiveMerger.java:151)
            at com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:138)
            at com.android.build.gradle.internal.tasks.DexMergingWorkAction.merge(DexMergingTask.kt:859)
            at com.android.build.gradle.internal.tasks.DexMergingWorkAction.run(DexMergingTask.kt:805)
            at com.android.build.gradle.internal.profile.ProfileAwareWorkAction.execute(ProfileAwareWorkAction.kt:74)
            at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:63)
            at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.create(NoIsolationWorkerFactory.java:66)
            at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.create(NoIsolationWorkerFactory.java:62)
            at org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:97)
            at org.gradle.workers.internal.NoIsolationWorkerFactory$1.lambda$execute$0(NoIsolationWorkerFactory.java:62)
            at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:44)
            at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:41)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
            at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
            at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
            at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)
            at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:73)
            at org.gradle.workers.internal.AbstractWorker.executeWrappedInBuildOperation(AbstractWorker.java:41)
            at org.gradle.workers.internal.NoIsolationWorkerFactory$1.execute(NoIsolationWorkerFactory.java:59)
            at org.gradle.workers.internal.DefaultWorkerExecutor.lambda$submitWork$2(DefaultWorkerExecutor.java:205)
            at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
            at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runExecution(DefaultConditionalExecutionQueue.java:187)
            at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.access$700(DefaultConditionalExecutionQueue.java:120)
            at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner$1.run(DefaultConditionalExecutionQueue.java:162)
            at org.gradle.internal.Factories$1.create(Factories.java:31)
            at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:270)
            at org.gradle.internal.work.DefaultWorkerLeaseService.runAsWorkerThread(DefaultWorkerLeaseService.java:119)
            at org.gradle.internal.work.DefaultWorkerLeaseService.runAsWorkerThread(DefaultWorkerLeaseService.java:124)
            at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runBatch(DefaultConditionalExecutionQueue.java:157)
            at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.run(DefaultConditionalExecutionQueue.java:126)
            at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
            at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)

[1] https://developer.android.com/studio/build/multidex
[2] https://developer.android.com/studio/build/multidex#mdex-gradle

Change-Id: Ie5d78a54e7f69b55586d80718c04e71526ebad6f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144838
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
This commit is contained in:
Michael Weghorn 2022-12-27 12:51:54 +01:00
parent e690752d56
commit 037680488b
2 changed files with 7 additions and 3 deletions

View file

@ -26,8 +26,9 @@ dependencies {
"libreoffice.jar",
"unoloader.jar"
])
implementation 'com.google.android.material:material:1.6.1'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation "androidx.multidex:multidex:2.0.1"
}
android {
@ -49,6 +50,9 @@ android {
defaultConfig {
minSdkVersion 16
targetSdkVersion 33
// multidex needed when > 65,536 methods referenced with minSdKVersion < 21
// s. https://developer.android.com/studio/build/multidex
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
}
buildTypes {

View file

@ -10,11 +10,11 @@
package org.libreoffice;
import android.app.Application;
import android.content.Context;
import android.os.Handler;
import androidx.multidex.MultiDexApplication;
public class LibreOfficeApplication extends Application {
public class LibreOfficeApplication extends MultiDexApplication {
private static Handler mainHandler;