android - 如何从android studio创建一个jar文件?

标签 android android-studio

<分区>

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

最佳答案

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) 

关于android - 如何从android studio创建一个jar文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34897026/

相关文章:

android - 在 Android 应用中获取产品 flavor 或构建变体

android - 如何创建一个 gui 来显示收到的短信?

java - 如何使用Intent提示删除联系人

android - 如何在没有 Eclipse 的情况下将 Eclipse 项目导入 Android Studio

java - 如何在android主类的oncreate中调用 Action 溢出按钮(选项菜单)onclicklistener

安卓显示器: when i try to take a screenshot i receive Screenshot Unsupported protocol: 2

android - 如何在 Android 中将 onClickListener 设置为整个屏幕?

android - 对于 Emacs,在 Android 中使用 CTRL 键的漫长旅程

java - 从辅助线程在主线程上调用带参数的方法

android - 错误 :Execution failed for task ':app:processDebugResources' . > 在索引 4