Не удалось найти реализацию метода () для аргументов [com.google. android: support-v4: r7] - PullRequest
0 голосов
/ 04 мая 2020

Я всего Android / Java newb ie, и наткнулся на проект, который хочу скомпилировать ниже:

https://github.com/maxamillion32/Android-Firebase-mapping

Он немного устарел и, возможно, поэтому вызывает у меня проблемы.

Первая ошибка, которую я получил по поводу Build Tools 24.0.1, которые я скачал. Теперь я получаю следующую ошибку, которую не могу исправить:

Caused by: org.gradle.internal.metaobject.AbstractDynamicObject$CustomMessageMissingMethodException: Could not find method implementation() for arguments [com.google.android:support-v4:r7] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

Я проверил свои зависимости в File> Project Structure и com.google. android: support-v4: r7 is there.

build.gradle (Project)

// 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.6.3'
        classpath 'com.google.gms:google-services:4.3.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

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

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

build.gradle (app)

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

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.3"
    defaultConfig {
        applicationId "com.mimming.hacks.starter"
        minSdkVersion 19
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE-FIREBASE.txt'
        exclude 'META-INF/NOTICE'
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation 'com.android.support:appcompat-v7:23.4.0'
    implementation 'com.google.android.gms:play-services:9.6.1'
    testImplementation 'junit:junit:4.12'

//    compile 'com.firebase:firebase-client-android:2.5.2+'
    apply plugin: 'com.google.gms.google-services'
    implementation 'com.google.firebase:firebase-database:9.6.1'

}

Есть идеи? Спасибо!

1 Ответ

1 голос
/ 05 мая 2020

Используемая версия gradle, похоже, имеет более низкую версию, для использования implementation версия gradle должна быть выше 3

  1. Вы должны заменить свои зависимости в build.gradle на последнюю версию.
classpath 'com.android.tools.build:gradle:3.6.3'
Также вам нужно будет обновить distributionUrl также
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip

Как вы уже упоминали, вы обновили buildToolsVersion, это должно работать нормально, а также убедитесь, что все зависимости используют implementation, а не compile, поскольку компиляция устарела.

...