0
votes

Logs :

B E/AndroidRuntime: FATAL EXCEPTION: main Process: com.nova.app.check, PID: 28293 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.nova.app.check-2/base.apk"],nativeLibraryDirectories=[/data/app/com.nova.app.check-2/lib/x86, /system/lib, /vendor/lib]] at android.app.ActivityThread.installProvider(ActivityThread.java:5814) at android.app.ActivityThread.installContentProviders(ActivityThread.java:5403) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5342) at android.app.ActivityThread.-wrap2(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1528) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6077) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755) Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.provider.FirebaseInitProvider" on path: DexPathList[[zip file "/data/app/com.nova.app.check-2/base.apk"],nativeLibraryDirectories=[/data/app/com.nova.app.check-2/lib/x86, /system/lib, /vendor/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) at java.lang.ClassLoader.loadClass(ClassLoader.java:380) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at android.app.ActivityThread.installProvider(ActivityThread.java:5799) at android.app.ActivityThread.installContentProviders(ActivityThread.java:5403) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5342) at android.app.ActivityThread.-wrap2(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1528) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6077) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)

===

I have enabled the multidex in gradle, my application class is extends with the MultiDexApplication... I have implemented the support multidex library also.......

Once my application is installed successfully,The application starts to crash.

My build.gradle content

apply plugin: 'com.android.application'


android {
aaptOptions {
    cruncherEnabled = false
}

lintOptions {
    abortOnError false
}

repositories {
    mavenCentral()
}

compileSdkVersion 27
buildToolsVersion '27.0.3'
//buildToolsVersion "27.0.1"

defaultConfig {
    applicationId "com.nova.app.check"
    minSdkVersion 19
    targetSdkVersion 24
    multiDexEnabled true
    versionCode 17
    versionName "2.0.1"
    vectorDrawables.useSupportLibrary = true
    sourceSets.main {
        jniLibs.srcDir 'src/main/libs'
        jni.srcDirs = []

    }
    buildTypes {
        debug {
            //minifyEnabled true
            //shrinkResources true
            //proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }

        release {
            //minifyEnabled true
            //shrinkResources true
            //runProguard false
            //proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
        staging {
            // Specifies a sorted list of fallback build types that the
            // plugin should try to use when a dependency does not include a
            // "staging" build type. You may specify as many fallbacks as you
            // like, and the plugin selects the first build type that's
            // available in the dependency.
            matchingFallbacks = ['debug', 'qa', 'release']
        }
    }

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/ASL2.0'
        // exclude 'META-INF/json.tld'
    }

    useLibrary 'org.apache.http.legacy'


    dexOptions {
        javaMaxHeapSize "4g"
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_6
        targetCompatibility JavaVersion.VERSION_1_7
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')

    implementation files('libs/GraphView-3.0.jar')
    implementation files('libs/jWebSocketClientAPI-1.0.jar')
    implementation files('libs/jWebSocketCommon-1.0.jar')
    implementation files('libs/jWebSocketJavaSEClient-1.0.jar')
    implementation files('libs/jackson-core-asl-1.9.3.jar')
    implementation files('libs/jackson-mapper-asl-1.9.3.jar')
    implementation files('libs/mail.jar')
    //implementation files('libs/json-taglib-0.4.1.jar')
    implementation files('libs/org.apache.commons.io.jar')
    implementation files('libs/org.apache.http.legacy.jar')
    implementation files('libs/zip4j_1.3.1.jar')
    implementation files('libs/ImageLoader.jar')
    //implementation files('libs/itsrts-pptviewer.jar')
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.android.volley:volley:1.0.0'
    //noinspection GradleCompatible

    implementation 'com.android.support:customtabs:27.1.1'
    implementation 'com.android.support:support-annotations:27.0.3'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.android.support:design:27.1.1'
    implementation project(path: ':androidTest')
    implementation 'com.android.support:appcompat-v7:27.1.1'
    compile 'com.android.support:cardview-v7:27.1.1'
    compile 'com.android.support:recyclerview-v7:27.1.1'
    implementation 'com.android.support:support-v4:27.1.1'
    //implementation 'com.google.android.gms:play-services:12.0.1'
    //for qr code scanning
    implementation 'com.google.android.gms:play-services-vision:12.0.1'
    //implementation 'me.dm7.barcodescanner:zxing:1.9'
    // migrate from eclipse
    implementation 'com.google.android.gms:play-services-gcm:12.0.1'
    implementation 'com.google.android.gms:play-services-location:12.0.1'
    implementation 'com.google.android.gms:play-services-places:12.0.1'

    implementation files('libs/gcm-server.jar')
    implementation files('libs/OneSignalSDK.jar')

    //socket connection lib for remoteview
    implementation 'com.github.nkzawa:socket.io-client:0.6.0'
    implementation "com.squareup.okhttp3:okhttp:3.7.0"
    // custom fab
    implementation 'com.github.clans:fab:1.6.4'

    // butter knife
    implementation 'com.jakewharton:butterknife:8.8.1'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'

    //zoom imageView library
    implementation 'com.jsibbold:zoomage:1.1.0'

    //pdfviewer library
    implementation 'com.github.barteksc:android-pdf-viewer:2.8.2'

    // custom images
    //implementation 'com.linsea:universalvideoview:1.1.0@aar'

    //qr code scan
    compile 'com.journeyapps:zxing-android-embedded:3.4.0'

    //testing lib
}
}
dependencies {
implementation 'com.android.support.constraint:constraint-layout:+'
implementation 'com.android.support:support-annotations:28.0.0-alpha3'
}

Note : My base application is installed from the eclipse and now >i have upgraded this from the apk generated from studio. My application is a launcher application starts at the boot stage itself.

1
Goto: Build -> Clean Project -> Run it again - theboringdeveloper
Please add the content of your build.gradle file. - Alex Mamo
@GursheeshSingh I have tried clean build and rebuild also. - beginner
@AlexMamo I have updated my build.gradle file above - beginner
@beginner Have youalso tried to add apply plugin: 'com.google.gms.google-services' at the end of your file? - Alex Mamo

1 Answers

0
votes

Uncheck first

Settings → Build, Execution, Deployment → Instant Run and uncheck Enable Instant Run

Then add this code into your build.gradle in module: app inside defaultConfing:

defaultConfig {
    ....
    ....
    multiDexEnabled = true
}

Add this code into your build.gradle in module: app inside dependencies:

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

Open AndroidManifest.xml and within application:

<application
    android:name="android.support.multidex.MultiDexApplication"
    .....
    .....
</application>

or if you have your Application class, extend it from MultiDexApplication like:

 public class MyApp extends MultiDexApplication {
    .....
   }

Hope this may help to you