naima
naima

Reputation: 129

Didn't find class "com.example.App" on path: DexPathList

I have this strange error I do not know how to resolve. I test my App in my phone samsung j5 (Marshmellow) and it's working ok. But now i'm testing it in samsung j3 (lollipop) the app crash as startup and the error is this one:

10-02 22:28:59.426 4395-4395/com.example.sony.snapcamera E/AndroidRuntime: FATAL EXCEPTION: main
                                                                           Process: com.example.sony.snapcamera, PID: 4395
                                                                           java.lang.RuntimeException: Unable to instantiate application com.example.sony.snapcamera.App: java.lang.ClassNotFoundException: Didn't find class "com.example.sony.snapcamera.App" on path: DexPathList[[zip file "/data/app/com.example.sony.snapcamera-1/base.apk"],nativeLibraryDirectories=[/data/app/com.example.sony.snapcamera-1/lib/arm, /vendor/lib, /system/lib]]
                                                                               at android.app.LoadedApk.makeApplication(LoadedApk.java:661)
                                                                               at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6002)
                                                                               at android.app.ActivityThread.access$1700(ActivityThread.java:218)
                                                                               at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1795)
                                                                               at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                               at android.os.Looper.loop(Looper.java:145)
                                                                               at android.app.ActivityThread.main(ActivityThread.java:6934)
                                                                               at java.lang.reflect.Method.invoke(Native Method)
                                                                               at java.lang.reflect.Method.invoke(Method.java:372)
                                                                               at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
                                                                               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
                                                                            Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.sony.snapcamera.App" on path: DexPathList[[zip file "/data/app/com.example.sony.snapcamera-1/base.apk"],nativeLibraryDirectories=[/data/app/com.example.sony.snapcamera-1/lib/arm, /vendor/lib, /system/lib]]
                                                                               at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
                                                                               at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
                                                                               at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
                                                                               at android.app.Instrumentation.newApplication(Instrumentation.java:1003)
                                                                               at android.app.LoadedApk.makeApplication(LoadedApk.java:651)
                                                                               at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6002) 
                                                                               at android.app.ActivityThread.access$1700(ActivityThread.java:218) 
                                                                               at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1795) 
                                                                               at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                               at android.os.Looper.loop(Looper.java:145) 
                                                                               at android.app.ActivityThread.main(ActivityThread.java:6934) 
                                                                               at java.lang.reflect.Method.invoke(Native Method) 
                                                                               at java.lang.reflect.Method.invoke(Method.java:372) 
                                                                               at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404) 
                                                                               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199) 
                                                                            Suppressed: java.lang.NoClassDefFoundError: com.example.sony.snapcamera.App
                                                                               at dalvik.system.DexFile.defineClassNative(Native Method)
                                                                               at dalvik.system.DexFile.defineClass(DexFile.java:226)
                                                                               at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:219)
                                                                               at dalvik.system.DexPathList.findClass(DexPathList.java:321)
                                                                               at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)
                                                                                    ... 14 more
                                                                            Suppressed: java.lang.ClassNotFoundException: com.example.sony.snapcamera.App
                                                                               at java.lang.Class.classForName(Native Method)
                                                                               at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
                                                                               at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
                                                                               at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
                                                                                    ... 13 more
                                                                            Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

This is my AndroidManifest :

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.sony.snapcamera">
.....
<application
        android:name="com.example.sony.snapcamera.App"
        android:allowBackup="true"
        android:hardwareAccelerated="true"
        android:icon="@mipmap/App_icon"
        android:label="@string/app_name"
        android:largeHeap="true"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"

        >
...

This is my App class :

package com.example.sony.snapcamera;

import android.app.Application;
import android.content.Context;


import com.adobe.creativesdk.foundation.AdobeCSDKFoundation;
import com.adobe.creativesdk.foundation.auth.IAdobeAuthClientCredentials;
import com.bumptech.glide.request.target.ViewTarget;




