2017-11-27 75 views
1

their readmeのようにDBflowをインポートしようとしています。プロジェクトレベルのbuild.gradleファイルを変更し、同期しようとした後、私は次のエラーを取得する:エラー:引数のメソッドannotationProcessor()が見つかりません

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.

私はのAndroid Studioの3.0.1、およびのGradleプラグイン3.0.0を使用しています。ここで

は私の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

おかげで、これは働いていました。とにかく、私はアンドロイド**プロジェクト**で、**プロジェクトレベル**グラデルは**トップレベル**と同じであると思っていました。少なくともAndroid Studioでは 'build.gradle(Project:my-project-name) 'のように表示され、もう一方のbuild.gradleは**モジュールレベル**または**アプリケーションレベル**と呼ばれます'build.gradle(Module:app)'として表示されます。 – Sam

関連する問題