Android - Unable to instantiate activity - Class not found exception after upgrading to ADT 22

只愿长相守 提交于 2019-11-27 22:05:02
Krauxe

Might be a duplicate of this.

Try going to Project -> Properties -> Java Build Path -> Order & Export and ensure Android Private Libraries are checked for your project and for all other library projects you are using. Clean all projects afterwards and see what happens.

@Krauxe Thank you very much for providing this answer!

However, I had to use a slightly adjusted approach in my Eclipse (Version: 3.7.2).

  1. Project - Properties - Java Build Path - Order & Export
  2. Check Android Private Libraries (also for used library projects)
  3. Project - Clean... - Clean all projects

Here, we had to add the src folder as a source folder. For some reason the binding disappeared.

  1. Right click your src folder.
  2. Build Path -> Use as Source Folder

I had the same problem. The solution was to change the output folder to bin/classes.

  1. Right click on the project
  2. Select Properties
  3. Goto Java Build Path > Source
  4. Set Default output folder to /bin/classes

Greetings, Martin

if you've tried all the answers still got the problem then probably the activity name mismatch the package name in AndroidManifest.xml. for example your xml like this.

<activity
    android:name="com.tony.HomeActivity"
    android:screenOrientation="portrait" >
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

but the HomeActivity actually in the package com.tony.ui.HomeActivity.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!