【问题标题】:When I run my old android project I get a error message from the build.gradle当我运行我的旧 android 项目时,我从 build.gradle 收到一条错误消息
【发布时间】:2019-11-16 17:23:32
【问题描述】:

当我运行旧的 android 项目时,我收到一条错误消息:

"警告:配置 'compile' 已过时,已替换为 'implementation' 和 'api'。 它将在 2018 年底删除。有关更多信息,请参阅:http://d.android.com/r/tools/update-dependency-configurations.html 受影响的模块:app"

我尝试在所有项目中使用 google(),但收到相同的错误消息。

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27

    defaultConfig {
        applicationId "com.example.android.firebaseupload"
        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'
        }
    }
    allprojects {
        repositories {
            jcenter()
            maven {
                url 'https://maven.google.com'
            }
        }
    }

        dependencies {

            implementation fileTree(include: ['*.jar'], dir: 'libs')
            androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
                exclude group: 'com.android.support', module: 'support-annotations'
            })


            implementation 'com.android.support.constraint:constraint-layout:1.1.3'
            implementation 'com.android.support:appcompat-v7:27.0.+'
            implementation 'com.google.firebase:firebase-storage:17.0.0'
            implementation 'com.google.firebase:firebase-auth:17.0.0'
            implementation 'com.google.firebase:firebase-database:17.0.0'
            implementation 'com.github.gcacace:signature-pad:1.2.1'
            implementation 'com.squareup.picasso:picasso:2.5.0'
            implementation 'com.github.bumptech.glide:glide:3.7.0'
            implementation 'com.android.support:recyclerview-v7:27.0.0'
            implementation 'com.android.support:cardview-v7:27.0.0'
            implementation 'com.firebaseui:firebase-ui-database:0.4.0'
            implementation 'com.android.support:design:27.0.0'
            implementation 'com.android.support:support-v4:27.0.0'
            implementation 'com.google.android.gms:play-services-plus:17.0.0'
            testImplementation 'junit:junit:4.12'
        }





}

应用插件:'com.google.gms.google-services'

"警告:配置 'compile' 已过时,已替换为 'implementation' 和 'api'。 它将在 2018 年底删除。有关更多信息,请参阅:http://d.android.com/r/tools/update-dependency-configurations.html 受影响的模块:app"

【问题讨论】:

  • 尝试使缓存无效
  • repositories 中添加google(),然后在您的项目中添加cleanRebuild。之后,如果不运行,那么@Ticherhaz 说的try invalidate cache。希望它会奏效。如果没有,请告诉我们。
  • 这只是一个警告,即使存在,一切都会好起来的。

标签: android android-studio android-gradle-plugin


【解决方案1】:

看来问题出在:

implementation 'com.github.gcacace:signature-pad:1.2.1'

查看此链接

[https://github.com/gcacace/android-signaturepad/blob/master/SignaturePad-Example/build.gradle][1]

看起来开发人员已经有一段时间没有更新他的代码了,所以你的解决方案是:

1- 以 zip 格式下载 https://github.com/gcacace/android-signaturepad

2- 在应用模块中打开其 Gradle 文件并将 compile 替换为 implementation

3-确保没有Compile关键字后,进入Android Studio中的Android项目点击文件->新建->导入模块->选择您提取项目并编辑它的文件夹,就是这样

  • 确保所有依赖项都使用最新版本

【讨论】:

    【解决方案2】:

    尝试添加

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

    在你的 gradle 文件的第二行

    【讨论】:

      猜你喜欢
      • 2019-11-05
      • 2021-07-13
      • 1970-01-01
      • 2018-05-23
      • 2020-09-11
      • 2021-10-13
      • 2022-06-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多