Manjeet Singh
Manjeet Singh

Reputation: 4572

How to use .arr sdk in my react-native library project

I wanted to create react-native wrapper around android sdk of zoom.us (they provide video conference feature through that), I have created a git repo using their sdk https://github.com/manjeets12/ZoomApiWrapper, but problem is that they only provide .aar sdk and it is giving me error project with path ":sdkName" could not be found in project ':react-native-zoom-api-wrapper'

I tried to use many solutions liking putting .aar files within libs folder and compiling from there or using flatDir options, as they don't provide any maven repo alternative, I am not sure how should I proceed in using this

Upvotes: 1

Views: 1349

Answers (1)

Simon Ludwig
Simon Ludwig

Reputation: 1804

So I've found a solution:

My aar-name is: 'my_name.aar'. You need to add this file to the libs folder in the root of your android folder (same level as your build.gradle).

Your build.gradle file has to contain this:

dependencies {
    compile(name:'my_name', ext:'aar')

}

repositories {
    flatDir {
        dirs 'libs'
    }
}

Your android project should compile then. Next step is to integrate the library to react-native.

npm install --save your_project 

react-native link your_project

And finally add this to your android/app/build.gradle

repositories {
   flatDir {
       dirs "../../node_modules/your_project/android/libs"
   }
}

For a working project see this git: https://github.com/transistorsoft/react-native-background-geolocation/blob/master/docs/INSTALL-ANDROID-RNPM.md

Upvotes: 1

Related Questions