title: java.lang.ClassNotFoundException: Didn't find class "eduapp.arg.MainApplication" on path: DexPathList
body: <p>This is a react native application made first with expo and then ejected. When I want to perform the build it does not give any error but when installing and running it crashes, the app never always closes at once and shows an error.</p>
  <p>Using the adb logcat tool to see the phone log and show me this:</p>
  <p><code>Unable to instantiate application eduapp.arg.MainApplication: java.lang.ClassNotFoundException: Didn't find class &quot;eduapp.arg.MainApplication&quot; on path: DexPathList</code></p>
  <pre><code>08-07 02:32:48.585 10182 10182 E AndroidRuntime: FATAL EXCEPTION: main
  08-07 02:32:48.585 10182 10182 E AndroidRuntime: Process: eduapp.arg, PID: 10182
  08-07 02:32:48.585 10182 10182 E AndroidRuntime: java.lang.RuntimeException: Unable to instantiate application eduapp.arg.MainApplication: java.lang.ClassNotFoundException: Didn't find class &quot;eduapp.arg.MainApplication&quot; on path: DexPathList[[zip file &quot;/data/app/eduapp.arg-FAa3-QgPlP0Ej-TLlvTegw==/base.apk&quot;],nativeLibraryDirectories=[/data/app/eduapp.arg-FAa3-QgPlP0Ej-TLlvTegw==/lib/arm64, /data/app/eduapp.arg-FAa3-QgPlP0Ej-TLlvTegw==/base.apk!/lib/arm64-v8a, /system/lib64]]
  08-07 02:32:48.585 10182 10182 E AndroidRuntime:        at android.app.LoadedApk.makeApplication(LoadedApk.java:1073)
  08-07 02:32:48.585 10182 10182 E AndroidRuntime:        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5920)
  08-07 02:32:48.585 10182 10182 E AndroidRuntime:        at android.app.ActivityThread.access$1200(ActivityThread.java:200)
  08-07 02:32:48.585 10182 10182 E AndroidRuntime:        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1673)
  08-07 02:32:48.585 10182 10182 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:106)
  08-07 02:32:48.585 10182 10182 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:201)
  08-07 02:32:48.585 10182 10182 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:6810)
  08-07 02:32:48.585 10182 10182 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
  08-07 02:32:48.585 10182 10182 E AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
  08-07 02:32:48.585 10182 10182 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
  08-07 02:32:48.585 10182 10182 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class &quot;eduapp.arg.MainApplication&quot; on path: DexPathList[[zip file &quot;/data/app/eduapp.arg-FAa3-QgPlP0Ej-TLlvTegw==/base.apk&quot;],nativeLibraryDirectories=[/data/app/eduapp.arg-FAa3-QgPlP0Ej-TLlvTegw==/lib/arm64, /data/app/eduapp.arg-FAa3-QgPlP0Ej-TLlvTegw==/base.apk!/lib/arm64-v8a, /system/lib64]]
  08-07 02:32:48.585 10182 10182 E AndroidRuntime:        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
  08-07 02:32:48.585 10182 10182 E AndroidRuntime:        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
  08-07 02:32:48.585 10182 10182 E AndroidRuntime:        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
  08-07 02:32:48.585 10182 10182 E AndroidRuntime:        at android.app.AppComponentFactory.instantiateApplication(AppComponentFactory.java:50)
  08-07 02:32:48.585 10182 10182 E AndroidRuntime:        at androidx.core.app.CoreComponentFactory.instantiateApplication(CoreComponentFactory.java:47)
  08-07 02:32:48.585 10182 10182 E AndroidRuntime:        at android.app.Instrumentation.newApplication(Instrumentation.java:1121)
  08-07 02:32:48.585 10182 10182 E AndroidRuntime:        at android.app.LoadedApk.makeApplication(LoadedApk.java:1065)
  08-07 02:32:48.585 10182 10182 E AndroidRuntime:        ... 9 more
  08-07 02:32:48.591  2038  3384 W ActivityManager:   Force finishing activity eduapp.arg/.MainActivity
  </code></pre>
  <p><a href="https://i.stack.imgur.com/aZ8iB.png" rel="nofollow noreferrer">Adb Log</a></p>
  <p>Here I leave the Android Manifest.xml</p>
  <pre><code>&lt;manifest xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot; package=&quot;eduapp.arg&quot;&gt;
    &lt;uses-permission android:name=&quot;android.permission.INTERNET&quot;/&gt;
    &lt;uses-permission android:name=&quot;android.permission.SYSTEM_ALERT_WINDOW&quot;/&gt;
    &lt;uses-permission android:name=&quot;android.permission.MANAGE_DOCUMENTS&quot;/&gt;
    &lt;uses-permission android:name=&quot;android.permission.READ_INTERNAL_STORAGE&quot;/&gt;
    &lt;uses-permission android:name=&quot;android.permission.READ_PHONE_STATE&quot;/&gt;
    &lt;uses-permission android:name=&quot;android.permission.USE_FINGERPRINT&quot;/&gt;
    &lt;uses-permission android:name=&quot;android.permission.VIBRATE&quot;/&gt;
    &lt;uses-permission android:name=&quot;android.permission.MODIFY_AUDIO_SETTINGS&quot;/&gt;
    &lt;uses-permission android:name=&quot;android.permission.ACCESS_COARSE_LOCATION&quot;/&gt;
    &lt;uses-permission android:name=&quot;android.permission.ACCESS_FINE_LOCATION&quot;/&gt;
    &lt;uses-permission android:name=&quot;android.permission.CAMERA&quot;/&gt;
    &lt;uses-permission android:name=&quot;android.permission.READ_CONTACTS&quot;/&gt;
    &lt;uses-permission android:name=&quot;android.permission.READ_CALENDAR&quot;/&gt;
    &lt;uses-permission android:name=&quot;android.permission.WRITE_CALENDAR&quot;/&gt;
    &lt;uses-permission android:name=&quot;android.permission.READ_EXTERNAL_STORAGE&quot;/&gt;
    &lt;uses-permission android:name=&quot;android.permission.RECORD_AUDIO&quot;/&gt;
    &lt;uses-permission android:name=&quot;android.permission.WRITE_EXTERNAL_STORAGE&quot;/&gt;
    &lt;uses-permission android:name=&quot;android.permission.WRITE_SETTINGS&quot;/&gt;
    &lt;uses-permission android:name=&quot;android.permission.ACCESS_NETWORK_STATE&quot;/&gt;
    &lt;uses-permission android:name=&quot;android.permission.WAKE_LOCK&quot;/&gt;
    &lt;uses-permission android:name=&quot;com.google.android.c2dm.permission.RECEIVE&quot;/&gt;
    &lt;application android:name=&quot;.MainApplication&quot; android:label=&quot;@string/app_name&quot; android:icon=&quot;@mipmap/ic_launcher&quot; android:roundIcon=&quot;@mipmap/ic_launcher_round&quot; android:allowBackup=&quot;false&quot; android:theme=&quot;@style/AppTheme&quot;&gt;
      &lt;meta-data android:name=&quot;expo.modules.updates.EXPO_UPDATE_URL&quot; android:value=&quot;YOUR-APP-URL-HERE&quot;/&gt;
      &lt;meta-data android:name=&quot;expo.modules.updates.EXPO_SDK_VERSION&quot; android:value=&quot;37.0.0&quot;/&gt;
      &lt;meta-data android:name=&quot;expo.modules.updates.ENABLED&quot; android:value=&quot;true&quot;/&gt;
      &lt;meta-data android:name=&quot;expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH&quot; android:value=&quot;ALWAYS&quot;/&gt;
      &lt;meta-data android:name=&quot;expo.modules.updates.EXPO_UPDATES_LAUNCH_WAIT_MS&quot; android:value=&quot;0&quot;/&gt;
      &lt;activity android:name=&quot;.MainActivity&quot; android:label=&quot;@string/app_name&quot; android:configChanges=&quot;keyboard|keyboardHidden|orientation|screenSize&quot; android:launchMode=&quot;singleTask&quot; android:windowSoftInputMode=&quot;adjustResize&quot; android:theme=&quot;@style/Theme.App.SplashScreen&quot; android:screenOrientation=&quot;portrait&quot;&gt;
        &lt;intent-filter&gt;
          &lt;action android:name=&quot;android.intent.action.MAIN&quot;/&gt;
          &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot;/&gt;
        &lt;/intent-filter&gt;
      &lt;/activity&gt;
      &lt;activity android:name=&quot;com.facebook.react.devsupport.DevSettingsActivity&quot;/&gt;
      &lt;activity
        android:name=&quot;com.theartofdev.edmodo.cropper.CropImageActivity&quot;
        android:theme=&quot;@style/Base.Theme.AppCompat&quot;&gt;
      &lt;/activity&gt;
    &lt;/application&gt;
  &lt;/manifest&gt;
  </code></pre>
  <p><a href="https://i.stack.imgur.com/X6lhP.png" rel="nofollow noreferrer">AndroidManifest</a></p>
  <p>Here is the MainApplication.java</p>
  <pre><code>package com.frontendeduapp;
  
  import android.app.Application;
  import android.content.Context;
  import android.net.Uri;
  
  import com.facebook.react.PackageList;
  import com.facebook.react.ReactApplication;
  import com.facebook.react.ReactNativeHost;
  import com.facebook.react.ReactPackage;
  import com.facebook.react.shell.MainReactPackage;
  import com.facebook.soloader.SoLoader;
  import com.facebook.react.BuildConfig;
  import com.frontendeduapp.generated.BasePackageList;
  
  import org.unimodules.adapters.react.ReactAdapterPackage;
  import org.unimodules.adapters.react.ModuleRegistryAdapter;
  import org.unimodules.adapters.react.ReactModuleRegistryProvider;
  import org.unimodules.core.interfaces.Package;
  import org.unimodules.core.interfaces.SingletonModule;
  import expo.modules.constants.ConstantsPackage;
  import expo.modules.permissions.PermissionsPackage;
  import expo.modules.filesystem.FileSystemPackage;
  import expo.modules.updates.UpdatesController;
  
  import java.lang.reflect.InvocationTargetException;
  import java.util.Arrays;
  import java.util.List;
  import javax.annotation.Nullable;
  
  public class MainApplication extends Application implements ReactApplication {
    private final ReactModuleRegistryProvider mModuleRegistryProvider = new ReactModuleRegistryProvider(
      new BasePackageList().getPackageList()
    );
  
    private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
      @Override
      public boolean getUseDeveloperSupport() {
        return BuildConfig.DEBUG;
      }
  
      @Override
      protected List&lt;ReactPackage&gt; getPackages() {
        List&lt;ReactPackage&gt; packages = new PackageList(this).getPackages();
        packages.add(new ModuleRegistryAdapter(mModuleRegistryProvider));
        return packages;
      }
  
      @Override
      protected String getJSMainModuleName() {
        return &quot;index&quot;;
      }
  
      @Override
      protected @Nullable String getJSBundleFile() {
        if (BuildConfig.DEBUG) {
          return super.getJSBundleFile();
        } else {
          return UpdatesController.getInstance().getLaunchAssetFile();
        }
      }
  
      @Override
      protected @Nullable String getBundleAssetName() {
        if (BuildConfig.DEBUG) {
          return super.getBundleAssetName();
        } else {
          return UpdatesController.getInstance().getBundleAssetName();
        }
      }
    };
  
    @Override
    public ReactNativeHost getReactNativeHost() {
      return mReactNativeHost;
    }
  
    @Override
    public void onCreate() {
      super.onCreate();
      SoLoader.init(this, /* native exopackage */ false);
      initializeFlipper(this); // Remove this line if you don't want Flipper enabled
  
      if (!BuildConfig.DEBUG) {
        UpdatesController.initialize(this);
      }
    }
  
    /**
     * Loads Flipper in React Native templates.
     *
     * @param context
     */
    private static void initializeFlipper(Context context) {
      if (BuildConfig.DEBUG) {
        try {
          /*
           We use reflection here to pick up the class that initializes Flipper,
          since Flipper library is not available in release mode
          */
          Class&lt;?&gt; aClass = Class.forName(&quot;com.facebook.flipper.ReactNativeFlipper&quot;);
          aClass.getMethod(&quot;initializeFlipper&quot;, Context.class).invoke(null, context);
        } catch (ClassNotFoundException e) {
          e.printStackTrace();
        } catch (NoSuchMethodException e) {
          e.printStackTrace();
        } catch (IllegalAccessException e) {
          e.printStackTrace();
        } catch (InvocationTargetException e) {
          e.printStackTrace();
        }
      }
    }
  }
  
  </code></pre>
  <p>I leave the github link if you want to see the complete project.</p>
  <p><a href="https://github.com/SasePriv/FrontEnd-EduApp/tree/expo-eject" rel="nofollow noreferrer">https://github.com/SasePriv/FrontEnd-EduApp/tree/expo-eject</a></p>