'2016/02'에 해당되는 글 1건

  1. 2016.02.18 [Android Studio] Gradle을 이용한 jar 파일 만들기
JAVA/Android2016.02.18 12:59

1. Poroject -> Android -> Gradle Scripts -> build.gradle (Module: app)

apply plugin: 'com.android.library'

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"

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 'com.google.android.gms:play-services-gcm:8.3.0'
}

// task to delete the old jar
task deleteOldJar(type: Delete) {
delete 'release/AndroidPlugin.jar'
}

// task to export contents as jar
task exportJar(type: Copy) {
from('build/intermediates/bundles/release/')
into('release/')
include('classes.jar')
// give whatever name you want to give
rename('classes.jar', 'hellgate.jar')
}

exportJar.dependsOn(deleteOldJar, build)

2. Gradle projects -> other -> exportjar


저작자 표시
신고
Posted by Namseungil