android - Unable to instantiate activity - ClassNotFound - Fails on one eclipse but not other

不打扰是莪最后的温柔 提交于 2019-12-05 13:09:33

I was happening pretty much the same situation (project made initially in 32 bit machine, then imported in another 64 bit machine).

In Android projects under Eclipse Juno (64 bit):

  • Click mouse right button on the project in "Project Explorer", then select "Properties"
  • Select "Java Build Path" in the list at left.
  • Make click on "Order and Export" tab.
  • Mark the two checkboxes for "Android Private Libraries" and "Android Dependencies", respectively, then click OK button.
  • Clean project(s) and run.
Urban

Try this. Add this piece of code inside your PopActivity and call this function from inside its default constructor.

private static void fixClassLoaderIssue()
{
ClassLoader myClassLoader = MyClass.class.getClassLoader();
Thread.currentThread().setContextClassLoader(myClassLoader);
}  

I had a similar issue and this fixed it. Now this solution doesnt really answer why the problem exists, but I really couldnt find that out.
For reference check this answer.

Did you try a project clean? That usually solves my classloader issues.

In my case It was wrong package name in AndroidManifest file.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"

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