1

How to create jar file from android project which contains facebook library and viewPager library in android studio

2

1 Answer 1

2

Its working for me

  1. Enter your java source file
  2. 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)
  1. Click the expostJar(Task) --- Follow below steps
    > Right side of your android studio 
    > --- Gradle 
       --- Gradle project 
         ---   click refresh button 
            --- app ---others -- (ExportJar) 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.