• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unable to instantiate main activity

 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I write a android app to download PDf file from link.below is main activity




when i run this below is the error i a getting

 
Maneesh Godbole
Saloon Keeper
Posts: 11342
16
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A good developer always pays close attention to the information which the stack trace provides.
 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
09-16 10:49:06.791: W/dalvikvm(6723): Link of class 'Lcom/android/pdf/MainActivity;' failed
i don't know how it comes to Lcom.android.pdf. It should be com.android.pdf.

below is my manifest file,Manesh please advice.

 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sam liya wrote:09-16 10:49:06.791: W/dalvikvm(6723): Link of class 'Lcom/android/pdf/MainActivity;' failed

That's not the first error message in the stack trace - the root cause is something else.
 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why it gives me ClassNotFoundException.I have already declared it on the manifest file.?
 
Maneesh Godbole
Saloon Keeper
Posts: 11342
16
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sam liya wrote:why it gives me ClassNotFoundException.I have already declared it on the manifest file.?

Ulf Dittmer wrote:
sam liya wrote:09-16 10:49:06.791: W/dalvikvm(6723): Link of class 'Lcom/android/pdf/MainActivity;' failed

That's not the first error message in the stack trace - the root cause is something else.

Maneesh Godbole wrote:A good developer always pays close attention to the information which the stack trace provides.
 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why it unable to find MainActivity?
 
Maneesh Godbole
Saloon Keeper
Posts: 11342
16
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you notice this line

Do you know what it means? Are you curious what it means? Did you google it?
Please ShowSomeEffort instead of just dumping your stack trace and waiting for someone to tell you what you are doing wrong
 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i serached internet manesh.BUt those answers did not worked for me.
 
Maneesh Godbole
Saloon Keeper
Posts: 11342
16
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which answers did you find on the net that did not work for you?
 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1)Right Click on your Project then

Goto Build Path-> Configure Build Path -> Order and Export

when you are there you should check the Android Private Libraries and then click OK.

if you still face the problem delete all the files inside your bin folder and rebuilt you project.

Hope this solves your issue

2)
Configure Build Path.
Choose Order and Export Tab,
Select all the listed path or JAR file.
And Try it!
 
Maneesh Godbole
Saloon Keeper
Posts: 11342
16
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Instead of searching for Unable to resolve superclass of Activity try Unable to resolve superclass of ActionBarActivity
 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I done below thing .but not worked for me

 
Maneesh Godbole
Saloon Keeper
Posts: 11342
16
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can add an ActionBar to your activity when running on API level 7 or higher by extending this class for your activity and setting the activity theme to Theme.AppCompat or a similar theme.

https://developer.android.com/reference/android/support/v7/app/ActionBarActivity.html

http://stackoverflow.com/questions/17897247/actionbaractivity-catch-an-error-on-phone

Hint: Theme
 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I added the theme to my manifest file as below.




Still i am getting below error.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic