I am trying to create android project with gradle from command line using this command:
android create project \
--target android-23 \
--name HelloWorld \
--path HelloWorld/ \
--activity MainActivity \
--package com.example.helloworld \
--gradle \
--gradle-version 1.3.0
Project structure was successfully generated but when I try to run gradlew assembleDebug I get:
A problem occurred evaluating root project 'HelloWorld'.
> Could not create plugin of type 'AppPlugin'.
I was traversing google for half of day and finally I found that usage of gradle in android create project is (probably) deprecated:
https://code.google.com/p/android/issues/detail?id=160032
Are there any supported methods (that are clean, no hacks) to achieve the goal (in command line)?
To run a Gradle command, open a command window on the project folder and enter the Gradle command. Gradle commands look like this: On Windows: gradlew <task1> <task2> … e.g. gradlew clean allTests.
Android Studio uses Gradle, an advanced build toolkit, to automate and manage the build process, while allowing you to define flexible custom build configurations. Each build configuration can define its own set of code and resources, while reusing the parts common to all versions of your app.
As instructed here:
http://eqdn.tech/android-development-on-the-command-line/
You can still use "android create project", but will need to adjust the results manually a little bit afterwards. Essentially changing in gradle/wrapper/gradle-wrapper.properties this:
distributionUrl=http://services.gradle.org/distributions/gradle-1.12-all.zip
To this:
distributionUrl=http://services.gradle.org/distributions/gradle-2.2.1-all.zip
And changing "runProguard false" to "minifyEnabled true" in build.gradle.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With