So my problem is I'm getting Class not found error while running the app on my device.
"io.tutorial.app.App" class not found at the path io.tutorial.app
Actually the class App.java is present at that path and also my class is extending MultiDexApplication
.
What I found so far is two dex files have generated in the built apk namely classes.dex and classes2.dex. The weird thing is the package "io.tutorial.app" is present at both dex files (I think this is the issue). There's no classes present at the "io.tutorial.app" package in the classes2.dex file but all my classes are present in classes.dex file under the same package "io.tutorial.app". Please help me to find a solution to this.
Manifest:
<application
android:theme="@style/AppTheme"
android:label="@string/app_name"
android:icon="@mipmap/ic_app"
android:name="io.tutorial.app.App"
android:allowBackup="true"
android:supportsRtl="true"
tools:ignore="GoogleAppIndexingWarning">
<activity
android:theme="@style/AppTheme.NoActionBarFullScreen"
android:name=".ui.activity.SplashActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
Gradle:app
App Class:
public class App extends MultiDexApplication {
@Inject
Cache cache;
public void onCreate() {
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
super.onCreate();
initRemoteConfig();
Injector.getInstance().init(this);
Injector.getInstance().appComponent().inject(this);
initFabric();
initRealm();
initPicasso();
initRemoteConfig();
initAds();
initOneSignal();
}
I'd have that
@Inject
annotation under suspicion - or the use ofInjector
.try to use
MultiDex.install()
instead: