2017-11-27 9 views
1

을 가져 오려고합니다. 내가 안드로이드 스튜디오 3.0.1Gradle을 플러그인 3.0.0을 사용하고오류 : 인수에 대한 메서드 annotationProcessor()를 찾을 수 없습니다. 에서 제안한대로 <strong>DBflow</strong>을 가져 오려고합니다.

Error:(27, 0) Could not find method annotationProcessor() for arguments [com.github.Raizlabs.DBFlow:dbflow-processor:4.1.2] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

: 프로젝트 레벨 build.gradle 파일을 수정하고 동기화 시도 후, 나는 다음과 같은 오류가 발생합니다. 여기

내 Gradle을 파일입니다

build.gradle (프로젝트)

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

buildscript { 

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


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

allprojects { 
    repositories { 
     google() 
     jcenter() 
     maven { url "https://www.jitpack.io" } 
    } 

    def dbflow_version = "4.1.2" 

    dependencies { 
     annotationProcessor "com.github.Raizlabs.DBFlow:dbflow-processor:${dbflow_version}" 
     compile "com.github.Raizlabs.DBFlow:dbflow-core:${dbflow_version}" 
     compile "com.github.Raizlabs.DBFlow:dbflow:${dbflow_version}" 
    } 
} 

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

응용 프로그램/build.gradle (applicaton)

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 26 
    buildToolsVersion "26.0.2" 

    defaultConfig { 
     applicationId "com.my.app.id" 
     minSdkVersion 21 
     targetSdkVersion 26 
     versionCode 1 
     versionName "1.0" 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
    } 
    buildTypes { 
     debug { 
      buildConfigField "String", "BASE_URL", "\"http://myapiurl.com/\"" 
     } 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
    repositories { 
     mavenCentral() 
     google() 
     maven { url 'https://jitpack.io' }    
    } 
} 

dependencies { 
    implementation fileTree(dir: 'libs', include: ['*.jar']) 
    implementation 'com.android.support:appcompat-v7:26.1.0' 
    implementation 'com.android.volley:volley:1.0.0' 
    implementation 'com.android.support:support-v4:26.1.0' 
    implementation 'com.android.support:design:26.1.0' 
    testImplementation 'junit:junit:4.12' 
    androidTestImplementation 'com.android.support.test:runner:1.0.1' 
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' 
} 

이 될 수 있습니다 무엇 이 문제의 원인과 해결 방법은 무엇입니까?

답변

0

모듈 수준build.gradle에 라이브러리를 추가하십시오.

제거 최상위 ​​파일이 블록 :

def dbflow_version = "4.1.2" 

    dependencies { 
      annotationProcessor "com.github.Raizlabs.DBFlow:dbflow-processor:${dbflow_version}" 
      compile "com.github.Raizlabs.DBFlow:dbflow-core:${dbflow_version}" 
      compile "com.github.Raizlabs.DBFlow:dbflow:${dbflow_version}" 
    } 
+1

덕분에,이 일했다. 어쨌든, 나는 안드로이드 ** 프로젝트 **에서 ** 프로젝트 레벨 ** gradle은 ** top-level **와 동일하다고 생각했습니다. 적어도 Android Studio는'build.gradle (Project : my-project-name) '과 같은 것을 보여 주지만 다른 build.gradle은 ** 모듈 수준 ** 또는 ** 응용 프로그램 수준 **이라고 부릅니다. 'build.gradle (Module : app)'로 표시됩니다. – Sam