38
36

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

AndroidStudioでjarファイルを出力する

Last updated at Posted at 2014-12-21

※Android Studio 1.0.1 で確認

参考: 【Android】AndroidStudioでjarを出力する

gradle.properties の編集

以下の行を追加し出力するjarファイルの名前を設定しておく

JAR_NAME=hoge.jar

build.gradle の編集

以下を追加

task clearJar(type: Delete) {
    delete 'build/libs/' + JAR_NAME
}
task makeJar(type: Copy) {
    from('build/intermediates/bundles/release/')
    into('release/')
    include('classes.jar')
    rename('classes.jar', JAR_NAME)
}
makeJar.dependsOn(clearJar, build)

実行

Gradle tasks の中に makeJar が出来てるので、ダブルクリックで実行。

kobito.1419140474.180549.png

正常に完了すると、プロジェクトの release フォルダの中にjarファイルが出来ているはず。

38
36
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
38
36

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?