Create Gradle Friendly Project Structure For Android
Solution 1:
If you are following the official tutorial, you are using this command:
android create project --target <target-id> --name MyFirstApp \
--path <path-to-workspace>/MyFirstApp --activity MyActivity \
--package com.example.myfirstapp
This comand creates your project with the structure used by Eclipse/Adt Bundle.
To use gradle, you have to create your project with a gradle structure.
In accordace with this answer, you have to create your project with a command like this:
android create project -aMain -k com.example.app -t 19 -g -v 0.10 \
-p AppWithGradleTemplate
After that, you will see that your project has the files gradlew and gradlew.bat. Then, you can run:
Linux/Mac
chmod +x gradlew
./gradlew assembleDebug
Windows:
gradlew.bat assembleDebug
Solution 2:
Probably the easiest thing to do is to create a simple starter project in Android Studio, and then study the structure of that project.
One of the things that you will notice is that there's a 'top level' to the project, and then an 'app level' below that. This allows for multi-module projects.
There's are gradle build files at both levels. You will typically build from the top level. There's also typically 'gradlew' file at the top level, that invokes the build process, using a local gradle installation in the 'gradle' directory of the project.
Solution 3:
This article will help you to get started http://tools.android.com/tech-docs/new-build-system/user-guide
You should also checkout the Google IO 2013 Talk on the new android build system (it was new back then). Here's the link https://www.youtube.com/watch?v=LCJAgPkpmR0
However if you want to see some samples, I have some starter projects. There you go: https://github.com/mushfek0001/javafest-gradle-webiner/tree/master/currency-converterhttps://github.com/mushfek0001/javafest-gradle-webiner/tree/master/currency-converter-modularhttps://github.com/mushfek0001/javafest-gradle-webiner/tree/master/AndroidComplexBuild
Post a Comment for "Create Gradle Friendly Project Structure For Android"