S.P
S.P

Reputation: 1845

Android Runtime Exception: Unable to instantiate activity componentInfo?

i am running a list-fragment program and at run-time i got the below error.

Error:

**02-09 09:03:40.213: ERROR/AndroidRuntime(572): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{ni.android.Fragment/ni.android.Fragment.Fragment}: java.lang.ClassNotFoundException: ni.android.Fragment.Fragment in loader dalvik.system.PathClassLoader[/data/app/ni.android.Fragment-1.apk]**

I don't know the reason.My program contains three classes- DetailsFragment.java, FragmentsTitles.java and Shakespear.java can any one help me out please....

Upvotes: 8

Views: 25760

Answers (5)

Ryan
Ryan

Reputation: 11

I had this error as well (beginner) and I noticed that I forgot to create the onCreate method in my activity class. Once I created that, the error went away.

Upvotes: 1

Vansi
Vansi

Reputation: 787

This blog will solve this issue.

http://android.foxykeep.com/dev/how-to-fix-the-classdefnotfounderror-with-adt-17

Thanks

Upvotes: 5

Codeversed
Codeversed

Reputation: 9473

Make sure you are not only looking at error logcat ... as the error may be seen using verbose. But I agree with @parameshwar-s

Upvotes: 0

Ksice
Ksice

Reputation: 3327

If you have like this warning before error:

05-16 10:08:00.033: W/dalvikvm(1695): Unable to resolve superclass of Lmy/fragment/test/FragmentTestActivity; (7)
05-16 10:08:00.076: W/dalvikvm(1695): Link of class 'Lmy/fragment/test/FragmentTestActivity;' failed

Should export android-support-v4 to right to your app: Configure Java Build Path -> Order And Export tab -> set checkbox android-support-v4.jar

(Maybe need to remove existing one firstly)

Upvotes: 0

S.P
S.P

Reputation: 1845

At any time if you get an error stating Unable to instantiate activity ComponentInfo That means your code has some error. That error will be shown in log cat As Caused by:......... 1.Caused by: android.view.InflateException: Binary XML file line #13: Error inflating class fragment(This indicates that there is an error in xml and the activity has inflating problem. By this you can know what is the error and if you rectify that error then your problem will be solved.

Upvotes: 18

Related Questions