Android Studio build.gradle предупреждающее сообщение [дубликат]



этот вопрос уже есть ответ здесь:




  • Все еще получаю предупреждение : конфигурация 'compile' устарела и была заменена на 'implementation'

    21 ответов



после успешного обновления до Android Studio 3.1 Canary 9 я получаю предупреждающее сообщение как



Warning:Configuration 'compile' is obsolete and has been replaced with 'implementation'.
It will be removed at the end of 2018


Я знаю, что это предупреждение не вызовет каких-либо проблема в моем проекте, по крайней мере сейчас. Но я хочу удалить его полностью, чтобы в будущем не было никаких проблем. Но после просмотра моей сборки.gradle file я не могу найти ни одной строки кода, которая вызвала это предупреждение вообще.



вот моя сборка.gradle file



apply plugin: 'com.android.application'

android {
compileSdkVersion 27
defaultConfig {
applicationId "app.project.virtualdiary"
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.0.2'
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'
implementation 'com.android.support:support-v4:27.0.2'
implementation 'com.android.support:support-vector-drawable:27.0.2'
}


apply plugin: 'com.google.gms.google-services'
617   6  

6 ответов:

проблема заключается в apply plugin: 'com.google.gms.google-services'

плагин Google Services добавляет зависимость от вашего имени. Надеюсь, они исправят это в будущем.

у меня есть одно и то же предупреждение, вызванное com.гуглить.gms: google-сервисы.

решение: обновить classpath com.гуглить.gms: google-сервисы для classpath ' com.гуглить.gms: google-services: 3.2.0 ' in file in build.проект gradle:

enter image description here

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

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

allprojects {
    repositories {
        jcenter()
        google()
    }
}

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

В студии, версия Андроид 3.1 соблюдение зависимостей слово заменено на реализация

зависимости с предупреждением в 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'
    }

зависимостей ОК в 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'

    }

Gradel генерирует Android Studio 3.1 для нового проекта.

Gradel generate by Android Studio 3.1 for new project.

посещение https://docs.gradle.org/current/userguide/dependency_management_for_java_projects.html

дополнительные сведения https://docs.gradle.org/current/userguide/declaring_dependencies.html

удачи

Я согласен с Никласом. Я изменил compile до implementation, но предупреждение исчезло только после изменения в build.gradle(Project: .....)

перед:

 dependencies {
        classpath 'com.android.tools.build:gradle:3.1.0'
        classpath 'com.google.gms:google-services:3.0.0'
    }

после:

dependencies {
        classpath 'com.android.tools.build:gradle:3.1.0'
        classpath 'com.google.gms:google-services:3.2.0'
    }

выберите :

  1. построить
  2. очистить проект, а затем построить
  3. сделать проект в Android studio

Когда AndroidManifest.имя пакета xml отличалось от build.имя пакета gradle я получаю эту ошибку

конфигурация 'compile' устарела и была заменена на "реализация". Он будет удален в конце 2018

ошибка компиляции Java

измените "compile "на"implementation". эта проблема будет исправлена! она работает на моем компьютере.

Comments

    Ничего не найдено.