Cómo reparar el error de Android 4.4.2 ClassNotFoundException: No se encontró la clase "com.google.firebase.provider.FirebaseInitProvider" en la ruta: DexPathList
android-4.4-kitkat (2)
AndroidRuntime: FATAL EXCEPTION: main
Process: com.info.app, PID: 24503
java.lang.RuntimeException: Unable to get provider com.google.firebase.provider.FirebaseInitProvider: java.lang.ClassNotFoundException: Didn''t find class "com.google.firebase.provider.FirebaseInitProvider" on path: DexPathList[[zip file "/data/app/com.info.app-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.info.app-1, /vendor/lib, /system/lib]]
at android.app.ActivityThread.installProvider(ActivityThread.java:5236)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4827)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4710)
at android.app.ActivityThread.access$1600(ActivityThread.java:174)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1367)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5593)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn''t find class "com.google.firebase.provider.FirebaseInitProvider" on path: DexPathList[[zip file "/data/app/com.info.app-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.info.app-1, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:67)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
at android.app.ActivityThread.installProvider(ActivityThread.java:5221)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4827)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4710)
at android.app.ActivityThread.access$1600(ActivityThread.java:174)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1367)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5593)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)
build.gradle:
buildscript {
repositories {
maven { url ''https://maven.fabric.io/public'' }
}
dependencies {
classpath ''io.fabric.tools:gradle:1.+''
}
}
apply plugin: ''com.android.application''
apply plugin: ''io.fabric''
repositories {
mavenCentral()
maven() {
url "https://oss.sonatype.org/content/repositories/snapshots"
}
maven { url ''https://maven.fabric.io/public'' }
}
android {
dexOptions {
javaMaxHeapSize "4g"
}
compileSdkVersion 25
buildToolsVersion ''25.0.1''
defaultConfig {
// Enabling multidex support.
multiDexEnabled true
applicationId "com.info.app"
minSdkVersion 17
targetSdkVersion 25
versionCode 16
versionName "1.0.12"
testInstrumentationRunner ''android.support.test.runner.AndroidJUnitRunner''
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile(''proguard-android.txt''), ''proguard-rules.pro''
debuggable false
signingConfig signingConfigs.config
}
debug {
debuggable true
signingConfig signingConfigs.config
}
}
packagingOptions {
exclude ''META-INF/LICENSE.txt''
exclude ''META-INF/NOTICE.txt''
exclude ''META-INF/LICENSE''
exclude ''META-INF/NOTICE''
}
}
dependencies {
compile fileTree(include: [''*.jar''], dir: ''libs'')
compile project('':CustomBrowser-release'')
compile project('':PayU-release'')
compile project('':sdkui'')
compile(''com.github.worker8:tourguide:1.0.17-SNAPSHOT@aar'') {
transitive = true
}
compile(''com.twitter.sdk.android:twitter:2.3.2@aar'') {
transitive = true;
}
compile(''com.crashlytics.sdk.android:crashlytics:2.6.8@aar'') {
transitive = true;
}
compile ''com.intuit.sdp:sdp-android:1.0.4''
compile ''com.android.support:appcompat-v7:25.0.1''
compile ''com.android.support:cardview-v7:25.0.1''
compile ''com.android.support:design:25.0.1''
compile ''com.android.support:multidex:1.0.1''
compile ''com.nostra13.universalimageloader:universal-image-loader:1.9.5''
compile ''com.soundcloud.android:android-crop:1.0.1@aar''
compile ''com.mcxiaoke.volley:library:1.0.19''
compile ''com.google.code.gson:gson:2.2.4''
compile ''com.amulyakhare:com.amulyakhare.textdrawable:1.0.1''
compile ''de.hdodenhof:circleimageview:2.0.0''
compile ''com.google.android.gms:play-services:10.2.4''
compile ''com.facebook.android:facebook-android-sdk:4.15.0''
compile ''com.google.firebase:firebase-messaging:10.2.4''
compile ''com.nononsenseapps:filepicker:3.1.0''
compile ''com.ufreedom.uikit:FloatingViewLib:1.0.2''
compile ''com.github.paolorotolo:appintro:4.1.0''
compile ''com.google.firebase:firebase-crash:10.2.4''
compile ''com.google.firebase:firebase-appindexing:10.2.4''
compile ''com.stripe:stripe-android:3.1.1''
compile ''com.braintreepayments:card-form:3.0.5''
compile ''com.daimajia.numberprogressbar:library:1.4@aar''
testCompile ''junit:junit:4.12''
}
apply plugin: ''com.google.gms.google-services''
MyApplication.java:
public class MyApplication extends Application {
@Override
public void onCreate() {
MultiDex.install(getApplicationContext());
super.onCreate();
androidmanifest.xml:
<application
android:name=".MyApplication"
android:allowBackup="true"
android:hardwareAccelerated="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:largeHeap="true"
android:supportsRtl="true"
android:theme="@style/MyMaterialTheme">
Lamentablemente, solo la aplicación detuvo Android por debajo de 4.4.
Último archivo de registro:
06-17 16:50:36.955 586-586/? I/SELinux: Function: selinux_android_load_priority [0], There is no sepolicy file.
06-17 16:50:37.005 586-586/? I/SELinux: Function: selinux_android_load_priority , spota verifySig and checkHash pass. priority version is VE=SEPF_GT-I9192_4.4.2_0055
06-17 16:50:37.005 586-586/? I/SELinux: selinux_android_seapp_context_reload: seapp_contexts file is loaded from /data/security/spota/seapp_contexts
06-17 16:50:37.005 586-586/? E/dalvikvm: >>>>> Normal User
06-17 16:50:37.005 586-586/? E/dalvikvm: >>>>> com.info.app [ userId:0 | appId:10286 ]
06-17 16:50:37.005 586-586/? D/dalvikvm: Late-enabling CheckJNI
06-17 16:50:37.415 586-586/com.info.app D/AndroidRuntime: Shutting down VM
06-17 16:50:37.415 586-586/com.info.app W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x41ea2da0)
06-17 16:50:37.415 586-586/com.info.app E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.info.app, PID: 586
java.lang.RuntimeException: Unable to get provider com.google.firebase.provider.FirebaseInitProvider: java.lang.ClassNotFoundException: Didn''t find class "com.google.firebase.provider.FirebaseInitProvider" on path: DexPathList[[zip file "/data/app/com.info.app-3.apk"],nativeLibraryDirectories=[/data/app-lib/com.info.app-3, /vendor/lib, /system/lib]]
at android.app.ActivityThread.installProvider(ActivityThread.java:5236)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4827)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4710)
at android.app.ActivityThread.access$1600(ActivityThread.java:174)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1367)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5593)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn''t find class "com.google.firebase.provider.FirebaseInitProvider" on path: DexPathList[[zip file "/data/app/com.info.app-3.apk"],nativeLibraryDirectories=[/data/app-lib/com.info.app-3, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:67)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
at android.app.ActivityThread.installProvider(ActivityThread.java:5221)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4827)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4710)
at android.app.ActivityThread.access$1600(ActivityThread.java:174)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1367)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5593)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)
agregue esto a build.gradle, no se requiere multidex mientras no necesite la función multidex
dexOptions {
preDexLibraries = false
}
Nota: Si su proyecto está configurado para multidex con minSdkVersion 20 o inferior, y lo implementa en dispositivos de destino que ejecutan Android 4.4 (nivel de API 20) o inferior, Android Studio deshabilita Instant Run.
Cuando se ejecuta en versiones anteriores a Android 5.0 (nivel 21 de API) , el uso de multidex no es suficiente para evitar el límite de linearalloc (problema 78035). Este límite se incrementó en Android 4.0 (API nivel 14) , pero eso no lo resolvió por completo. Y en versiones inferiores a Android 4.0, puede alcanzar el límite de linearalloc antes de alcanzar el límite de índice DEX. Entonces, si está apuntando a niveles de API inferiores a 14, pruebe a fondo en esas versiones de la plataforma, porque su aplicación podría tener problemas al inicio o cuando se cargan grupos particulares de clases. La reducción del código puede reducir o posiblemente eliminar estos problemas.
Tienes demasiados métodos. Solo puede haber 65536 métodos para dex.
Entonces, habilite multidex de la siguiente manera:
android {
defaultConfig {
// Enabling multidex support.
multiDexEnabled true
}
}
dependencies {
compile ''com.android.support:multidex:1.0.0''
}
crear una clase como esta
public class Multi_Dex extends Application {
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}
ahora en su archivo más múltiple agregue esto
<application
android:name=".Multi_Dex"
android:allowBackup="true"
android:icon="@drawable/logo"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
para resolver este problema, como se describe en este enlace: developer.android.com/studio/build/multidex
o prueba esto mi amigo para kitkat o versión inferior
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''
}