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
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"
}
}
}
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"
}
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
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.