Could not find method implementation() for arguments [com.android.support:appcompat-v7:25.4.0] on object…android

后端 未结 4 1539
栀梦
栀梦 2021-01-14 04:40

I have to compile a project purchased on line. On importing it into android studio..it complained about the gradle version so i updated the distributionUrl to this dis

相关标签:
4条回答
  • 2021-01-14 05:12

    1.Open the build.gradle file for your application. 2.Make sure that the repositories section includes a maven section with the "https://maven.google.com" endpoint. For example:

    allprojects {
        repositories {
            jcenter()
            maven {
                url "https://maven.google.com"
            }
        }
    }
    
    0 讨论(0)
  • 2021-01-14 05:23

    In my case i have found out that in app.gradle file

    implementationSdkVersion 27

    was there instead of

    compileSdkVersion 27

    so put it like below

     compileSdkVersion 28
    defaultConfig {
        applicationId "com.kotlinpractise"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    
    0 讨论(0)
  • 2021-01-14 05:29

    In case you are still getting the error try changing android/build.gradle of your package in node_modules from implementation to compile. Worked for me. You can use the following command inside your project folder.

    sed -i -s "s#implementation#compile#" node_modules/your-react-native-package-name/android/build.gradle
    
    0 讨论(0)
  • 2021-01-14 05:33

    To use implementation() you need to use gradle v.4 and the gradle plugin v.3

    Use:

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

    and

    buildscript {
        repositories {
            ...
            // You need to add the following repository to download the
            // new plugin.
            maven {
                url "https://maven.google.com"
            }            
            //google()  //only if you use Android Studio 3.x
        }
    
        dependencies {
            classpath 'com.android.tools.build:gradle:3.0.0-beta7'
        }
    }
    

    More info here.

    0 讨论(0)
提交回复
热议问题