Margareth Reena
Margareth Reena

Reputation: 1430

How to import a library into Android Studio

The Oboe library is an Android library that contains lots of examples that are also useful for using in my apps. It's structured in a weird way: https://github.com/google/oboe

On the past I copied this structure into my app structure. That is, I placed the root CMakeLists.txt file into my project's root, the root folders on my project's root, etc. This ended up in a mess because I couldn't update oboe to a new version without having to carefully updating each folder by hand.

How can I import oboe into my project as a separate folder and use it?

Upvotes: 0

Views: 146

Answers (2)

Nikhil Ranjan
Nikhil Ranjan

Reputation: 56

dependencies {
    implementation 'com.google.oboe:oboe:1.4.3'
}

Also enable prefab by adding:

android {
    buildFeatures {
        prefab true
    }
}

Include and link to oboe by updating your CMakeLists.txt:

android { 
    defaultConfig { 
        externalNativeBuild {
            cmake {
                arguments "-DANDROID_STL=c++_shared"
            }
        }
    }
}

Upvotes: 1

Mahmoud Omara
Mahmoud Omara

Reputation: 665

you need to add their latest version dependency into your gradle file, you shouldn't copy and paste their files/code directly to your project

here's the dependency line

implementation 'com.google.oboe:oboe:1.5.0'

found in this link: https://github.com/google/oboe/blob/master/docs/GettingStarted.md

they should probably move that part and add it into the Readme file in their github page, since that's the normal

Upvotes: 1

Related Questions