1java.lang.RuntimeException:Unable to start activityComponentInfo{org.yuchen.test/org.yuchen.test.MainActivity}: java.lang.ClassCastException:android.widget.Button cannot be cast to android.widget.ImageView

原因:

eclipse的ADT的bug

出现场景:

修改布局而较少修改代码

解决:

project->clean

2、导入开源项目库是,控制台提示错误:

[2014-08-1311:16:04 - EX10_使用ABS库实现Actionbar]Found 2 versions of android-support-v4.jar in the dependency list,

[2014-08-1311:16:04 - EX10_使用ABS库实现Actionbar]but not all the versions are identical (check is based on SHA-1 only at thistime).

[2014-08-1311:16:04 - EX10_使用ABS库实现Actionbar]All versions of the libraries must be the same at this time.

[2014-08-1311:16:04 - EX10_使用ABS库实现Actionbar]Versions found are:

[2014-08-1311:16:04 - EX10_使用ABS库实现Actionbar]Path: F:\Users\longleg\workspaceHomeWork3\EX10_使用ABS库实现Actionbar\libs\android-support-v4.jar

[2014-08-1311:16:04 - EX10_使用ABS库实现Actionbar]Length: 621451

[2014-08-1311:16:04 - EX10_使用ABS库实现Actionbar]SHA-1: 5896b0a4e377ac4242eb2bc785220c1c4fc052f4

[2014-08-1311:16:04 - EX10_使用ABS库实现Actionbar]Path: F:\Users\longleg\workspaceHomeWork3\lib_ABS\libs\android-support-v4.jar

[2014-08-1311:16:04 - EX10_使用ABS库实现Actionbar]Length: 271754

[2014-08-1311:16:04 - EX10_使用ABS库实现Actionbar]SHA-1: 53307dc2bd2b69fd5533458ee11885f55807de4b

[2014-08-1311:16:04 - EX10_使用ABS库实现Actionbar]Jar mismatch! Fix your dependencies

问题原因:

是由于android-supportV4包有多个版本,不同版本之间的代码不同

解决方法:

1) 使它们相同

2) 使库中的jar是最新版本,将项目中的supportV4删除

3、在Fragment中增加有参数的构造方法,出现编译错误提示

Multiplemarkers at this line

- Avoidnon-default constructors in fragments: use a default constructor plus

Fragment#setArguments(Bundle)instead

- Thisfragment should provide a default constructor (a public constructor with noarguments)

(com.example.ex_templete.BannerItemFragment)

4、在Fragment中无法联想出getChildFragmentManager()

原因:

supportV4包较旧,更新为较新版本

5[2014-08-2016:25:32 - Dex Loader] Unable to execute dex: Multiple dex files defineLcom/nostra13/universalimageloader/cache/disc/DiscCacheAware;

[2014-08-2016:25:32 - EX40_使用UIL] Conversion to Dalvik formatfailed: Unable to execute dex:Multiple dex files defineLcom/nostra13/universalimageloader/cache/disc/DiscCacheAware;

原因:

即引入了库,libs目录中同时也含有jar包

解决方法:

删除一个

6. 使用UIL遇到的问题

08-2008:30:04.873: E/AndroidRuntime(20641): Caused by:java.lang.IllegalStateException: ImageLoader must be init with configurationbefore using

7. android.content.res.Resources$NotFoundException:String resource ID #0x4c

8. java.lang.IllegalStateException:The content of the adapter has changed but ListView did not receive anotification. Make sure the content of your adapter is not modified from abackground thread, but only from the UI thread. [in ListView(2131230826, classandroid.widget.ListView) with Adapter(class org.jrtt.fragment.CategoryFragment$CategoryAdapter)]

9java.lang.IllegalStateException:The specified child already has a parent. You must call removeView() on thechild's parent first.

原因:

一个child控件只能有一个parent布局

解决:

先移除再添加

ViewGroupparent = (ViewGroup) layout.getParent();

parent.removeView(layout);

1008-2803:44:01.994: E/AndroidRuntime(5942): java.lang.IllegalStateException: Activityhas been destroyed

原因:Fragment每次添加都要重新创建,否则因为状态不同会导致问题

解决:add或replace之前,重新new xxxFragment()

11导入项目后运行失败,提示

[2014-08-26 14:09:31 - Dex Loader] Unable toexecute dex: java.nio.BufferOverflowException. Check the Eclipse log for stacktrace.

[2014-08-26 14:09:31 - segmentedradios]Conversionto Dalvik format failed:Unable to execute dex:java.nio.BufferOverflowException.Check the Eclipse log for stack trace.

原因:

开发项目的eclipse版本较低,导入后项目配置问题

解决:


更多相关文章

  1. android 多点触摸实现图片缩放
  2. Android(安卓)使用IPC和后台Service通信
  3. android C++ 和 jni,根据JNIEnv的FindClass获取java类,包括多线程
  4. android断点续传实现方案之三
  5. 浅谈Java中Collections.sort对List排序的两种方法
  6. 箭头函数的基础使用
  7. NPM 和webpack 的基础使用
  8. Python list sort方法的具体使用
  9. 【阿里云镜像】使用阿里巴巴DNS镜像源——DNS配置教程

随机推荐

  1. html文件怎么打开,用什么打开html文件
  2. 腾龙公司客服电话热线17078756666
  3. 固定导航栏|可编辑表格
  4. Anaconda环境配置
  5. Rocky Linux镜像在阿里云镜像站首发上线
  6. 自定义方法通过类名获取对象集合
  7. 一套有效应对技术面算法题的方法论
  8. Apache服务器是如何解析PHP 小编来给你解
  9. 2021年校招程序员之阿里的十轮面试问题真
  10. PHP高并发高可用系统以及面试分析