Android的工作室0.4.3 - 无法编译官方Android样品样品、工作室、官方、Android

2023-09-07 22:45:08 作者:一梦べ少年蓝

我已经有了Android的工作室0.4.3安装在我的系统,并尝试从Android开发者网站导入并运行官样:

I've got Android Studio 0.4.3 installed on my system and try to import and run the official samples from the Android Developers site:

http://developer.android.com/samples/index.html

不幸的是,当我尝试编译我收到以下错误:

Unfortunately when I try to compile I get the following error:

失败:无法确定要执行的任务

FAILURE: Could not determine which tasks to execute.   

出了什么问题:任务'组装'未找到根工程ActionBarCompat-基本

What went wrong: Task 'assemble' not found in root project 'ActionBarCompat-Basic'.

尝试:运行摇篮任务来获取可用的任务列表

Try: Run gradle tasks to get a list of available tasks.

正如你可以看到我试着编译ActionBarCompat - 基本例子,但结果是相同的所有样本。

As you can see I tried to compile the ActionBarCompat-Basic example, but the result is the same for all samples.

我已经尝试删除<成分名称=FacetManager> ...< /成分> 从我的 IML 文件,并删除 .idea 文件夹一样在这个线程建议:

I already tried to delete the <component name="FacetManager"> ... </component> from my iml file and deleted the .idea folder like suggested in this thread:

Gradle:故障:无法确定执行哪些任务

这并没有解决问题。清除的文件后,我进口的项目到Android Studio并试图编译。作为结果, IML 文件和 .idea 文件夹中再次生成该错误信息保持不变。

This did not solve the problem. After removal of the files I imported the project to Android Studio and tried to compile. As a consequence the iml file and the .idea folder are generated again and the error message stays the same.

任何人有这个问题?任何帮助是极大AP preciated!

Anyone else got this problem? Any help is greatly appreciated!

推荐答案

使用旧版本的摇篮插件是不再受Android的工作室支持采样项目0.4.3

Sample projects are using old version of gradle plugin which is no longer supported by Android Studio 0.4.3

请执行下列操作更改

转到您的模块的 build.gradle (如ActionBarCompat-BasicSample / build.gradle)文件的项目中,并用此替代类路径的依赖,在开始

Go to your module's build.gradle(like ActionBarCompat-BasicSample/build.gradle) file inside the project and replace dependency classpath at beginning by this

dependencies {
        classpath 'com.android.tools.build:gradle:0.7.+'
    }

更改 distrubutionUrl ActionBarCopat-基本/摇篮/ gradle-wrapper.properties 文件到这个

distributionUrl=http\://services.gradle.org/distributions/gradle-1.9-all.zip

如果您使用的是摇篮1.10版本替换 0.7,+ 0.8,+ 1.9〜1.10 以上配置。

If you are using gradle version 1.10 replace 0.7.+ to 0.8.+ and 1.9 to 1.10 in above configurations .

我假设你已经删除了组件F​​acetManager从ActionBarCopat-Basic.iml文件并重新导入该项目。

I am assuming you have already removed component FacetManager from ActionBarCopat-Basic.iml file and re-imported the project.

这工作完美的我。