Android Studio 2.x com.android.tools.fd.runtime.IncrementalChange $change
来源:互联网 发布:matlab数组分号 编辑:程序博客网 时间:2024/06/05 06:48
我的博文一般会先说一下产生问题的背景,那这次也不例外了。
问题背景:
之前项目运行是ok的,重装了64bit系统后装上android studio 2.1之后运行项目怎么之前的功能不能操作了。于是乎,看到log中怎么多了个$change 自己从来就没有写过这个东东呀。打断点一看,到下面这行代码时
Field[] fields = clazz.getDeclaredFields();
fields多出了个属性$change。至此已经定位到问题。
解决过程
- 一般解决过程就是根据自己的知识判断问题出现的原因
- 再不行了那就度娘,谷哥
当在度娘时找到了如下信息[http://stackoverflow.com/questions/34647546/a-weird-field-appear-in-android-studio],以下解决方法参考此链接提供的内容,我只是再做整理,添加了一些信息。
[转载请注明:Canney 原创:http://blog.csdn.net/canney_chen/article/details/51323663 ]
解决方法
- 方法1
既然是增加了Instant Run特性导致的,那就把此特性关闭就可以了(默认是开启的)
关闭方法:Settings> Build, Execution, Deployment> Instant Run> Enable Instant Run to hot swap code/resource changes on deploy(default enabled)(取消此选项) 方法2
Field[] fields = objClass.getFields();for (Field field : fields) { if(field.isSynthetic()){ continue; } //add your code here}
此方法增加了for 及一个判断,Field.isSynthetic()方法是判断当前属性是编译插入时返回true。
总结
- 方法1 的解决不会改变现有的代码,风险较小,但是不能使用Studio的即时编译特性
- 方法2 我觉得是比较好的方案,可以彻底的解决问题而且还能使用新的特性
1 0
- Android Studio 2.x com.android.tools.fd.runtime.IncrementalChange $change
- Android Studio 2.x com.android.tools.fd.runtime.IncrementalChange $change
- ClassNotFoundException:"com.android.tools.fd.runtime.BootstrapApplication"
- ClassNotFoundException:"com.android.tools.fd.runtime.BootstrapApplication"
- Android Studio:Unable to instantiate application com.android.tools.fd.runtime.BootstrapApplication
- 【Android studio】Error:com.android.tools.fd.runtime.InstantRunService Starting service
- Android集成环信3.x出现java.lang.UnsatisfiedLinkError: com.android.tools.fd.runtime.IncrementalClassLoader
- Unable to instantiate application com.android.tools.fd.runtime.Bootstrap
- Unable to instantiate application com.android.tools.fd.runtime.BootstrapApplication
- Didn't find class "com.android.tools.fd.runtime.BootstrapApplication"
- java.lang.UnsatisfiedLinkError: com.android.tools.fd.runtime.IncrementalClassLoader$DelegateClassLoa
- java.lang.ClassNotFoundException: com.android.tools.fd.runtime.BootstrapApplication
- Didn't find class "com.android.tools.fd.runtime.BootstrapApplication"
- Unable to instantiate application com.android.tools.fd.runtime.BootstrapApplication:
- java.lang.UnsatisfiedLinkError: com.android.tools.fd.runtime.IncrementalClassLoader
- Unable to instantiate application com.android.tools.fd.runtime.BootstrapApplication
- java.lang.NoClassDefFoundError: com.android.tools.fd.runtime.AppInfo
- Unable to instantiate application com.android.tools.fd.runtime.BootstrapApplication
- BeanUtils.copyProperties与PropertyUtils.copyProperties用法及区别(转)
- inode
- mac brew
- Method Swizzling
- 【菜鸟学安卓】- java.lang.IllegalStateException记录
- Android Studio 2.x com.android.tools.fd.runtime.IncrementalChange $change
- 网络Socket入门编程
- LeetCode 344 Reverse String
- jmeter简单使用
- 10个最好的 JavaScript 动画库和开发框架
- ajax与302响应
- C++文件读写详解(ofstream,ifstream,fstream)
- LeetCode刷题:Linked List Cycle 及其进阶Linked List Cycle II
- XML与HTML的设计区别