创建机器人友好的gradle项目结构 [英] Create gradle friendly project structure for android
问题描述
IM学习android开发,在此刻我要开始使用SDK通过命令行,此刻我不想使用Android工作室IM在developers.android.com如何创建教程下面我第一个应用程序,我使用的命令的Android创建项目..'和全部的寄托都很好,直到我到了一部分,我必须利用gradle这个运行应用程序,我下载并gradle这个当我使用'gradle这个assembleDebug',它建立我的项目给了我这个错误任务assembleDebug在根项目没有发现',我了解其他人问类似的问题在这里计算器,但我的问题是如何创建使用命令行gradle这个友好的结构,而不是使用Android的工作室THX提前
im learning android development and at the moment i want to start using the sdk through the command line, at the moment i dont want to use android studio im following the tutorial at 'developers.android.com' on how to create my first application i used the command 'android create project..' and everthing was fine, until i reached the part where i had to run the app using gradle, i downloaded gradle and when i was building my project using 'gradle assembleDebug' and it gave me this error 'task assembleDebug not found in root project', i read about other people asking similar questions here at stackoverflow, but my question is how can i create a gradle friendly structure using the command line and not using android studio thx in advance
jrod
推荐答案
如果您遵循官方教程中,您使用此命令:
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
这与COMAND Eclipse中所使用的结构创建项目/ ADT捆绑。
This comand creates your project with the structure used by Eclipse/Adt Bundle.
要使用gradle这个,你已经到了结构的gradle创建项目。
To use gradle, you have to create your project with a gradle structure.
在与这个答案 accordace,你必须用这样的命令来创建你的项目:
In accordace with this answer, you have to create your project with a command like this:
android create project -a Main -k com.example.app -t 19 -g -v 0.10 \
-p AppWithGradleTemplate
在这之后,你会发现你的项目具有文件gradlew和gradlew.bat。然后,您可以运行:
After that, you will see that your project has the files gradlew and gradlew.bat. Then, you can run:
的Linux / Mac的
Linux/Mac
chmod +x gradlew
./gradlew assembleDebug
Windows系统:
Windows:
gradlew.bat assembleDebug
这篇关于创建机器人友好的gradle项目结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!