0

App's installation and operation was working fine but after upgrading to latest android 3.0 when I installed the app again to device it's showing the following error while crashing.

Can anyone please help me to resolve this error.

Error in Logcat:

java.lang.RuntimeException: Unable to get provider android.support.v4.content.FileProvider: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.content.FileProvider" on path: DexPathList[[zip file "/data/app/community.infinity-1.apk"],nativeLibraryDirectories=[/data/app-lib/community.infinity-1, /vendor/lib, /system/lib, /system/lib/arm]]
                                                 at android.app.ActivityThread.installProvider(ActivityThread.java:5029)
                                                 at android.app.ActivityThread.installContentProviders(ActivityThread.java:4621)
                                                 at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4561)
                                                 at android.app.ActivityThread.access$1500(ActivityThread.java:139)
                                                 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1353)
                                                 at android.os.Handler.dispatchMessage(Handler.java:102)
                                                 at android.os.Looper.loop(Looper.java:149)
                                                 at android.app.ActivityThread.main(ActivityThread.java:5257)
                                                 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:793)
                                                 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
                                                 at dalvik.system.NativeStart.main(Native Method)
                                              Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.content.FileProvider" on path: DexPathList[[zip file "/data/app/community.infinity-1.apk"],nativeLibraryDirectories=[/data/app-lib/community.infinity-1, /vendor/lib, /system/lib, /system/lib/arm]]
                                                 at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
                                                 at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
                                                 at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
                                                 at android.app.ActivityThread.installProvider(ActivityThread.java:5014)
                                                 at android.app.ActivityThread.installContentProviders(ActivityThread.java:4621) 
                                                 at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4561) 
                                                 at android.app.ActivityThread.access$1500(ActivityThread.java:139) 
                                                 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1353) 
                                                 at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                 at android.os.Looper.loop(Looper.java:149) 
                                                 at android.app.ActivityThread.main(ActivityThread.java:5257) 
                                                 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:793) 
                                                 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609) 
                                                 at dalvik.system.NativeStart.main(Native Method) 

Manifest.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:anroid="http://schemas.android.com/apk/res-auto"
package="community.infinity">
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
    android:configChanges="orientation|screenSize"
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme"
    >
    <activity android:name=".Login_Page"
        android:screenOrientation="portrait"
         >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".Home_Screen"
        android:screenOrientation="portrait"
        />
    <activity android:name=".ProfileHolder"
        android:screenOrientation="portrait"/>
</application>

Zoe
  • 27,060
  • 21
  • 118
  • 148

4 Answers4

0

Could you please disable the Instant Run option in your Android Studio. Select File -> Settings -> Build, Execution, Deployment -> Instant Run.Try cleaning your project and rebuild and run the application.

Aditi
  • 389
  • 4
  • 13
0

Update your android SDK. Goto SDK standalone manager and in Extras tab there is Android Support Library if this is installed update that otherwise install that. Also update your build.gradle file and there in buildToolsVersion "here write suitable version" for android 3.0 update your gradle version accordingly to android 3.0.

Android plugin 3.0.0 requires Gradle version 4.1 or higher. If you're opening an existing project using Android Studio 3.0 or later, follow the prompts to automatically update an existing project to the compatible version of Gradle.

This will solve your issue :) Happy coding :)

Muhammad Saad Rafique
  • 3,158
  • 1
  • 13
  • 21
0

I had the same problem. If cleaning and rebuilding your project won't help, open your Build.Grade file and search for dependencies that may causing the problem. In my case it was a custom vertical seekbar widget that was causing the crash. If none above works, check these answers: Dex error On Android Studio 3.0 Beta4

gooler
  • 1
  • 1
0

Finally after a lot of research I solved my problem by adding android:name="android.support.multidex.MultiDexApplication" to manifest.xml and by enabling the multiDex in build.gradle

defaultConfig { .... multiDexEnabled true }