码迷,mamicode.com
首页 > 移动开发 > 详细

Android Studio 在命令行编译工程

时间:2015-01-27 16:20:35      阅读:343      评论:0      收藏:0      [点我收藏+]

标签:gradle

在Android  sdk 目录下的samples/android-21/ 文件夹下,任找一个工程,如果在命令行直接编译 

可能会报这种错误:

gradle buile.gradle

FAILURE: Build failed with an exception.  
  
* What went wrong:  
Task 'build.gradle' not found in root project 'BorderlessButtons'.  
  
* Try:  
Run gradle tasks to get a list of available tasks. Run with --info or --debug option to get more log output.  
  
* Exception is:  
org.gradle.execution.TaskSelectionException: Task 'build.gradle' not found in root project 'BorderlessButtons'.  
    at org.gradle.execution.TaskSelector.getSelection(TaskSelector.java:101)  
    at org.gradle.execution.TaskSelector.getSelection(TaskSelector.java:76)  
    at org.gradle.execution.commandline.CommandLineTaskParser.parseTasks(CommandLineTaskParser.java:42)  
    at org.gradle.execution.TaskNameResolvingBuildConfigurationAction.configure(TaskNameResolvingBuildConfigurationAction.java:44)  

如果是这样,首先回到工程目录下,运行

./gradlew  
./gradlew  build

然后再执行进行编译
gradle build 
gradle tasks //查看android gradle的所有任务
 gradle compileReleaseSource  //生成debug apk ,在build/outpus/apk 文件夹下

参考http://stackoverflow.com/questions/14093024/trying-gradle-build-task-build-not-found-in-root-project/14093100

Android Studio 在命令行编译工程

标签:gradle

原文地址:http://blog.csdn.net/zouchengxufei/article/details/43195639

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!