How add mavenCentral to gradle in dev of nativescript plugin - android

I am writing a plugin for NativeScript but I have troubles with the gradle file,
how can I add the mavencentral() to the repositories tag in buildScript and an "apply instruction" ? example:
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:2.1.2"
classpath 'com.google.gms:google-services:3.0.0'
}
}
apply plugin: "com.android.application"
apply plugin: 'com.google.gms.google-services'
I tried to add this to the include.gradle for my plugin but when I add this plugin in my app project, the build process fails.

Related

Problem after updating to latest kotlin version

I updated my kotlin version to 1.4.20 in project build.gradle file in Android Studio. But, i am not able sync my project. I am getting this error:
A problem occurred configuring root project 'Modules'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not find kotlin-scripting-compiler-embeddable-1.4.20.jar (org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:1.4.20).
Searched in the following locations:
https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-scripting-compiler-embeddable/1.4.20/kotlin-scripting-compiler-embeddable-1.4.20.jar
> Could not find kotlin-stdlib-common-1.4.20.jar (org.jetbrains.kotlin:kotlin-stdlib-common:1.4.20).
Searched in the following locations:
https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-stdlib-common/1.4.20/kotlin-stdlib-common-1.4.20.jar
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
I also went to Tools->Kotlin->Configure Kotlin Plugin Updates and installed the latest kotlin. Still i am getting this error.
So, What could be the reason?
build.gradle (Modules)
buildscript {
ext {
kotlinVersion = "1.4.20"
gradleVersion = '4.0.0'
}
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:${gradleVersion}"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}"
classpath "org.jetbrains.kotlin:kotlin-allopen:${kotlinVersion}"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
build.gradle (:app)
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply from: "$rootDir/gradle/local-aar.gradle"
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath "com.google.gms:google-services:${gmsLibVersion}"
}
}
apply plugin: 'com.google.gms.google-services'
//Rest of the code

Failed to update the android gradle plugin 3.5.0

buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
//classpath 'com.android.tools.build:gradle:3.2.0-alpha09'
classpath 'com.google.gms:google-services:4.3.2'
classpath 'com.google.firebase:firebase-plugins:2.0.0'
/*classpath 'com.google.gms:google-services:3.2.1'
classpath 'com.google.firebase:firebase-plugins:1.2.0'*/
classpath 'com.google.guava:guava:24.1-jre'
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
flatDir {
dirs '../libs'
}
google()
maven { url "https://jitpack.io" }
}
tasks.withType(JavaCompile) {
options.incremental = true
}
}
ERROR: Gradle DSL method not found: '19.0.0()'
Possible causes:
The project 'Rightrend-20190527-2051' may be using a version of the Android Gradle plug-in that does not contain the method (e.g. 'testCompile' was added in 1.1.0).
Upgrade plugin to version 3.5.0 and sync project
The project 'Rightrend-20190527-2051' may be using a version of Gradle that does not contain the method.
Open Gradle wrapper file
The build file may be missing a Gradle plugin.
Apply Gradle plugin
I fix this error by adding this line to .gradle file (app)
Gradle DSL method not found: 'kapt()'
Possible causes:
The project 'Isfahan Metro' may be using a version of the Android Gradle plug-in that does not contain the method (e.g. 'testCompile' was added in 1.1.0).
Upgrade plugin to version 3.5.3 and sync project
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt' // add this
for your problem check this link.
https://stackoverflow.com/answer
move google() above.
Open your gradle-wrapper.properties file, and update distributionUrl to https://services.gradle.org/distributions/gradle-5.4.1-all.zip
This is the wrongful line, because Guava is not a Gradle plugin:
classpath 'com.google.guava:guava:24.1-jre'
In "classpath" alter for "implementation" (update your dependencies):
dependencies {
implementation'com.android.tools.build:gradle:3.5.0'
//implementation'com.android.tools.build:gradle:3.2.0-alpha09'
implementation'com.google.gms:google-services:4.3.2'
implementation'com.google.firebase:firebase-plugins:2.0.0'
/*implementation'com.google.gms:google-services:3.2.1'
implementation'com.google.firebase:firebase-plugins:1.2.0'*/
implementation'com.google.guava:guava:24.1-jre'
}

ERROR: Could not find com.android.tools.build:gradle:3.1.4.Required by: com.jakewharton:butterknife-gradle-plugin:10.1.0

While integrating WorkManager in my Application, I updated my app settings as follows:
androidMinSdkVersion = 15
androidTargetSdkVersion = 28
androidCompileSdkVersion = 28
androidBuildToolsVersion = "28.0.0"
Due to version upgrade to 28 I had to update gradle too.
gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
Project.gradle
buildscript {
repositories {
// Gradle 4.1 and higher include support for Google's Maven repo using
// the google() method. And you need to include this repo to download
// Android Gradle plugin 3.0.0 or higher.
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.google.gms:google-services:3.0.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
maven { url "http://dl.bintray.com/populov/maven" }
maven { url "https://jitpack.io" }
maven { url "https://maven.google.com" }
mavenCentral()
jcenter()
gradlePluginPortal()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Due to all these changes(mainly WorkManger), I had to (was forced to) upgrade the butterknife library version to 9.0.0 at least.
So I updated it as follows in my app.gradle file
apply plugin: 'com.android.library'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'com.jakewharton.butterknife'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'me.tatarka:gradle-retrolambda:3.2.3'
classpath 'com.jakewharton:butterknife-gradle-plugin:10.1.0'
}
}
But whenever I try to clean-build I keep getting following error in logcat.
ERROR: Could not find com.android.tools.build:gradle:3.1.4.
Searched in the following locations:
- https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/3.1.4/gradle-3.1.4.pom
- https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/3.1.4/gradle-3.1.4.jar
Required by:
project :_btn_payment > com.jakewharton:butterknife-gradle-plugin:10.1.0
Any help is appreciated.
You should move your classpath 'com.jakewharton:butterknife-gradle-plugin:10.1.0' to Project.gradle
butterknife 10.x only supports AndroidX-enabled builds.
You will changed to version 9.0.0
From gradle gradle plugin 3.0 apt has deprecated,delete classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
library build.gradle
apply plugin: 'com.android.library'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'com.jakewharton.butterknife'
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'me.tatarka:gradle-retrolambda:3.2.3'
classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0'
}
}

android studio plugin with id: 'kotlin-android-extensions'

I am using gradle and I am trying to add kotlin to my project. But when I am trying to add 'kotlin-android-extensions' plugin for gradle it fails to find it.
To use the plugin, you have to add it in your root level file:
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com'
}
}
ext.kotlin_version = '1.1.2-4'
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Try to add the following to your gradle.build file
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
after that you have to make some changes in your dependencies classpath like this.
buildscript {
ext.kotlin_version = '1.1.60'
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
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
}
}
and in dependencies compile make sure to add jre7 such that.
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
After doing all that rebuild the gradle and you are all done. This worked for me because i was facing the same problem you are now, and after this it's all done. Hope it works for you tooo....
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:+"
try this

“Plugin with id 'com.android.application' not found”

I am getting “Plugin with id 'com.android.application' not found”. I have updated the gradle distribution version in gradle wrapper properties but to no avail. Do I need to write the build gradle dependencies somewhere?
You have to add in your top level file:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
}
}

Categories

Resources