How to create an Android studio library with the sdk tag?

I turned on Twitter and everything was done well.
But now I need to create a reusable component.

Ie: library using sdk in android studio.

We can get the plugin from the Twitter developer site.
Using this, I can add sdk to the Android Studio project, but not to the library.

How to add this sdk to Android Studio library project?

+6
source share
2 answers

Define the class path in your build.gradle project, as usual.

Add the dependencies to your library module as you suspected.

Apply the io.fabric plugin to your application module. . The fabric requires an application identifier; libraries do not have it.

EDIT: because of manifest merging, you can specify API key metadata (e.g. for Crashlytics) in the library manifest.

EDIT 2: There seems to be 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

+13
source

To create a reusable component with the sdk.update tag, your gradle to something like this

 buildscript { repositories { maven { url 'https://maven.fabric.io/public' } } dependencies { classpath 'io.fabric.tools:gradle:1.+' } } apply plugin: 'com.android.library' apply plugin: 'io.fabric' repositories { maven { url 'https://maven.fabric.io/public' } } android { compileSdkVersion 22 buildToolsVersion "21.1.2" defaultConfig { minSdkVersion 14 targetSdkVersion 22 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:22.0.0' compile('com.twitter.sdk.android:twitter: 1.3.2@aar ') { transitive = true; } } 

Recover your project after updating gradle file. Now you will get access to skd.

0
source

Source: https://habr.com/ru/post/984084/


All Articles