I have integrated Twitter and all is done well.
But now I need to create a reusable component.
I.e.: a library using the fabric sdk in android studio.
We can get the fabric plugin from the Twitter developer site.
By using that I'm able to add sdk to an Android Studio project, but not to a library.
How to add this sdk to an Android Studio library project?
SDKs have a wider scope than libraries do. In fact, all SDKs will contain one or more libraries. An SDK is a collection of libraries, APIs, documentation, utilities, and/or sample code that help you implement certain features without having to do the work from scratch.
The Android Support Library package is a set of code libraries that provide backward-compatible versions of Android framework APIs as well as features that are only available through the library APIs. Each Support Library is backward-compatible to a specific Android API level.
Change Project structure from Android to Project. Then paste "aar" in libs folder. Click on File at top left of android studio and click "Sync Project with Gradle Files" as below. That's it.
Define the classpath in your project's build.gradle
as usual.
Add the dependencies to your library module as you would suspect.
Apply the io.fabric
plugin in your app module. No way around this, that's by design. Fabric needs application ID, libraries don't have one.
EDIT: Due to manifest merging you are able to specify the API key meta-data (e.g. for Crashlytics) in your library's manifest.
EDIT 2: Looks like there's a page for it. http://support.crashlytics.com/knowledgebase/articles/456258-library-subproject-in-gradle
https://docs.fabric.io/android/crashlytics/build-tools.html#set-up-a-library-subproject
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With