Please help from going to mad

I build an android project it shows error NoClassDefFoundError.

I put below lines in Multi-dex-config.pro file.

keep class com.google.firebase.**{*;}
keep class com.google.android.gms.** { *; }
keep class com.ustaadthehandyman.user.activities**{*;}</i>

After build again it shows error Cannot fit requested classes in the main-dex file (# methods: 67808 > 65536)

After edit Multi-dex-config.pro file like below

keep class com.google.firebase.provider**{*;}
keep class com.google.android.gms.provider** { *; }
keep class com.ustaadthehandyman.user.activities**{*;}</i>

It show another error NoClassDefFoundError in another class

I is any automated way to put required class in main dex file.

Please help me

thank you in advance.

1 Answers

0
Xavier Rubio Jansana On

I think you're confusing Proguard/R8 (e.g. minification) with multidex. Better use the later, and disable Proguard minification (its harder to get it right).

See Enable multidex for apps with over 64K methods in the Android Documentation site.

Specifically, add the following if your minSdkVersion is 21+:

android {
    defaultConfig {
        ...
        multiDexEnabled true
    }
    ...
}

If your app is below API 21 see the linked page for additional information.