簡體   English   中英

將okhttp3庫與react-native一起使用(運行'react-native run-android'命令時會引發異常)

[英]Using okhttp3 library with react-native (throws an exception when running the command of 'react-native run-android')

我一直在開發native-module以用於我react-native項目。 我的本機模塊使用okhttp3庫。

但是,當我運行react-native run-android命令時,出現以下異常:

Unknown source file : UNEXPECTED TOP-LEVEL EXCEPTION:
Unknown source file : com.android.dex.DexException: Multiple dex files define Lokhttp3/Address;

我猜這兩個都是react-native ,我添加了okhttp3庫以在同一應用程序中使用。

有沒有機會使用由react-native添加的okhttp3庫?

還是有機會克服這個問題?

react-native github網站上的問題已得到答復。

問題與build.gradle有關。

可以在build.gradle文件的dependencies部分添加compile 'com.squareup.okhttp3:okhttp:3.3.1'compile 'com.squareup.okhttp3:okhttp:3.3.1'

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM