android studio(のgradleの部分を)動かしてみた

6/2 14:05 タイポで間違った情報を載せていたので修正しました

android studioを起動しようとするとしょっぱなからエラーをお見舞いされた

Build file build.gradle line: 9 A problem occurred evaluating project . 
A problem occurred evaluating project . Could not create plugin of type 'AppPlugin'.
org/gradle/tooling/provider/model/ToolingModelBuilderRegistry org.gradle.tooling.provider.model.ToolingModelBuilderRegistry

これは gradle が古い奴がインストールされているとおこるようで
さっそくgradle-1.6にアップデート。

このようすだと gradle のみでビルドできるのではないかと思ったのでやってみた。

$ gradle build
The TaskContainer.add() method has been deprecated and is scheduled to be removed in Gradle 2.0. Please use the create() method instead.
:MyApplication3:prepareDebugDependencies
:MyApplication3:compileDebugAidl
:MyApplication3:generateDebugBuildConfig
:MyApplication3:mergeDebugAssets
:MyApplication3:compileDebugRenderscript
:MyApplication3:mergeDebugResources
:MyApplication3:processDebugManifest
:MyApplication3:processDebugResources
:MyApplication3:compileDebug
:MyApplication3:dexDebug
:MyApplication3:processDebugJavaRes UP-TO-DATE
:MyApplication3:validateDebugSigning
:MyApplication3:packageDebug
:MyApplication3:assembleDebug
:MyApplication3:prepareReleaseDependencies
:MyApplication3:compileReleaseAidl
:MyApplication3:generateReleaseBuildConfig
:MyApplication3:mergeReleaseAssets
:MyApplication3:compileReleaseRenderscript
:MyApplication3:mergeReleaseResources
:MyApplication3:processReleaseManifest
:MyApplication3:processReleaseResources
:MyApplication3:compileRelease
:MyApplication3:dexRelease
:MyApplication3:processReleaseJavaRes UP-TO-DATE
:MyApplication3:packageRelease
:MyApplication3:assembleRelease
:MyApplication3:assemble
:MyApplication3:check UP-TO-DATE
:MyApplication3:build

BUILD SUCCESSFUL

Total time: 16.609 secs

$ ls MyApplication3/build/apk 
MyApplication3-debug-unaligned.apk  MyApplication3-release-unsigned.apk

成功した。やったねたえちゃん。ツールが増えるよ(白目
apkはモジュールの下のbuild/apkのディレクトリ内に作成されていました。

しかしタスクに何があるかは見えないようでエラー吐かれてしまった。
タイポでした。タスクの一覧は以下のようになっているようです。
ちょっとしたら翻訳して見ようと思います。

$ gradle tasks
The TaskContainer.add() method has been deprecated and is scheduled to be removed in Gradle 2.0. Please use the create() method instead.
:tasks

------------------------------------------------------------
All tasks runnable from root project
------------------------------------------------------------

Android tasks
-------------
androidDependencies - Displays the Android dependencies of the project
signingReport - Displays the signing info for each variant

Build tasks
-----------
assemble - Assembles all variants of all applications and secondary packages.
assembleDebug - Assembles all Debug builds
assembleRelease - Assembles all Release builds
assembleTest - Assembles the Test build for the Debug build
build - Assembles and tests this project.
buildDependents - Assembles and tests this project and all projects that depend on it.
buildNeeded - Assembles and tests this project and all projects it depends on.
clean - Deletes the build directory.

Build Setup tasks
-----------------
setupBuild - Initializes a new Gradle build. [incubating]

Help tasks
----------
dependencies - Displays all dependencies declared in root project 'MyApplication3Project'.
dependencyInsight - Displays the insight into a specific dependency in root project 'MyApplication3Project'.
help - Displays a help message
projects - Displays the sub-projects of root project 'MyApplication3Project'.
properties - Displays the properties of root project 'MyApplication3Project'.
tasks - Displays the tasks runnable from root project 'MyApplication3Project' (some of the displayed tasks may belong to subprojects).

Install tasks
-------------
installDebug - Installs the Debug build
installTest - Installs the Test build for the Debug build
uninstallAll - Uninstall all applications.
uninstallDebug - Uninstalls the Debug build
uninstallRelease - Uninstalls the Release build
uninstallTest - Uninstalls the Test build for the Debug build

Verification tasks
------------------
check - Runs all checks.
connectedCheck - Runs all device checks on currently connected devices.
connectedInstrumentTest - Installs and runs the tests for Build 'Debug' on connected devices.
deviceCheck - Runs all device checks using Device Providers and Test Servers.

To see all tasks and more detail, run with --all.

BUILD SUCCESSFUL

Total time: 7.517 secs

gradleだけでサインした状態でリリースできるのかとかよくわかりませんでしたが
signingコマンドがあるのでgradleだけでサインした状態でリリースできそうです。
CIをするためにantを別に生成するなどの手間もへりそうです、
これからも期待しながら見て行こうと思います!!