Reputation: 686
I have seen this question posted in several places. The issue seems to be with updating past gradle version 3 and android studio version 3. Whenever I change my dependencies to a newer version I keep getting the error:
Could not find method implementation() for arguments [androidx.appcompat:appcompat:1.1.0-rc01] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Here is my build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
}
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-alpha02'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
google()
jcenter()
}
dependencies {
classpath('com.android.tools.build:gradle:3.5.0')
}
}
my gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
I appreciate any help. Been trying to get my app running on Android for a day now.
Upvotes: 1
Views: 2509
Reputation: 363707
Remove these lines in the buildscript
block of the top level file:
//implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
//implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-alpha02
You have to add these dependencies in the the dependencies
block of the module/build.gradle
file.
Also remove the dependencies
block inside the allprojects
block
buildscript {
ext {
//...
}
repositories {
//..
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
}
}
allprojects {
repositories {
//..
google()
jcenter()
}
}
Upvotes: 6