如何从Android项目创建jar文件,其中包含android studio中的facebook库和viewPager库
答案 0 :(得分:1)
它为我工作
- 输入您的java源文件
- 更改您的清单文件,如下所示
醇>
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)
- 点击expostJar(任务)---按照以下步骤
醇>
> Right side of your android studio
> --- Gradle
--- Gradle project
--- click refresh button
--- app ---others -- (ExportJar)