您的位置:首页 > 移动开发 > Android开发

Android:adb通过app_process调用java类报错-java.lang.ClassNotFoundException

2017-05-18 16:10 916 查看
这个错误产生于近期由于实际需要,从ecplise+adt换成了android studio。在更换之前,是完全可以通过export CLASSPATH=/data/app/com.example.lenovo.screenshot2-1/base.apk   exec app_process /system/bin com.example.lenovo.screenshot2.Main1 '$@' 去调用main1类中的main方法的,但是更换之后却一直报错,断断续续寻找了一段时间,终于找到原因:

至于具体原因,外国友人做出了说明
http://stackoverflow.com/questions/33967703/unable-to-instantiate-application-com-android-tools-fd-runtime-bootstrapapplicat
原文:

down
voteaccepted
Disable the Instant Run option in Android Studio. Instructions are in the Android
Studio Instant Run documentation.

Instant Run tries to do hot swapping of your code; this causes the application class to be moved.

To disable Instant Run Go to File --> Settings--> Build,Execution,Deployment -->Instant Run ---> uncheck "Enable instant run"

这名仁兄说了 instant Run 会对你代码使用热交换,这会导致应用中的class被移动位置。
详情见官网文档

https://developer.android.com/studio/run/index.html#instant-run
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