Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

create android project with gradle from command line deprecated?

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)?

like image 825
mkk Avatar asked Mar 05 '16 13:03

mkk


People also ask

How do I run a Gradle project from the 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.

Does Android use Gradle?

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.


1 Answers

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.

like image 82
Markku Kero Avatar answered Oct 02 '22 02:10

Markku Kero