Android常见的错误整理(不定时更新)
2015-08-14 16:58
459 查看
1.将Bitmap影像到FrameLayout,我解码的图像转换成 Drawable ,然后将其设置为背景的 FrameLayout java.lang.NoSuchMethodError: android.widget.FrameLayout.setBackground() ByteArrayInputStream imageStream2= new ByteArrayInputStream(cardbackground); Bitmap Imagebackground = BitmapFactory.decodeStream(imageStream2); Drawable imagebakground=new BitmapDrawable(getResources(),Imagebackground); framelayout.setBackground(imagebakground);解决方法:setBackground()方法,在添加 API 级别 16。使用
setBackgroundDrawable()相反用setBackground
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { framelayout.setBackground(imagebakground); } else { frameLayout.setBackgroundDrawable(imagebakground); }
2.错误信息 [2015-11-22 17:19:10 - news] Found 2 versions of android-support-v4.jar in the dependency list, [2015-11-22 17:19:10 - news] but not all the versions are identical (check is based on SHA-1 only at this time). [2015-11-22 17:19:10 - news] All versions of the libraries must be the same at this time. [2015-11-22 17:19:10 - news] Versions found are: [2015-11-22 17:19:10 - news] Path: E:\android\adt-bundle-windows-x86-20131030\workspace\library\libs\android-support-v4.jar [2015-11-22 17:19:10 - news] Length: 385685 [2015-11-22 17:19:10 - news] SHA-1: 48c94ae70fa65718b382098237806a5909bb096e [2015-11-22 17:19:10 - news] Path: E:\android\adt-bundle-windows-x86-20131030\workspace\news\libs\android-support-v4.jar [2015-11-22 17:19:10 - news] Length: 621451 [2015-11-22 17:19:10 - news] SHA-1: 5896b0a4e377ac4242eb2bc785220c1c4fc052f4 [2015-11-22 17:19:10 - news] Jar mismatch! Fix your dependencies 解决方案: 把一个项目的android-support-v4.jar复制到另一个项目覆盖原来的android-support-v4.jar
相关文章推荐
- java.lang.NoSuchMethodError: javax.xml.stream.XMLEventFactory.newFactory()Ljavax/xml/stream/XMLEvent
- SSH整合之java.lang.NoSuchMethodError: javax.persistence.OneToMany.orphanRemoval()Z
- 关于java.lang.NoSuchMethodError: android.view.View.setBackground
- MyBatis与Spring集成示例——MyBatis学习笔记之五 推荐
- Spring data redis 异常
- 【已解决】NoSuchMethodError: org.hibernate.SessionFactory.getCurrentSession()...
- android 混淆崩溃
- POI生成(Excel 2007).xlsx文件时报“java.lang.NoSuchMethodError”错误的解决
- NoSuchMethodError的解决方法
- java.lang.NoSuchMethodError ljava/util/list
- 解决Hibernate中自动生成的findByProperty函数无法工作的问题-java SSH整合系列
- spark与scala jar包版本冲突问题
- NoSuchMethodError
- 使用RecyclerView实现QQ空间广告位一个位置两个图时偶遇bug
- 使用RecyclerView实现QQ空间广告位一个位置两个图时偶遇bug
- 使用RecyclerView实现QQ空间广告位一个位置两个图时偶遇bug
- 使用RecyclerView实现QQ空间广告位一个位置两个图时偶遇bug
- 使用RecyclerView实现QQ空间广告位一个位置两个图时偶遇bug
- HTTP Status 500 - Handler processing failed; nested exception is java.lang.NoSuchMethodError:
- 接入谷歌Admob,Firebase所踩的坑