Cannot fit requested classes in a single dex file
Cannot fit requested classes in a single dex file

Cannot fit requested classes in a single dex file (# methods: 70738 > 65536)","sources":[{}],"tool":"D8"}

> Task :app:mergeDexDebug FAILED
AGPBI: {"kind":"error","text":"Cannot fit requested classes in a single dex file (# methods: 70738 > 65536)","sources":[{}],"tool":"D8"}
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:131)
at com.android.builder.dexing.D8DexArchiveMerger.mergeDexArchives(D8DexArchiveMerger.java:118)
at com.android.build.gradle.internal.transforms.DexMergerTransformCallable.call(DexMergerTransformCallable.java:102)
at com.android.build.gradle.internal.tasks.DexMergingTaskRunnable.run(DexMergingTask.kt:444)

How to solve:
dependencies {
    ...
    implementation 'com.android.installreferrer:installreferrer:1.1'
}

and to Manifest add this

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
   
package="com.example.myapp">
   
<application
           
android:name="android.support.multidex.MultiDexApplication" >
        ...
   
</application>
</manifest>

example apk here: http://bit.ly/multiplicationtables