How to create jar file from android project which contains facebook library and viewPager library in android studio
Asked
Active
Viewed 4,888 times
1

Mahendran Candy
- 1,114
- 17
- 17
-
2http://stackoverflow.com/questions/24309950/create-aar-file-in-android-studio Check this one – Tarun Sharma Jan 20 '16 at 10:08
-
http://stackoverflow.com/questions/27646262/how-to-create-a-release-android-library-package-aar-in-android-studio-not-deb – Tarun Sharma Jan 20 '16 at 10:08
1 Answers
2
Its working for me
- Enter your java source file
- alter your manifest file like as below
Manifest File:
apply plugin: 'com.android.library'
android
{
compileSdkVersion 23
buildToolsVersion "23.0.2"
useLibrary 'org.apache.http.legacy'
defaultConfig
{
minSdkVersion 15
targetSdkVersion 23
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile project(':facebook')
}
task deleteOldJar(type:Delete){
delete 'release/FacebookSharingApi.jar'
}
task exportJar(type:Copy){
from('build/intermediates/bundles/release/')
into('release/')
include('classes.jar')
rename('classes.jar','FacebookSharingApi.jar')
}
exportJar.dependsOn(deleteOldJar,build)
- Click the expostJar(Task) --- Follow below steps
> Right side of your android studio
> --- Gradle
--- Gradle project
--- click refresh button
--- app ---others -- (ExportJar)

Mahendran Candy
- 1,114
- 17
- 17