【发布时间】:2016-12-07 19:19:31
【问题描述】:
我刚刚安装了 android studio 并更新了 sdk。我创建了一个新项目,但似乎无法编译。 gradle sync 有问题:
Error:(29, 0) Could not find method android() for arguments [build_st17khxxb7irr63f8isja72t$_run_closure4@3d9ba855] on root project 'MyApplication' of type org.gradle.api.Project.
这是我的清单文件:
<?xml version="1.0" encoding="utf-8"?>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme" >
<activity android:name=".MainActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
一些无用的词,因为代码太多
这是 build.gradle 文件:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
subprojects {
ext {
compileSdkVersion = 22
buildToolsVersion = '25.0.1'
}
}
android{
compileSdkVersion 22
buildToolsVersion '25.0.1'
dexOptions {
incremental true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_6
targetCompatibility JavaVersion.VERSION_1_6
}
}
dependencies {
compile files('app/libs/junit-4.12-JavaDoc.jar')
}
【问题讨论】:
-
请添加您的 build.gradle 文件内容。
标签: android xml android-studio android-developer-api