问题
build.gradle(project):
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.sheikhrasik.countries"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
def lifeCycleExtensionVersion = '1.1.1'
def supportVersion = '28.0.0'
def retrofitVersion = '2.3.0'
def daggerVersion = '2.13'
def glideVersion = '4.8.0'
def mockitoVersion = '2.11.0'
def rxJavaVersion = '2.0.1'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
//retrofit
implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
implementation "com.squareup.retrofit2:converter-gson:$retrofitVersion"
implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofitVersion"
//rxJava & rxAndroid
implementation "io.reactivex.rxjava2:rxjava:$rxJavaVersion"
implementation "io.reactivex.rxjava2:rxandroid:$rxJavaVersion"
//dagger
implementation "com.google.dagger:dagger-android:$daggerVersion"
implementation "com.google.dagger:dagger-android-support:$daggerVersion"
annotationProcessor "com.google.dagger:dagger-android-processor:$daggerVersion"
annotationProcessor "com.google.dagger:dagger-compiler:$daggerVersion"
//recyclerView
implementation "com.android.support:recyclerview-v7:$supportVersion"
//glide
implementation "com.github.bumptech.glide:glide:$glideVersion"
//appCompat
implemetation "com.android.support:appcompat-v7:$supportVersion"
//lifecycleExtensions
implemetation "android.arch.lifecycle:extensions:$lifeCycleExtensionVersion"
testImplementation 'junit:junit:4.12'
//mockito
testImplementation "org.mockito:mockito-inline:$mockitoVersion"
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
bulid.gradle (Module):
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.71'
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
name 'Google'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
When i sync my project i get the following error:
Caused by: org.gradle.internal.metaobject.AbstractDynamicObject$CustomMessageMissingMethodException: Could not find method implemetation() for arguments [com.android.support:appcompat-v7:28.0.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
I'm unable to solve the error and therefore not able to start my project, Please provide the best solution possible for this error.
回答1:
you just type implementation instead of implemetation (You missed the letter n) :)
//appCompat
implementation "com.android.support:appcompat-v7:$supportVersion"
//lifecycleExtensions
implementation "android.arch.lifecycle:extensions:$lifeCycleExtensionVersion"
回答2:
org.gradle.internal.metaobject.AbstractDynamicObject$CustomMessageMissingMethodException: Could not find method implemetation() for arguments [com.android.support:appcompat-v7:28.0.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
You already moved to Androidx. So kindly remove support support:appcompat-v7
implemetation "com.android.support:appcompat-v7:$supportVersion"
Rectify your allprojects{}
section. Use google()
.
allprojects {
repositories {
jcenter()
google()
}
}
来源:https://stackoverflow.com/questions/60867930/could-not-find-method-implemetation-for-arguments-com-android-supportappcomp