Unable to instantiate activity ComponentInfo

后端 未结 12 2133
甜味超标
甜味超标 2020-12-11 09:54

I am developing an application for Froyo as minimum version and Gingerbread as the target version. So, the manifest shows:



        
相关标签:
12条回答
  • 2020-12-11 09:57

    For the record, another simple reason that can cause this, that may have been overlooked when starting a project, is that the activity you wish to launch may not have extended Activity or be an empty class etc..

    0 讨论(0)
  • 2020-12-11 09:58

    Today I had same issue and it was problem with the main class naming. It was IdleActivity and as soon as I changed it by setting IdleDnaActivity, application started successfuly.

    0 讨论(0)
  • 2020-12-11 09:59

    My solution was in Project --> Properties --> Java Build Path --> Order and Export, you should tick the entries you use. BUT also i experienced if you tick to Android.jar, it says "Conversion to Dalvik format failed with error 1"

    Also removing all of your libraries except Android.x.x and then cleaning your project by Project --> Clean and then adding your libraries back (don't forget to tick in order and export) may solve the "Conversion to Dalvik format failed with error 1" thing.

    And one more place you need to check is Properties --> Java Compiler --> JDK Compliance.

    0 讨论(0)
  • 2020-12-11 10:01

    I was having the same problem but I had everything defined properly. I took another copy of the same project from my SVN and I was getting this error in the second project. Restart Eclipse: this will refresh eclipse's memory. It worked for me

    0 讨论(0)
  • 2020-12-11 10:03

    I had this problem as well developing under Eclipse 4.2. My main activity was referenced by the AndroidManifest.xml file, included the correct package and name, but still failed to load. After a bit of debugging and commenting out things, I discovered that an interface that my main activity was implementing was the source of the problem. This interface is defined in a separate project, but I had failed to reference that project in the Java Build Path. So, when I built things, they would build correctly, but I'd immediately encounter a force close when I launched, with the same error as this question.

    To correct this, I right-clicked on the Android project, selected Java Build Path, added my 'common code' project to the Projects tab and then checked the box for that same project on the Order and Export tab. After that, everything worked.

    0 讨论(0)
  • 2020-12-11 10:07

    As it turns out, the project files were missing some of the builders required for the apk to be correctly made. That's why it was not able to find the Dashboard class.

    The solution is to create an empty Android project and compare the automatically generated .project and .properties files with the ones in your broken project.

    0 讨论(0)
提交回复
热议问题