2016-08-15 2 views
0

Android Studio 1.4.1을 사용하고 있습니다. 모든 프로젝트를 Android Studio에서 열면 프로젝트의 모든 클래스가 올바르게로드되고 프로젝트가 제대로 작동합니다. 내가 "EcoAssistant_03"라는 이름의 특정 프로젝트, 나는 다음과 같은 메시지가 나타납니다 OPN 할 때 문제는 : 내가 프로젝트 파크 잘못 모르는빌드 gradle로 인해 앱에서 오류가 발생합니다.

Error:(22, 0) Gradle DSL method not found: 'android()' 
Possible causes:<ul><li>The project 'EcoAssistant_03' may be using a version of Gradle that does not contain the method. 
<a href="openGradleSettings">Gradle settings</a></li><li>The build file may be missing a Gradle plugin. 
<a href="apply.gradle.plugin">Apply Gradle plugin</a></li> 

을, 그리고 그것이 실행 얻을하는 방법을 모른다 바르게.

아래에 게시 된 build.gradle 파일을 한 번 봐, 그리고 나를이

build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules. 
buildscript { 
repositories { 
    jcenter() 
} 
dependencies { 
    classpath 'com.android.tools.build:gradle:1.3.0' 

    // NOTE: Do not place your application dependencies here; they belong 
    // in the individual module build.gradle files 
} 
} 
allprojects { 
repositories { 
    jcenter() 
} 
} 
task clean(type: Delete) { 
delete rootProject.buildDir 
} 

android { 
compileSdkVersion 23 
buildToolsVersion '23.0.1' 
} 
dependencies { 
} 

build.gradle을 실행 얻는 방법을 알려 주시기 바랍니다 :

apply plugin: 'com.android.application' 

android { 
compileSdkVersion 23 
buildToolsVersion "23.0.2" 

defaultConfig { 
    applicationId "com.example.com.ecoassistant_03" 
    minSdkVersion 21 
    targetSdkVersion 22 
    versionCode 1 
    versionName "1.0" 
} 
buildTypes { 
    debug { 
     debuggable true 
    } 
    release { 
     minifyEnabled false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    } 
} 
} 

dependencies { 
compile fileTree(include: ['*.jar'], dir: 'libs') 
compile 'com.android.support:design:23.1.1' 
compile 'com.android.support:appcompat-v7:23.1.1' 
compile 'com.android.support:support-v4:23.1.1' 
compile files('libs/Jama-1.0.3.jar') 
compile files('libs/drivingEfficiencyModuleRunnable_00_out.jar') 
} 

업데이트 :

enter image description here

답변

0

귀하의 오류는 당신에게 정확한 문제를 알려줍니다. 발견되지

Gradle을의 DSL 방법 : '안드로이드()'

는 최고 수준의 build.gradle에서이 android 부분을 제거합니다. Android 플러그인이 해당 파일에 적용되지 않았습니다.

android { 
    compileSdkVersion 23 
    buildToolsVersion '23.0.1' 
} 
dependencies { 
} 

즉, 문제를 해결하지만, 여기에 몇 가지 메모

이 라인이 필요하지 않습니다있어 것입니다.

compile 'com.android.support:design:23.1.1' 

중,이 모든 당신은 이미 종속 섹션

compile files('libs/Jama-1.0.3.jar') 
compile files('libs/drivingEfficiencyModuleRunnable_00_out.jar') 

의 첫 번째 라인을 컴파일 그리고이 라인을 따라 두 가지를 컴파일, 그래서 사람들은 필요하지 않습니다 당신은 내가 그 "에서는 MyApplication"이라는 프로젝트가 내 주요 프로젝트 "ecoassistant_03"의 파일 중 하나입니다 프로그래머 세 Gradle을 파일가 발견, 지금, 내 질문에 업데이트 된 응용 프로그램

dependencies { 
    compile fileTree(include: ['*.jar'], dir: 'libs') 
    compile 'com.android.support:design:23.1.1' 
} 
+0

을 구축해야 s로 표시됩니다. 그 여분의 프로젝트 "myapplication"을 제거하는 방법, 나는 그것을 만들지 않았다 – user2121

+0

그것은 건물에서 아무것도 막는가? 'settings.gradle'에 포함되어 있습니까? 아니요, 아무 것도하지 않으면 삭제할 수 있습니다. –

+0

setting.gradle에 다음이 포함되어 있습니다. include ': app', ': myapplication', ': myapplication' – user2121

관련 문제