Description:
引入外部 Library , 啟動 android app 時出現。
[2016-03-04 10:20:58 - SmackForXep0174] Dx Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/strangeberry/jmdns/tools/Browser; [2016-03-04 10:20:58 - SmackForXep0174] Dx Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/strangeberry/jmdns/tools/Browser$1; [2016-03-04 10:20:58 - SmackForXep0174] Dx Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/strangeberry/jmdns/tools/Browser$2; [2016-03-04 10:20:58 - SmackForXep0174] Dx Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/strangeberry/jmdns/tools/Browser$3; [2016-03-04 10:20:58 - SmackForXep0174] Dx Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/strangeberry/jmdns/tools/Browser$ServiceTableModel; [2016-03-04 10:20:58 - SmackForXep0174] Dx Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/strangeberry/jmdns/tools/Main; [2016-03-04 10:20:58 - SmackForXep0174] Dx Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/strangeberry/jmdns/tools/Main$SampleListener; [2016-03-04 10:20:58 - SmackForXep0174] Dx Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/strangeberry/jmdns/tools/Responder; [2016-03-04 10:20:58 - SmackForXep0174] Dx Uncaught translation error: java.lang.IllegalArgumentException: already added: Ljavax/jmdns/package-info; [2016-03-04 10:20:58 - Dex Loader] Unable to execute dex: Too many errors [2016-03-04 10:20:58 - SmackForXep0174] Conversion to Dalvik format failed: Unable to execute dex: Too many errors
即使把所有變動都移除,讓專案回復未引用 Library 再重新 build,錯誤訊息一樣產生。
必須把 eclipse 重新啟動,錯誤訊息才會消失。
Solution:
從錯誤訊息去尋找相關線索。
一連串的錯誤訊息提示都和 jmdns有關,在app中 也引用了 jmdns Library。
StackOverFlow 提示 ref: http://stackoverflow.com/questions/11697979/android-build-with-jmdns-fails
看起來是SourceForge 上檔案有問題,根據 StackOverFlow 提示改換 maven 上的 Library
app 成功啟動!!