Android gradle 빌드 오류 : (9, 0) Gradle DSL 메서드를 찾을 수 없음 : 'compile ()'.
프로젝트를 동기화하려고 할 때 다음 빌드 오류가 발생합니다.
Error:(9, 0) Gradle DSL method not found: 'compile()'
Possible causes:The project 'AlexTest' may be using a version of Gradle that does not contain the method.
The build file may be missing a Gradle plugin.
link: Apply Gradle plugin
나는 그들이 나를 연결하는 모든 단일 gradle 플러그인을 하단의 해당 링크에 적용하려고 시도했지만 동일한 문제이므로 첫 번째 오류가 원인이라고 결론지었습니다.
다음은 AlexTest 용 build.gradle 파일 (프로젝트 디렉토리)입니다.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.13.2'
compile 'com.google.android.gms:play-services:6.1.11'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
나는 그것이 문제가 있었던 gradle 파일이라고 생각합니다. 하지만 어떤 방법을 말하는지 잘 모르겠습니다.
또한 여기에 언급 된 gradle-wrapper.properties도 있습니다.
#Mon Nov 10 01:06:12 PST 2014
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.1-all.zip
아마도 distributionUrl의 gradle 버전이 종속성의 버전과 일치해야합니까?
나는 또한 app 디렉토리 자체에 build.gradle 파일이 있습니다-1 수준 더 낮지 만 그것이 참조하는 것이라고 생각하지는 않지만 여기에 있습니다.
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion "21.1.1"
defaultConfig {
applicationId "com.snappiesticker.alextest"
minSdkVersion 16
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.gms:play-services:6.1.+'
}
나는 그들이 나를 연결하는 모든 단일 gradle 플러그인을 하단의 해당 링크에 적용하려고 시도했지만 동일한 문제이므로 첫 번째 오류가 원인이라고 결론지었습니다.
옳은.
다음은 AlexTest 용 build.gradle 파일 (프로젝트 디렉토리)입니다.
You will notice that this file contains a code comment:
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Remove the compile 'com.google.android.gms:play-services:6.1.11'
line from that file. Leave the compile 'com.google.android.gms:play-services:6.1.+'
that you have in the other build.gradle
file.
The dependencies
closure in buildscript
is for Gradle plugins only. The top-level dependencies
closure, found in the module's build.gradle
file, is for application dependencies.
Saw reports that the problem occurred for other reasons, but this solved for me.
If you carry out any changes in the Project Structure (Android Studio) and press OK, Gradle will be synchronized, but this type of synchronization, if the dependency block has something like:
This block will stay this way after synchronization:
One way to solve the problem is to insert a line break to stay as it was before the synchronization or put a semi-colon between the two statements.
I hope it helps.
Just add foolwoing statement in your dependencies
apply plugin: 'jetty'
Hi everyone for me it was a "couple days consuming job" to make my app run in Android Studio (I migrated from Eclipse and had this problem too ) . Finally I found that very simple way of it .
- Create libs folder under src/main/java/ it is App/java/libs in left pane .
- Copy and paste all your external jars into here.
- Goto left pane and right click on your App then click Open Module Settings
- Then Project Structure window will appear .
- Then move to Dependencies tab . Final Step : Add all your jars located in App/java/libs (You will find them in src/main/java/libs) one by one .
That is all Enjoy it.
Declare dependencies in Module's build.gradle file, not in AlexTest's build.gradle file
'code' 카테고리의 다른 글
특정 요소에만 CSS 스타일 적용 (0) | 2020.12.12 |
---|---|
Android Studio : javadoc 첨부 방법 (0) | 2020.12.12 |
각도기에서 browser.ignoreSynchronization은 무엇입니까? (0) | 2020.12.12 |
전자에서 DOM 요소에 액세스하는 방법은 무엇입니까? (0) | 2020.12.12 |
Enum 값이 같으면 어떤 Enum 상수를 얻을 수 있습니까? (0) | 2020.12.12 |