Multiple dex files define Lcom/google/gson/internal/Streams$AppendableWriter$CurrentWrite;

來源:互聯網
上載者:User

標籤:jar   strong   圖片   efi   div   pen   開發   google   class   

開發中引入第三方 aar 時編譯同過,運行時出現問題:

Multiple dex files define Lcom/google/gson/internal/Streams$AppendableWriter$CurrentWrite;

說白了是個 gson jar包衝突造成的,用解壓縮軟體查看果真如此:謝特!!!

 

 思路一:

在 app module下的build.gradle中加入:

android{    repositories {        flatDir {            dirs ‘libs‘        }    }}

依賴時:

compile(name: ‘barcode_scanner_library_v2.3.2.0‘, ext: ‘aar‘) {
exclude group: ‘com.google.gson‘
}

  喜聞樂見,不管用!

 

思路二: 重新打包第三方的這個aar!!!

  • 【親測有效】用解壓軟體解壓aar檔案,刪除libs裡重複的jar包,然後clean項目(必須操作),再次運行!

 

  • 建立個module項目,把解壓出來aar中的有用的東西拷到新module中,再打包這個新module!

參考,二次打包(封裝)AAR實用指南 https://www.jianshu.com/p/3bad128bd106

 

Multiple dex files define Lcom/google/gson/internal/Streams$AppendableWriter$CurrentWrite;

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.