【问题标题】:Using okhttp3 library with react-native (throws an exception when running the command of 'react-native run-android')使用带有 react-native 的 okhttp3 库(运行“react-native run-android”命令时抛出异常)
【发布时间】:2016-07-02 12:18:13
【问题描述】:

我一直在开发一个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库?

或者有没有机会克服这个问题?

【问题讨论】:

    标签: android react-native build.gradle okhttp3


    【解决方案1】:

    react-nativegithub site的问题已回复。

    问题与build.gradle有关。

    compile 'com.squareup.okhttp3:okhttp:3.3.1' 行添加到build.gradle 文件的dependencies 部分已成功。

    【讨论】:

      猜你喜欢
      • 2020-07-27
      • 1970-01-01
      • 2021-10-14
      • 1970-01-01
      • 2020-12-29
      • 2019-06-10
      • 1970-01-01
      • 2018-05-20
      • 2021-09-13
      相关资源
      最近更新 更多