Menu
Who Do Is
  • Home
  • What
  • How
  • Is
  • Can
  • Are
  • Does
  • Do
  • Why
  • Who
  • Where
  • Which
  • Which
  • Should
  • Will
  • When
  • What’s
  • Did
Who Do Is

[ANSWERED] android – java.lang.ClassNotFoundException: Didn’t find class “eduapp.arg.MainApplication” on path: DexPathList

Posted on November 14, 2022

Solution 1 :

From the logs: Unable to instantiate application eduapp.arg.MainApplication: java.lang.ClassNotFoundException: Didn't find class "eduapp.arg.MainApplication" on path

From the Android Developer docs, one of the uses for the package attribute in AndroidManifest is:

...to resolve any relative class names that are declared in the manifest file.
For example, if package is set to "com.example.myapp", an activity declared as <activity android_name=".MainActivity"> is resolved to be com.example.myapp.MainActivity

So, your MainApplication is in package com.frontendeduapp, yet you defined the package in your AndroidManifest as eduapp.arg. So now when building your app, that value for package is used to turn your relative .MainApplication into eduapp.arg.MainApplication when really it should be com.frontendeduapp.MainApplication.

Solution is to replace eduapp.arg with com.frontendeduapp in your AndroidManifest and rebuild.

Problem :

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.

Using the adb logcat tool to see the phone log and show me this:

Unable to instantiate application eduapp.arg.MainApplication: java.lang.ClassNotFoundException: Didn't find class "eduapp.arg.MainApplication" on path: DexPathList

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 "eduapp.arg.MainApplication" on path: DexPathList[[zip file "/data/app/eduapp.arg-FAa3-QgPlP0Ej-TLlvTegw==/base.apk"],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 "eduapp.arg.MainApplication" on path: DexPathList[[zip file "/data/app/eduapp.arg-FAa3-QgPlP0Ej-TLlvTegw==/base.apk"],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

Adb Log

READ  [ANSWERED] android - FLUTTER :MissingPlugins in release installation when image_picker added as dependency
Powered by Inline Related Posts

Here I leave the Android Manifest.xml

<manifest xmlns_android="http://schemas.android.com/apk/res/android" package="eduapp.arg">
  <uses-permission android_name="android.permission.INTERNET"/>
  <uses-permission android_name="android.permission.SYSTEM_ALERT_WINDOW"/>
  <uses-permission android_name="android.permission.MANAGE_DOCUMENTS"/>
  <uses-permission android_name="android.permission.READ_INTERNAL_STORAGE"/>
  <uses-permission android_name="android.permission.READ_PHONE_STATE"/>
  <uses-permission android_name="android.permission.USE_FINGERPRINT"/>
  <uses-permission android_name="android.permission.VIBRATE"/>
  <uses-permission android_name="android.permission.MODIFY_AUDIO_SETTINGS"/>
  <uses-permission android_name="android.permission.ACCESS_COARSE_LOCATION"/>
  <uses-permission android_name="android.permission.ACCESS_FINE_LOCATION"/>
  <uses-permission android_name="android.permission.CAMERA"/>
  <uses-permission android_name="android.permission.READ_CONTACTS"/>
  <uses-permission android_name="android.permission.READ_CALENDAR"/>
  <uses-permission android_name="android.permission.WRITE_CALENDAR"/>
  <uses-permission android_name="android.permission.READ_EXTERNAL_STORAGE"/>
  <uses-permission android_name="android.permission.RECORD_AUDIO"/>
  <uses-permission android_name="android.permission.WRITE_EXTERNAL_STORAGE"/>
  <uses-permission android_name="android.permission.WRITE_SETTINGS"/>
  <uses-permission android_name="android.permission.ACCESS_NETWORK_STATE"/>
  <uses-permission android_name="android.permission.WAKE_LOCK"/>
  <uses-permission android_name="com.google.android.c2dm.permission.RECEIVE"/>
  <application android_name=".MainApplication" android_label="@string/app_name" android_icon="@mipmap/ic_launcher" android_roundIcon="@mipmap/ic_launcher_round" android_allowBackup="false" android_theme="@style/AppTheme">
    <meta-data android_name="expo.modules.updates.EXPO_UPDATE_URL" android_value="YOUR-APP-URL-HERE"/>
    <meta-data android_name="expo.modules.updates.EXPO_SDK_VERSION" android_value="37.0.0"/>
    <meta-data android_name="expo.modules.updates.ENABLED" android_value="true"/>
    <meta-data android_name="expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH" android_value="ALWAYS"/>
    <meta-data android_name="expo.modules.updates.EXPO_UPDATES_LAUNCH_WAIT_MS" android_value="0"/>
    <activity android_name=".MainActivity" android_label="@string/app_name" android_configChanges="keyboard|keyboardHidden|orientation|screenSize" android_launchMode="singleTask" android_windowSoftInputMode="adjustResize" android_theme="@style/Theme.App.SplashScreen" 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="com.facebook.react.devsupport.DevSettingsActivity"/>
    <activity
      android_name="com.theartofdev.edmodo.cropper.CropImageActivity"
      android_theme="@style/Base.Theme.AppCompat">
    </activity>
  </application>
</manifest>

AndroidManifest

Here is the MainApplication.java

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<ReactPackage> getPackages() {
      List<ReactPackage> packages = new PackageList(this).getPackages();
      packages.add(new ModuleRegistryAdapter(mModuleRegistryProvider));
      return packages;
    }

    @Override
    protected String getJSMainModuleName() {
      return "index";
    }

    @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<?> aClass = Class.forName("com.facebook.flipper.ReactNativeFlipper");
        aClass.getMethod("initializeFlipper", 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();
      }
    }
  }
}

