java - Unable to instantiate activity- ClassNotFoundException -
my android application throws classnotfoundexception exception.
this code in mainactivity.java:
package pl.advancedsoftware.manga; public class mainactivity extends fragmentactivity { viewpager viewpager; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); requestwindowfeature(window.feature_indeterminate_progress); setcontentview(r.layout.activity_main); favourites.context= getapplicationcontext(); sectionspageradapter sectionspageradapter = new sectionspageradapter(getsupportfragmentmanager()); viewpager= (viewpager)findviewbyid(r.id.pager); viewpager.setadapter(sectionspageradapter); } @override public boolean oncreateoptionsmenu(menu menu) { // getmenuinflater().inflate(r.menu.activity_main, menu); return true; } }
in androidmanifest.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="pl.advancedsoftware.manga" android:versioncode="1" android:versionname="1.0" > <uses-sdk android:minsdkversion="8" android:targetsdkversion="15" /> <uses-permission android:name="android.permission.internet" /> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" > <activity android:name="pl.advancedsoftware.manga.mainactivity" android:label="@string/title_activity_main" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <activity android:name="pl.advancedsoftware.manga.bookactivity" android:label="books" /> <activity android:name="pl.advancedsoftware.manga.episodeactivity" android:label="epsiode" /> </application> </manifest>
my exception is:
> 04-25 12:28:08.868: e/androidruntime(898): fatal exception: main 04-25 > 12:28:08.868: e/androidruntime(898): java.lang.runtimeexception: > unable instantiate activity > componentinfo{pl.advancedsoftware.manga/pl.advancedsoftware.manga.mainactivity}: > java.lang.classnotfoundexception: didn't find class > "pl.advancedsoftware.manga.mainactivity" on path: > /data/app/pl.advancedsoftware.manga-1.apk 04-25 12:28:08.868: > e/androidruntime(898): @ > android.app.activitythread.performlaunchactivity(activitythread.java:2106) > 04-25 12:28:08.868: e/androidruntime(898): @ > android.app.activitythread.handlelaunchactivity(activitythread.java:2230) > 04-25 12:28:08.868: e/androidruntime(898): @ > android.app.activitythread.access$600(activitythread.java:141) 04-25 > 12:28:08.868: e/androidruntime(898): @ > android.app.activitythread$h.handlemessage(activitythread.java:1234) > 04-25 12:28:08.868: e/androidruntime(898): @ > android.os.handler.dispatchmessage(handler.java:99) 04-25 > 12:28:08.868: e/androidruntime(898): @ > android.os.looper.loop(looper.java:137) 04-25 12:28:08.868: > e/androidruntime(898): @ > android.app.activitythread.main(activitythread.java:5041) 04-25 > 12:28:08.868: e/androidruntime(898): @ > java.lang.reflect.method.invokenative(native method) 04-25 > 12:28:08.868: e/androidruntime(898): @ > java.lang.reflect.method.invoke(method.java:511) 04-25 12:28:08.868: > e/androidruntime(898): @ > com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:793) > 04-25 12:28:08.868: e/androidruntime(898): @ > com.android.internal.os.zygoteinit.main(zygoteinit.java:560) 04-25 > 12:28:08.868: e/androidruntime(898): @ > dalvik.system.nativestart.main(native method) 04-25 12:28:08.868: > e/androidruntime(898): caused by: java.lang.classnotfoundexception: > didn't find class "pl.advancedsoftware.manga.mainactivity" on path: > /data/app/pl.advancedsoftware.manga-1.apk 04-25 12:28:08.868: > e/androidruntime(898): @ > dalvik.system.basedexclassloader.findclass(basedexclassloader.java:65) > 04-25 12:28:08.868: e/androidruntime(898): @ > java.lang.classloader.loadclass(classloader.java:501) 04-25 > 12:28:08.868: e/androidruntime(898): @ > java.lang.classloader.loadclass(classloader.java:461) 04-25 > 12:28:08.868: e/androidruntime(898): @ > android.app.instrumentation.newactivity(instrumentation.java:1054) > 04-25 12:28:08.868: e/androidruntime(898): @ > android.app.activitythread.performlaunchactivity(activitythread.java:2097) > 04-25 12:28:08.868: e/androidruntime(898): ... 11 more
i see can wrong path, /data/app/pl.advancedsoftware.manga-1.apk dont know. want project stop working after clone them repository.
check inheriting android.support.v4.app.fragment
instead of android.app.fragment
.