2017-05-07 2 views
0

내 현재 안드로이드 프로젝트안드로이드 스튜디오 : Gradle을 스크립트는 안드로이드 오류()

// Top-level build file where you can add configuration options common to all sub-projects/modules. 

android { 
    compileSdkVersion 11 
    buildToolsVersion "11.0" 

    defaultConfig { 
     applicationId "com.stackoverflow.answer" 
     minSdkVersion 11 
     targetSdkVersion 11 
     versionCode 1 
     versionName "1.0" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

buildscript { 
    repositories { 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:2.2.2' 

     // NOTE: Do not place your application dependencies here; they belong 
     // in the individual module build.gradle files 
    } 
} 

allprojects { 
    repositories { 
     jcenter() 
     maven { url 'https://jitpack.io' } 
    } 
} 

task clean(type: Delete) { 
    delete rootProject.buildDir 
} 

에 따라 본 다음 스크립트를 사용하지만이 오류 메시지를 발견했다. This error

어떻게 해결할 수 있습니까?

답변

0

블록은 build.gradle 파일이 아니고 인 모듈 build.gradle 내에 있어야합니다.

예 :

루트 build.gradle :

buildscript { 
    repositories { 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:2.2.2' 

     // NOTE: Do not place your application dependencies here; they belong 
     // in the individual module build.gradle files 
    } 
} 

allprojects { 
    repositories { 
     jcenter() 
     maven { url 'https://jitpack.io' } 
    } 
} 

모듈 build.gradle합니다 (app 폴더 내에있을 수있다)

apply plugin: 'com.android.application' 


android { 
    compileSdkVersion 11 
    buildToolsVersion "11.0" 

    defaultConfig { 
     applicationId "com.stackoverflow.answer" 
     minSdkVersion 11 
     targetSdkVersion 11 
     versionCode 1 
     versionName "1.0" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 
관련 문제