Note: This is not a missing class in a jar, so don't rush to mark this as a duplicate.
I'm porting a big project from eclipse to Android Studio. I finally succeeded to see my SplashActivity on screen, but I fail to get the MainActivity which is launched after my SplashActivity. I'm getting the following error on runtime:
> 06-13 14:42:30.176 12389-12389/com.totalboox E/AndroidRuntime: FATAL
> EXCEPTION: main Process: com.totalboox, PID: 12389
> java.lang.NoClassDefFoundError: com.androidcore.android.main.MainActivity$4
> at com.androidcore.android.main.MainActivity.<init>(MainActivity.java:587)
> at java.lang.Class.newInstance(Native Method)
> at android.app.Instrumentation.newActivity(Instrumentation.java:1067)
> at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2317)
> at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
> at android.app.ActivityThread.-wrap11(ActivityThread.java)
> at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
> at android.os.Handler.dispatchMessage(Handler.java:102)
> at android.os.Looper.loop(Looper.java:148)
> at android.app.ActivityThread.main(ActivityThread.java:5417)
> at java.lang.reflect.Method.invoke(Native Method)
> at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
> at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
MainActivity is declared in the Manifest:
<activity
android:name="com.androidcore.android.main.MainActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.Holo.Light"
android:windowSoftInputMode="stateHidden|adjustPan"
android:launchMode="singleTop">
<intent-filter>
<action android:name="com.totalboox.MESSAGE"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
The code at MainActivity:587
// Pushwoosh lib integration (see https://www.pushwoosh.com/programming-push-notification/android/native-android-sdk-integration/)
BroadcastReceiver mBroadcastReceiver = new RegisterBroadcastReceiver()
{
@Override
public void onRegisterActionReceive(Context context, Intent intent)
{
checkMessage(intent);
}
};
Where RegisterBroadcastReceiver is from an external lib (pushwoosh) handling notifications.
The code in SplashActivity starting MainActivity:
Intent mainActivity = new Intent(this, MainActivity.class);
mainActivity.putExtra("deep_link_book_id", deepLinkBookId);
startActivity(mainActivity);
finish();
Googling this I found people having this problem with a jar. In my case MainActivity.java is one of my source modules, and its package name is
package com.androidcore.android.main; exactly as declared in the Manifest.
The project is built of 4 subprojects. SplashActivity & MainActivity are in the same subproject.
I've spent countless hours on this. I tried: Clean, Rebuild, Invalidate Cache and Restart - nothing helped. Anyone can advise how to stop this nightmare? Many thanks in advance !
Aucun commentaire:
Enregistrer un commentaire