web-dev-qa-db-ja.com

エラー:「構成「コンパイル」は廃止され、「実装」に置き換えられました。」

次のgradleファイルがあり、警告「Configuration 'compile'は廃止され、 'implementation'。 "

最初のモジュールGradleファイル:

   buildscript {
        repositories { maven { url 'https://maven.fabric.io/public' } }
        dependencies { classpath 'io.fabric.tools:gradle:1.24.1' }
    }
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

apply plugin: 'com.Android.application'
apply plugin: 'kotlin-Android'
apply plugin: 'kotlin-Android-extensions'
apply plugin: 'io.fabric'
apply plugin: 'kotlin-kapt'

def keystorePropertiesFile = rootProject.file("keystore.properties")
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))


Android {
    compileSdkVersion 27
    defaultConfig {
        multiDexEnabled true
        applicationId "com.example.something"
        minSdkVersion 19
        targetSdkVersion 27
        testInstrumentationRunner 'Android.support.test.runner.AndroidJUnitRunner'
        vectorDrawables.useSupportLibrary = true
    }
    dataBinding { enabled = true }

    flavorDimensions "flavors"
    productFlavors {
        flavorBeta {
            minSdkVersion 19
            applicationId 'com.example.something'
            targetSdkVersion 27
            versionCode 1000012
            versionName "beta test"
            dimension "flavors"
        }
    }
    signingConfigs {
        config {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile file(keystoreProperties['storeFile'])
            storePassword keystoreProperties['storePassword']
        }
    }

    buildTypes {
        debug {
        }
        release {
            minifyEnabled true
            shrinkResources false
            proguardFiles getDefaultProguardFile('proguard-Android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.config
            debuggable false
        }
    }

    sourceSets {
        main.Java.srcDirs += 'src/main/kotlin'
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')

    implementation('com.crashlytics.sdk.Android:crashlytics:[email protected]') {
        transitive = true
    }
    // kotlin:
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    implementation "org.jetbrains.anko:anko-common:$anko_version"
    implementation "org.jetbrains.anko:anko-commons:$anko_version"
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.21.2'

    // support libraries:    
    implementation "com.Android.support:recyclerview-v7:$support_version"
    implementation "com.Android.support:support-v4:$support_version"
    implementation "com.Android.support:design:$support_version"
    implementation "com.Android.support:appcompat-v7:$support_version"
    implementation "com.Android.support:cardview-v7:$support_version"
    implementation "com.Android.support:support-vector-drawable:$support_version"
    // misc:
    implementation 'com.github.d-max:spots-dialog:[email protected]'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.Android.support.constraint:constraint-layout:1.1.0-beta4'
    implementation 'com.backendless:backendless:4.4.0'
    implementation 'io.nlopez.smartlocation:library:3.3.2'

    // Google services:
    implementation "com.google.firebase:firebase-core:$google_services_version"
    implementation "com.google.firebase:firebase-auth:$google_services_version"
    implementation 'com.firebaseui:firebase-ui-auth:3.1.3'
    implementation "com.google.Android.gms:play-services-location:$google_services_version"
    implementation "com.google.Android.gms:play-services-auth:$google_services_version"
}
apply plugin: 'com.google.gms.google-services'

///////////////////// AND ////////////////////

次に、プロジェクトレベルのGradleファイルを示します。

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

buildscript {
    ext.kotlin_version = '1.2.21'
    ext.support_version = '27.0.2'
    ext.anko_version = '0.10.3'
    ext.Android_plugin_version = '3.0.1'
    ext.google_services_version = '11.8.0'

    repositories {
        google()
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'com.Android.tools.build:gradle:3.1.0-beta1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath "org.jetbrains.kotlin:kotlin-Android-extensions:$kotlin_version"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.google.gms:google-services:3.1.1'
    }
}

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

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

///////////////////////////

編集済み:以下の同期およびビルドの完全なログを追加しています:

Executing tasks: [:app:generateFlavorBetaDebugSources]

Configuration on demand is an incubating feature.
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation'.
It will be removed at the end of 2018
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
app: 'annotationProcessor' dependencies won't be recognized as kapt annotation processors. Please change the configuration name to 'kapt' for these artifacts: 'com.Android.databinding:compiler:3.1.0-beta3'.
:app:preBuild UP-TO-DATE
:app:preFlavorBetaDebugBuild UP-TO-DATE
:app:compileFlavorBetaDebugAidl UP-TO-DATE
:app:compileFlavorBetaDebugRenderscript UP-TO-DATE
:app:checkFlavorBetaDebugManifest UP-TO-DATE
:app:generateFlavorBetaDebugBuildConfig UP-TO-DATE
:app:prepareLintJar UP-TO-DATE
:app:mainApkListPersistenceFlavorBetaDebug UP-TO-DATE
:app:mergeFlavorBetaDebugShaders UP-TO-DATE
:app:compileFlavorBetaDebugShaders UP-TO-DATE
:app:generateFlavorBetaDebugAssets UP-TO-DATE
:app:mergeFlavorBetaDebugAssets
:app:processFlavorBetaDebugGoogleServices
Parsing json file: C:\Users\some_path\app\google-services.json
:app:createFlavorBetaDebugCompatibleScreenManifests UP-TO-DATE
:app:processFlavorBetaDebugManifest UP-TO-DATE
:app:fabricGenerateResourcesFlavorBetaDebug
:app:generateFlavorBetaDebugResValues UP-TO-DATE
:app:generateFlavorBetaDebugResources UP-TO-DATE
:app:mergeFlavorBetaDebugResources
:app:splitsDiscoveryTaskFlavorBetaDebug UP-TO-DATE
:app:processFlavorBetaDebugResources
:app:generateFlavorBetaDebugSources

BUILD SUCCESSFUL in 19s
18 actionable tasks: 5 executed, 13 up-to-date

同期ログ:

registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
app: 'annotationProcessor' dependencies won't be recognized as kapt annotation processors. Please change the configuration name to 'kapt' for these artifacts: 'com.Android.databinding:compiler:3.1.0-beta3'.

CONFIGURE SUCCESSFUL in 22s
10
Hoornet

問題は適用プラグインにあります: 'com.google.gms.google-services'

Googleサービスプラグインは、あなたに代わって依存関係を追加しています。彼らが将来それを修正することを願っています。

下のstackoverflowリンクから回答をコピーします。 https://stackoverflow.com/a/49059867/4782538 。答えてくれた@Niklasに感謝します。

4
Bhargav Pandya

Build.gradle内のクラスパスを変更して解決しました(プロジェクト:プロジェクト名)

from 
  classpath 'com.google.gms:google-services:3.1.1' 
to
  classpath 'com.google.gms:google-services:3.2.0'
6
Selu Hadu

クラスパスバージョンへの更新

classpath 'com.Android.tools.build:gradle:3.1.1'
classpath 'com.google.gms:google-services:3.2.0'
1
Tasdemir

私もこの問題を抱えていました、これが私がそれを解決した方法です:

あなたに行きますbuild.gradle(アプリレベル)

build.gradleモジュールアプリ

そして、Word 'compile' 'implementation'

1
Ayoub

すべての「コンパイル」を「実装」に置き換えましたが、同じ問題に直面していました。しかし、最後にbuild.gradle(Project)で次の変更を行うことでこの問題を解決しました。

classpath 'com.google.gms:google-services:3.1.1'

この行で

classpath 'com.google.gms:google-services:4.0.1'

そしてその後、あなたのgradleは、build.gradle(app)にこの行を追加するよりも、firebase-coreを追加するように警告を再度与えることがあります

dependencies{
implementation 'com.google.firebase:firebase-core:16.0.3'
} 

注:すべての問題で更新された依存関係を確認してください。

1
Abdul Mateen

implementation "com.google.firebase:firebase-core:$google_services_version"行であり、11.8.0に解決されると思います(しかし、確信はありません)。私の疑いは./gradlew app:dependenciesを実行することから来ています。

その出力は(とりわけ)以下を与えます:

compile - Compile dependencies for 'main' sources (deprecated: use 'implementation' instead).
\--- com.google.firebase:firebase-core:11.8.0
     \--- com.google.firebase:firebase-analytics:11.8.0
          +--- com.google.Android.gms:play-services-basement:11.8.0
          |    +--- com.Android.support:support-v4:25.2.0
          |    |    +--- com.Android.support:support-compat:25.2.0
          |    |    |    \--- com.Android.support:support-annotations:25.2.0
          |    |    +--- com.Android.support:support-media-compat:25.2.0
          |    |    |    +--- com.Android.support:support-annotations:25.2.0
          |    |    |    \--- com.Android.support:support-compat:25.2.0 (*)
          |    |    +--- com.Android.support:support-core-utils:25.2.0
          |    |    |    +--- com.Android.support:support-annotations:25.2.0
          |    |    |    \--- com.Android.support:support-compat:25.2.0 (*)
          |    |    +--- com.Android.support:support-core-ui:25.2.0
          |    |    |    +--- com.Android.support:support-annotations:25.2.0
          |    |    |    \--- com.Android.support:support-compat:25.2.0 (*)
          |    |    \--- com.Android.support:support-fragment:25.2.0
          |    |         +--- com.Android.support:support-compat:25.2.0 (*)
          |    |         +--- com.Android.support:support-media-compat:25.2.0 (*)
          |    |         +--- com.Android.support:support-core-ui:25.2.0 (*)
          |    |         \--- com.Android.support:support-core-utils:25.2.0 (*)
          |    \--- com.google.Android.gms:play-services-basement-license:11.8.0
          +--- com.google.firebase:firebase-common:11.8.0
          |    +--- com.google.Android.gms:play-services-basement:11.8.0 (*)
          |    +--- com.google.Android.gms:play-services-tasks:11.8.0
          |    |    +--- com.google.Android.gms:play-services-basement:11.8.0 (*)
          |    |    \--- com.google.Android.gms:play-services-tasks-license:11.8.0
          |    \--- com.google.firebase:firebase-common-license:11.8.0
          +--- com.google.firebase:firebase-analytics-impl:11.8.0
          |    +--- com.google.Android.gms:play-services-basement:11.8.0 (*)
          |    +--- com.google.firebase:firebase-iid:11.8.0
          |    |    +--- com.google.Android.gms:play-services-basement:11.8.0 (*)
          |    |    +--- com.google.firebase:firebase-common:11.8.0 (*)
          |    |    +--- com.google.Android.gms:play-services-tasks:11.8.0 (*)
          |    |    \--- com.google.firebase:firebase-iid-license:11.8.0
          |    +--- com.google.firebase:firebase-common:11.8.0 (*)
          |    +--- com.google.Android.gms:play-services-tasks:11.8.0 (*)
          |    \--- com.google.firebase:firebase-analytics-impl-license:11.8.0
          \--- com.google.firebase:firebase-analytics-license:11.8.0

その場合は、firebase-coreライブラリの更新を待つ必要があります。

1
reacuna

この警告は、com.google.gms:google-servicesまたはその他のGradleプラグインが原因です。

Verion 3.1では、Android studioGradleプラグインにコンパイルWordが含まれている場合、この警告が発生します。他の依存関係がある場合は警告も引き起こすWordをコンパイルしますコンパイルは、子孫の実装に置き換えられます

警告付きの依存関係Android studio 3.1

dependencies {
            compile fileTree(dir: 'libs', include: ['*.jar'])
            compile 'com.Android.support:appcompat-v7:27.1.0'
            compile 'com.Android.support.constraint:constraint-layout:1.0.2'
            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'
    }

依存関係OKin Android studio 3.1

    dependencies {
            implementation fileTree(dir: 'libs', include: ['*.jar'])
            implementation 'com.Android.support:appcompat-v7:27.1.0'
            implementation 'com.Android.support.constraint:constraint-layout:1.0.2'
            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'

    }

この投稿を見る

まだ警告が表示されます:構成 'compile'は廃止され、 'implementation'に置き換えられました

0
Didier