2017-08-29 14 views
1

私のAndroidのバージョンは2.3.3です。私はアンドロイドSDK(26)を更新します。更新後にエラーが発生します。 build.gradleに問題があります。私のコードは何が間違っていますか? DSL実装()の使い方このプロジェクトを実行するように設定するにはどうすればよいですか?gradle原因を構築する:DSLメソッドが見つかりません: 'implementation()'

build.gradle(プロジェクト)

buildscript { 
    repositories { 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:2.3.3'  
     // 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 
} 

build.gradle(モジュール)

apply plugin: 'com.android.application'  
android { 
    compileSdkVersion 26 
    buildToolsVersion "26.0.1" 
    defaultConfig { 
     applicationId "com.ppl.restaurant" 
     minSdkVersion 16 
     targetSdkVersion 26 
     versionCode 1 
     versionName "1.0" 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 
allprojects { 
    repositories { 
     jcenter() 
     maven { 
      url "https://maven.google.com" 
     } 
    } 
} 
dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
     exclude group: 'com.android.support', module: 'support-annotations' 
    }) 
    compile 'com.android.support:appcompat-v7:26.0.1' 
    compile "com.android.support:support-core-utils:26.0.1" 
    implementation 'info.androidhive:barcode-reader:1.1.2' 
    implementation 'com.google.android.gms:play-services-vision:11.0.2' 
    compile 'com.android.support.constraint:constraint-layout:1.0.2' 
    testCompile 'junit:junit:4.12' 
} 

エラーメッセージ

Error:(38, 0) Gradle DSL method not found: 'implementation()' 
Possible causes:<ul><li>The project 'Restaurant' may be using a version of the Android Gradle plug-in that does not contain the method (e.g. 'testCompile' was added in 1.1.0). 
<a href="fixGradleElements">Upgrade plugin to version 2.3.3 and sync project</a></li><li>The project 'ABC' may be using a version of Gradle that does not contain the method. 
<a href="open.wrapper.file">Open Gradle wrapper file</a></li><li>The build file may be missing a Gradle plugin. 
<a href="apply.gradle.plugin">Apply Gradle plugin</a></li> 
+0

セット 'クラスパス 'com.android.tools.build:Gradleの:2.3.3'すでに設定 –

+0

はい.. –

+0

は –

答えて

0

あなたは、公式ドキュメントに読み込むことができるため、implementation() DLSが必要(現在)

  • グラッドv4
  • Androidスタジオ3.x.
  • gradle-wrapper.properties使用する際に使用するのAndroid 3.xの

試し用のGradleプラグイン:Androidの使用のための

distributionUrl=\ 
    https\://services.gradle.org/distributions/gradle-4.1-rc-1-all.zip 

としてのGradleプラグイン:migration to plugin v3 hereについて

classpath 'com.android.tools.build:gradle:3.0.0-beta1' 

詳しい情報を。

+0

私はベータ版を使いたくないので、安定版2.3.3を使いたいです。どんな方法ですか? –

+0

@AprilMoeこの場合、プロジェクト内の他の依存関係としてcompile()を使用できます。 2.3.3でimplementation()を使用する方法はありません。 –

+0

Androidスタジオ3、ベータ2をダウンロードし、 'classpath 'com.android.tools.buildを設定してください:gradle:3.0.0-beta2''' distributionUrl = \ https \://services.gradle.org/distributions/gradle -4.1-rc-1-all.zip'。 –

0

私はこのようにそれを解決した:

コンパイル 'com.facebook.android:facebook-login:4.28.0' あなたがたがアンドロイドスタジオ2.3と "実装" を使用するには、Androidのスタジオ3.0を必要とする

"コンパイル"を伴う作業

PD:申し訳ありません私の英語です。私のために働く

コンパイル 'com.facebook.android:facebook-login:4.28.0' を

1

お使いの "コンパイル" とアンドロイドスタジオ2.3、これを使用したい場合。

関連する問題