I leave the github link if you want to see the complete project.

READ  [ANSWERED] android - callback of registerForActivityResult(RequestPermission() does not run
Powered by Inline Related Posts

https://github.com/SasePriv/FrontEnd-EduApp/tree/expo-eject

Comments

Comment posted by chrylis -cautiouslyoptimistic-

You named it

Comment posted by MrPeewi

Thank kabumere very much now if it works, and I had been trying for hours to see what the problem was

Recent Posts

  • How can I play with my cat without toys?
  • What is a bag pipe band called?
  • Are Honda Civics actually fast?
  • Are Yankee candles toxic?
  • How do I pair my Michael Kors smartwatch with my Android?

Recent Comments

No comments to show.

Archives

  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022

Categories

  • ¿Cómo
  • ¿Cuál
  • ¿Cuántas
  • ¿Cuánto
  • ¿Que
  • ¿Quién
  • 90” and 108” so you may have to round up to the nearest size.
  • and delete any Spotify folders from it. Once this is done
  • Android
  • Are
  • At
  • Bei
  • blink
  • C'est
  • Can
  • carbs
  • Comment
  • Did
  • Do
  • Does
  • During
  • For
  • Has
  • How
  • In
  • Is
  • Ist
  • Kann
  • Können
  • nouveau
  • On
  • or 108 inches.2020-08-03
  • Où
  • owning
  • Pourquoi
  • Puis-je
  • Quand
  • Quante
  • Quel
  • Quelle
  • Quelles
  • Quels
  • Qui
  • Should
  • Sind
  • Sollte
  • spiritual
  • tap the downward-facing arrow on the top left. A downward-facing arrow will appear underneath each song in the album; they'll turn green as the download completes.2020-07-28
  • Uncategorized
  • Wann
  • Warum
  • Was
  • Welche
  • Welcher
  • Welches
  • Welke
  • Wer
  • Were
  • What
  • What's
  • When
  • Where
  • Which
  • Who
  • Whose
  • Why
  • Wie
  • Will
  • Wo
  • Woher
  • you will receive two curtains each with the same measurements of width 66"" (168cm) x drop 54""(137cm).
  • you'll see a green downward-facing arrow next to each song.2021-02-26
©2023 Who Do Is | Powered by SuperbThemes & WordPress