您好,登錄后才能下訂單哦!
1、java.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
出現(xiàn)場景:
修改布局而較少修改代碼
解決:
project->clean
2、導(dǎo)入開源項目庫是,控制臺提示錯誤:
[2014-08-1311:16:04 - EX10_使用ABS庫實現(xiàn)Actionbar]Found 2 versions of android-support-v4.jar in the dependency list,
[2014-08-1311:16:04 - EX10_使用ABS庫實現(xiàn)Actionbar]but not all the versions are identical (check is based on SHA-1 only at thistime).
[2014-08-1311:16:04 - EX10_使用ABS庫實現(xiàn)Actionbar]All versions of the libraries must be the same at this time.
[2014-08-1311:16:04 - EX10_使用ABS庫實現(xiàn)Actionbar]Versions found are:
[2014-08-1311:16:04 - EX10_使用ABS庫實現(xiàn)Actionbar]Path: F:\Users\longleg\workspaceHomeWork3\EX10_使用ABS庫實現(xiàn)Actionbar\libs\android-support-v4.jar
[2014-08-1311:16:04 - EX10_使用ABS庫實現(xiàn)Actionbar]Length: 621451
[2014-08-1311:16:04 - EX10_使用ABS庫實現(xiàn)Actionbar]SHA-1: 5896b0a4e377ac4242eb2bc785220c1c4fc052f4
[2014-08-1311:16:04 - EX10_使用ABS庫實現(xiàn)Actionbar]Path: F:\Users\longleg\workspaceHomeWork3\lib_ABS\libs\android-support-v4.jar
[2014-08-1311:16:04 - EX10_使用ABS庫實現(xiàn)Actionbar]Length: 271754
[2014-08-1311:16:04 - EX10_使用ABS庫實現(xiàn)Actionbar]SHA-1: 53307dc2bd2b69fd5533458ee11885f55807de4b
[2014-08-1311:16:04 - EX10_使用ABS庫實現(xiàn)Actionbar]Jar mismatch! Fix your dependencies
問題原因:
是由于android-supportV4包有多個版本,不同版本之間的代碼不同
解決方法:
1) 使它們相同
2) 使庫中的jar是最新版本,將項目中的supportV4刪除
3、在Fragment中增加有參數(shù)的構(gòu)造方法,出現(xiàn)編譯錯誤提示
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中無法聯(lián)想出getChildFragmentManager()
原因:
supportV4包較舊,更新為較新版本
5、[2014-08-2016:25:32 - Dex Loader] Unable to execute dex: Multiple dex files defineLcom/nostra13/universalp_w_picpathloader/cache/disc/DiscCacheAware;
[2014-08-2016:25:32 - EX40_使用UIL] Conversion to Dalvik formatfailed: Unable to execute dex: Multiple dex files define Lcom/nostra13/universalp_w_picpathloader/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)]
9、java.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);
10、08-2803:44:01.994: E/AndroidRuntime(5942): java.lang.IllegalStateException: Activityhas been destroyed
原因:Fragment每次添加都要重新創(chuàng)建,否則因為狀態(tài)不同會導(dǎo)致問題
解決:add或replace之前,重新new xxxFragment()
11、導(dǎo)入項目后運行失敗,提示
[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.
原因:
開發(fā)項目的eclipse版本較低,導(dǎo)入后項目配置問題
解決:
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。