public class App extends Application implements IAdobeAuthClientCredentials {

    /* Be sure to fill in the two strings below. */
private static final String CREATIVE_SDK_CLIENT_ID      = "";
private static final String CREATIVE_SDK_CLIENT_SECRET  = "";
private static final String CREATIVE_SDK_REDIRECT_URI   = "";
private static final String[] CREATIVE_SDK_SCOPES       = {"email", "profile", "address"};

@Override
public void onCreate() {
        super.onCreate();
        ViewTarget.setTagId(R.id.glide_tag);
        AdobeCSDKFoundation.initializeCSDKFoundation(getApplicationContext());

        }


@Override
public String getClientID() {
        return CREATIVE_SDK_CLIENT_ID;
        }

@Override
public String getClientSecret() {
        return CREATIVE_SDK_CLIENT_SECRET;
        }

@Override
public String[] getAdditionalScopesList() {
        return CREATIVE_SDK_SCOPES;
        }

@Override
public String getRedirectURI() {
        return CREATIVE_SDK_REDIRECT_URI;
        }
        }

Here it is my app gradle :

apply plugin: 'com.android.application'

apply plugin: 'me.tatarka.retrolambda'

android {
    configurations.all {
        resolutionStrategy.force 'com.google.code.findbugs:jsr305:3.0.1'
    }
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.example.sony.snapcamera"
        minSdkVersion 21
        targetSdkVersion 25
        multiDexEnabled true
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        manifestPlaceholders = [appPackageName: "${applicationId}"]

    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    packagingOptions {
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/DEPENDENCIES'
        pickFirst 'AndroidManifest.xml'
    }
    dexOptions {
        jumboMode true
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })



    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'de.hdodenhof:circleimageview:2.1.0'
    compile 'com.android.support:cardview-v7:25.3.1'
    compile 'com.makeramen:roundedimageview:2.2.1'
    compile 'com.github.XunMengWinter:CircularAnim:0.3.4'
    compile 'com.android.support:recyclerview-v7:25.3.1'
    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile 'com.github.zomato:androidphotofilters:1.0.1'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.android.support:design:25.3.1'
    compile 'com.github.chrisbanes:PhotoView:1.3.1'
    compile 'com.writingminds:FFmpegAndroid:0.3.2'
    compile 'com.google.firebase:firebase-database:11.4.0'


    compile 'com.google.android.gms:play-services:11.4.0'
    compile 'com.google.maps.android:android-maps-utils:0.4.3'

    compile 'com.firebaseui:firebase-ui:0.4.0'
    compile 'com.google.firebase:firebase-auth:11.4.0'
    compile 'com.google.firebase:firebase-crash:11.4.0'
    compile 'com.google.code.gson:gson:2.8.1'
    //  compile 'com.firebase:geofire-android:2.1.1'
    compile 'com.algolia:algoliasearch-android:3.10.1'
  //  compile 'com.android.support:cardview-v7:25.1.1'
    /* Add the CSDK framework dependencies (Make sure these version numbers are correct) */
    compile 'com.adobe.creativesdk.foundation:auth:0.9.1251'
    compile 'com.adobe.creativesdk:image:4.8.4'
    compile 'com.localytics.android:library:3.8.0'


    testCompile 'junit:junit:4.12'
}


apply plugin: 'com.google.gms.google-services'

I already tested to clean and rebuild project, I also tested to disable instant run but nothing worked for me, I can't even realise the problem because it works very good in j5 and it crash in j3, Please help.

Upvotes: 1

Views: 1331

Answers (1)

Jaspreet Kaur
Jaspreet Kaur

Reputation: 1720

enable multidex,

1. Add following dependency in app gradle file compile
'com.android.support:multidex:1.0.1' and 

defaultConfig {
 multiDexEnabled true
}

2. Your application class need to extends MultiDexApplication

Upvotes: 1

Related Questions