How to Fix Android 4.4.2 Error Classnotfoundexception: Didn't Find Class "Com.Google.Firebase.Provider.Firebaseinitprovider" on Path: Dexpathlist

How to fix android 4.4.2 error ClassNotFoundException: Didn't find class com.google.firebase.provider.FirebaseInitProvider on path: DexPathList

Note: If your project is configured for multidex with minSdkVersion 20 or lower, and you deploy to target devices running Android 4.4 (API level 20) or lower, Android Studio disables Instant Run.

When running on versions prior to Android 5.0 (API level 21), using multidex is not enough to work around the linearalloc limit (issue 78035). This limit was increased in Android 4.0 (API level 14), but that did not solve it completely. And on versions lower than Android 4.0, you might reach the linearalloc limit before reaching the DEX index limit. So if you are targeting API levels lower than 14, test thoroughly on those versions of the platform, because your app might have issues at startup or when particular groups of classes are loaded. Code shrinking can reduce or possibly eliminate these issues.

You have too many methods. There can only be 65536 methods for dex.

So, enable multidex as following:

android {    
defaultConfig {
// Enabling multidex support.
multiDexEnabled true
}
}
dependencies {
compile 'com.android.support:multidex:1.0.0'
}

create one class like this

public class Multi_Dex extends Application {
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}

now in your manifiest file add this

<application
android:name=".Multi_Dex"
android:allowBackup="true"
android:icon="@drawable/logo"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">

to solve this problem s, like described on this link : developer.android.com/studio/build/multidex

or try this my friend for kitkat or lower version

android {
defaultConfig {
...
multiDexEnabled true
}
productFlavors {
dev {
// Enable pre-dexing to produce an APK that can be tested on
// Android 5.0+ without the time-consuming DEX build processes.
minSdkVersion 21
}
prod {
// The actual minSdkVersion for the production version.
minSdkVersion 14
}
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
compile 'com.android.support:multidex:1.0.1'
}

com.google.firebase.provider.FirebaseInitProvider: java.lang.ClassNotFoundException:com.google.firebase.provider.FirebaseInitProvider

This dependency includes the code for all of the Google Play Services APIs:

compile 'com.google.android.gms:play-services:9.0.0'

This is very likely causing your app to exceed the 65K method reference limit, requiring you to use Multidex to run on pre-Lollipop devices.

You have two choices. You can include only the Play Services APIs you actually need. The list is here in the section titled Selectively compiling APIs into your executable. Or you can enable Multidex following the instructions here. Although you have multiDexEnabled true in your build.gradle file, that is only one of the three steps required to configure Multidex. You also need to include the library as a dependency and update your manifest.

If you are using Android Studio 2.2.2, you can see how many method references are in your app using the APK Analyzer. From the menubar, select Build > Analyze APK. The APK is in folder .../app/build/outputs/apk. Select the APK file, and in the resulting window, click on classes.dex to see the number of methods and method references.

Unable to get provider com.google.firebase.provider.FirebaseInitProvider Error path Android

I have also faced same problem with Firebase when run application below API 19(< 4.4.2) devices due to error of Multidex. Then below solution work for me:

In app module build.gradle

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

dependencies {
// add dependency
compile 'com.android.support:multidex:1.0.1'
}

// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'

update name in AndroidManifest.xml

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:name=".MyApplication"
android:theme="@style/AppTheme">

// ...
</application>

Crate a MyApplication.java file

public class MyApplication extends Application {

@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}

}

Getting ClassNotFoundException in runtime, unable to find activity in dexpathlist

Use this

compileSdkVersion "26.0.0"
buildToolsVersion "26.0.0"

instead of this

compileSdkVersion 25
buildToolsVersion "26.0.0"

flutter - crash on Xiaomi Device running on Android 4.4 (Kitkat) - Firebase Error

Short answer :
Make the APK file with command : flutter build apk --target-platform=android-arm

Long Answer :
The problem is with the device's processor type. In the Android world, there are 7 different processor types (mips, mips64, X86, X86–64, armeabi, arm64-v8a, armeabi-v7a). The standard flutter build apk command doesn't produce an universal file.

I think you've problem with armeabi processor which uses ARM based architecture.

To solve this issue, you'll have to make a specific APK to support the device (family). And to do it, you might want to use following command :

flutter build apk --target-platform=android-arm

Does this mean you'll have two different versions of APK for the same app ? Yes.

Here is more information and here is Google's official document.

Android NoClassDefFoundError on android 4.4.2

You can find the answer for this question here:

  1. NoClassDefFoundError with Android Studio on Android 4
  2. https://developer.android.com/studio/build/multidex


Related Topics



Leave a reply



Submit