![](/img/trans.png)
[英]React-native android error when running the npx react-native run-android command
[英]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.