Android app ClassNotFoundException for main activity

后端 未结 12 642
灰色年华
灰色年华 2020-12-06 10:07

Most of the devices can run my app but I got this error report :

java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.company.app/com         


        
12条回答
  •  醉梦人生
    2020-12-06 10:12

    None of the answers above worked for me, contributing my solution if it's going to spare some hours to anyone in the future.

    What apparently worked for me was removing an extra support lib v4 jar in my project.

    After I updated the support lib via android tools, I had to fix jar mismatches in many libraries I use and point them all to the same jar in the android-sdks folder.

    I accidently added it to my project as well, and for some reason it made my MainActivity class not found in runtime, because the jar was also in the android-support-v7-appcompat library I was using.

    No errors on eclipse at all.

    I removed the jar from my project, and checked the jar in the v7 appcompat library in the export tab so it would be available to my project as well, and voila, app is working.

提交回复
热议问题