简体   繁体   中英

How to add aar file to react-native project?

I am building a react-native project but not able to add an aar file as a dependency.

I have followed following steps

  1. Created libs folder and placed aar file in that.
  2. Written this in top level Gradle

     repositories { mavenCentral() flatDir { dirs 'libs' } }
  3. added following line to dependencies

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

And I am facing this error while building

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

-> In Step 2, just make sure that while adding

    flatDir{ 
       dirs 'libs' 
    }

in repositories , repository belongs to allprojects instead of buildscript.

-> In step 3 try this :

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM