【问题标题】:How to add aar file to react-native project?如何将 aar 文件添加到 react-native 项目?
【发布时间】:2017-09-07 17:29:22
【问题描述】:

我正在构建一个 react-native 项目,但无法添加 aar 文件作为依赖项。

我已按照以下步骤进行

  1. 创建了 libs 文件夹并将 aar 文件放入其中。
  2. 用顶级 Gradle 编写

     repositories {
       mavenCentral()
       flatDir {
         dirs 'libs'
       }
    }
    
  3. 在依赖项中添加了以下行

    compile project(name: "xyz", ext: 'aar')
    

我在构建时遇到了这个错误

* What went wrong:
A problem occurred evaluating project ':react-native-abc'.
> Required keys [path] are missing from map {name=xyz, ext=aar}.

【问题讨论】:

  • 您解决了这个问题吗?

标签: android react-native


【解决方案1】:

-> 在第 2 步中,只需确保在添加时

    flatDir{ 
       dirs 'libs' 
    }

在 repositories 中,repository 属于 allprojects 而不是 buildscript。

-> 在第 3 步中试试这个:

    compile(name: "xyz",ext: 'aar')

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-09-13
    • 2020-09-25
    • 1970-01-01
    • 2016-10-09
    • 1970-01-01
    相关资源
    最近更新 更多