不知道怎么回事,在libs中添加了jar包后,无法给jar包附加上源码,于是采取以下措施:
删除自动生成的依赖:
在Android Dependences目录上右击->Build Path ->Remove from Build Path
然后往libs中拖入jar包,然后添加jar的引用,这样,就可以给jar包附上源码了。
但是运行程序的时候,报以下的错误:
10-16 22:11:54.549: E/AndroidRuntime(2167): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.ibright.herolegend/com.ibright.herolegend.launcher.HeroLegendLauncher}: java.lang.ClassNotFoundException: com.ibright.herolegend.launcher.HeroLegendLauncher in loader dalvik.system.PathClassLoader[/data/app/com.ibright.herolegend-1.apk]
于是猜测是依赖引起的问题,解决办法:
在工程上右键->属性[或者 alter+Enter],进入Java Build Path ,order and export,勾选刚刚引入的jar包,确定,然后clear,重新运行工程,问题解决。
![Unable to instantiate activity ComponentInfo或java.lang.ClassNotFoundException: com.ibright.herolegen Unable to instantiate activity ComponentInfo或java.lang.ClassNotFoundException: com.ibright.herolegen](https://image.shishitao.com:8440/aHR0cHM6Ly9iYnNtYXguaWthZmFuLmNvbS9zdGF0aWMvTDNCeWIzaDVMMmgwZEhBdmFXMW5MbUpzYjJjdVkzTmtiaTV1WlhRdk1qQXhNekE1TURneU16QXdNems1T0RRL2QyRjBaWEp0WVhKckx6SXZkR1Y0ZEM5aFNGSXdZMFJ2ZGt3eVNuTmlNbU4xV1ROT2EySnBOWFZhV0ZGMllXMXdNVmd6Y0hwWlp6MDlMMlp2Ym5Rdk5XRTJURFZNTWxRdlptOXVkSE5wZW1Vdk5EQXdMMlpwYkd3dlNUQktRbEZyUmtOTlFUMDlMMlJwYzNOdmJIWmxMemN3TDJkeVlYWnBkSGt2VTI5MWRHaEZZWE4wLmpwZw%3D%3D.jpg?w=700)
![Unable to instantiate activity ComponentInfo或java.lang.ClassNotFoundException: com.ibright.herolegen Unable to instantiate activity ComponentInfo或java.lang.ClassNotFoundException: com.ibright.herolegen](https://image.shishitao.com:8440/aHR0cHM6Ly9iYnNtYXguaWthZmFuLmNvbS9zdGF0aWMvTDNCeWIzaDVMMmgwZEhBdmFXMW5MbUpzYjJjdVkzTmtiaTV1WlhRdk1qQXhNekE1TURneU16QXdNems1T0RRL2QyRjBaWEp0WVhKckx6SXZkR1Y0ZEM5aFNGSXdZMFJ2ZGt3eVNuTmlNbU4xV1ROT2EySnBOWFZhV0ZGMllXMXdNVmd6Y0hwWlp6MDlMMlp2Ym5Rdk5XRTJURFZNTWxRdlptOXVkSE5wZW1Vdk5EQXdMMlpwYkd3dlNUQktRbEZyUmtOTlFUMDlMMlJwYzNOdmJIWmxMemN3TDJkeVlYWnBkSGt2VTI5MWRHaEZZWE4wLmpwZw%3D%3D.jpg?w=700)