Reputation: 26971
I have been getting this error every since importing my existing project into a new workspace.
02-12 11:30:58.140: E/AndroidRuntime(16605): FATAL EXCEPTION: main
02-12 11:30:58.140: E/AndroidRuntime(16605): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.fttech.full_version_hippos/com.fttech.hh.MenuActivity}: java.lang.ClassNotFoundException: com.fttech.hh.MenuActivity in loader dalvik.system.PathClassLoader[/data/app/com.fttech.hh-1.apk]
02-12 11:30:58.140: E/AndroidRuntime(16605): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1739)
02-12 11:30:58.140: E/AndroidRuntime(16605): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1831)
02-12 11:30:58.140: E/AndroidRuntime(16605): at android.app.ActivityThread.access$500(ActivityThread.java:122)
02-12 11:30:58.140: E/AndroidRuntime(16605): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1024)
02-12 11:30:58.140: E/AndroidRuntime(16605): at android.os.Handler.dispatchMessage(Handler.java:99)
02-12 11:30:58.140: E/AndroidRuntime(16605): at android.os.Looper.loop(Looper.java:132)
02-12 11:30:58.140: E/AndroidRuntime(16605): at android.app.ActivityThread.main(ActivityThread.java:4123)
02-12 11:30:58.140: E/AndroidRuntime(16605): at java.lang.reflect.Method.invokeNative(Native Method)
02-12 11:30:58.140: E/AndroidRuntime(16605): at java.lang.reflect.Method.invoke(Method.java:491)
02-12 11:30:58.140: E/AndroidRuntime(16605): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
02-12 11:30:58.140: E/AndroidRuntime(16605): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
02-12 11:30:58.140: E/AndroidRuntime(16605): at dalvik.system.NativeStart.main(Native Method)
02-12 11:30:58.140: E/AndroidRuntime(16605): Caused by: java.lang.ClassNotFoundException: com.fttech.hh.MenuActivity in loader dalvik.system.PathClassLoader[/data/app/com.fttech.hh-1.apk]
02-12 11:30:58.140: E/AndroidRuntime(16605): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:251)
02-12 11:30:58.140: E/AndroidRuntime(16605): at java.lang.ClassLoader.loadClass(ClassLoader.java:540)
Here is my manifest and everything else is in the correct package in my source folder.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.fttech.hh"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="4" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application android:icon="@drawable/ic_launcher" android:label="@string/app_name">
<activity android:name=".MenuActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Arcade_MainGame"></activity>
<activity android:name=".MainGame"></activity>
<activity android:name=".MyPreferenceClass"></activity>
<activity android:name=".unlockable"></activity>
</application>
</manifest>
Anyone see what im doing wrong?
Upvotes: 0
Views: 2731
Reputation: 11
Are you using Google play services ? if you are using latest Google play services and facing class not found exception then update application class
Step 1:
public class MyAppCtx extends Application {
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}
Step 2:
updated build.gradle
file:
defaultConfig {
multiDexEnabled true
}
Step 3 :
dependencies {
compile 'com.android.support:multidex:1.0.0'
}
Try this and Good Luck!
Upvotes: 1
Reputation: 741
My live app started throwing Activity Not Found Exception w/o ANY code change. Accepted answer above gave me some clue that my environment is broken. The link below explains the ADT changes that broke my environment/project.
I used to disable export of "Android Private Libraries" to work with ProGuard. Change in classpath configuration fixed the problem and that was to mark ”Android Private Libraries” container to be exported.
Hope this helps someone -
http://calyx.hr/weird-runtime-error-after-upgrading-android-development-tools-to-version-22/
Upvotes: 0
Reputation: 5619
OK, it's in the manifest. Does MenuActivity have the right package
? Is MenuActivity present in the .apk?
Upvotes: 2