【发布时间】:2015-10-08 11:29:04
【问题描述】:
在docs 中,我在尝试运行应用程序时发现了以下这些行。
Run the app from a command line
-------------------------------
Open a command-line and navigate to the root of your project directory. Use Gradle to build your project in debug mode, invoke the assembleDebug build task using the Gradle wrapper script (gradlew assembleRelease).
This creates your debug .apk file inside the module build/ directory, named MyFirstApp-debug.apk.
On Windows platforms, type this command:
> gradlew.bat assembleDebug
On Mac OS and Linux platforms, type these commands:
$ chmod +x gradlew
$ ./gradlew assembleDebug
所以我安装了Gradle,假设gradle wrapper和gradlew一样,我也做了同样的步骤,但是当我尝试运行时:
/MyFirstApp$ gradle wrapper assembleDebug
FAILURE:无法确定要执行的任务。
出了什么问题:在根项目“MyFirstApp”中找不到任务“包装器”。
尝试:运行 gradle 任务以获取可用任务列表。
构建失败
总时间:1.946 秒
这是我的MyFirstApp目录的内容:
AndroidManifest.xml bin **gradlew** local.properties project.properties src
ant.properties build.xml libs proguard-project.txt res
正如你所见,我也有gradlew 命令,因为我是从/home/me/Downloads/android-sdk-linux/tools/templates/gradle/wrapper/gradlew 复制的。但是当我尝试运行 ./gradlew assembleDebug 时,我得到了这个:
错误:无法找到或加载主类 org.gradle.wrapper.GradleWrapperMain
【问题讨论】:
标签: android gradle android-gradle-plugin gradlew