将 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 site 的问题已得到回复。
问题与 build.gradle
有关。
将 compile 'com.squareup.okhttp3:okhttp:3.3.1'
行添加到 build.gradle
文件的 dependencies
部分成功了。
我一直在开发一个 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 site 的问题已得到回复。
问题与 build.gradle
有关。
将 compile 'com.squareup.okhttp3:okhttp:3.3.1'
行添加到 build.gradle
文件的 dependencies
部分成功了。