Can't downgrade Android Gradle plugin version - android

What could be the reason I can't downgrade Android Gradle plugin version?
I have updated to Gradle plugin 2.0 and now I want to use 1.5 but my installed Android Studio says :
> Error:The project is using an incompatible version of the Android
> Gradle plugin. Please update your project to use version 2.1.0
classpath 'com.google.gms:google-services:2.0.0-alpha6'
ad requested in Google Analytics latest version , but the Gradle not working as i want so i want to return to 1.5 .
this is my Gradle file :
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.google.gms:google-services:2.0.0-alpha6'
}
}
repositories {
mavenCentral()
}
allprojects {
repositories {
jcenter()
}
}

Changing to
classpath 'com.google.gms:google-services:1.5.0'
instead
classpath 'com.google.gms:google-services:2.0.0-alpha6'
and in the inner Gradle file :
compile 'com.google.android.gms:play-services:8.4.0'
instead
compile 'com.google.android.gms:play-services:8.3.0'
Solved the problem .
all i need to check now is the affect on the Google Analyticts but the code compiled and run so at least we know for sure what is the incompatible part .

Related

Firebase crashlytics error: Unable to load class 'org.gradle.api.tasks.TaskProvider'

I am trying to update fabric to Firebase crashlytics .
I followed their starting guide given here
The error I am getting are below:
(build.gradle) module-level:
I am using Gradle version: 4.6
distributionUrl=https://services.gradle.org/distributions/gradle-4.6-all.zip
Let me know if needed more info.
OK, Updated Android studio to the latest stable - 4.1
Updated Kotlin to the latest version - 1.14.10
Here's my build gradle file:
buildscript {
ext.kotlin_version = '1.4.10'
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.0"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.4'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.3.0'
}
}
Also, gradle version should be 6.5 in gradle-wrapper.proporties file
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
It's all working now.

How to resolve gradle sonarqube compatibility error? [duplicate]

Android sonarqube worked until I updating android studio. Now it gives an error
FAILURE: Build failed with an exception.
* What went wrong:
com.android.build.gradle.api.ApkVariant.getCompileLibraries()Ljava/util/Collection;
I think this happens because gradle dependency syntax changed from 'compile' to 'implementation' like below in newest android version.
from
dependencies {
compile ........
compile ........
}
to
dependencies {
implementation ........
implementation ........
}
Can anyone please help me to configure sonarqube for new android version
Read the last part of the answer to get the latest updates
Original answer
I've performed some researches:
here you can
find the issue tracked internally by SonarQube
here you
can find the issue opened by a SonarQube developer asking Google
about the API change. As stated by Google engineers this change is intended and an alternative API already exists. SonarQube stated they won't support android plugin 3.0.0 until the final release or at least RC version
Result:
To continue to work you are forced to build your project with the current stable Android Studio and Android plugin v2.X.X
UPDATE - 6th November 2017
SonarQube released the new version 2.6 which is fully compatible with the AGP (Android Gradle Plugin) 3.0.0.
buildscript {
repositories {
google()
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.6.1"
}
}
allprojects {
repositories {
google()
jcenter()
}
}
apply plugin: "org.sonarqube"
More info in the release page HERE
You can use my solution https://github.com/SonarSource/sonar-scanner-gradle/pull/33
buildscript {
repositories {
jcenter()
google()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "com.android.tools.build:gradle:3.0.0"
classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.6-rc1"
}
}
apply plugin: 'org.sonarqube'
After sonarqube 2.6 was released just updating the plugin was enough for me
plugins {
id "org.sonarqube" version "2.6"
}
Updating Benoit answer, the official sonar scanner gradle plugin (v2.6-rc1) already supports the new gradle syntax. So, update your root gradle script to:
buildscript {
repositories {
jcenter()
google()
maven {
url "https://jitpack.io"
}
}
dependencies {
classpath "com.android.tools.build:gradle:3.0.0"
classpath "com.github.SonarSource:sonar-scanner-gradle:2.6-rc1"
}
}
apply plugin: 'org.sonarqube'
Try to use lower version of gradle

Downgrade Android Plugin in Android Studio

I've got two workstations with Android Studio installed. The first one is having version 2.3.3, but the other one is having version 3.0. Both of them are using Gradle 3.3. The problem that I am facing is that when I create an application on the 3.0 system and then transfer it to the 2.3.3 it doesn't want to build. I am receiving
Could not resolve all dependencies for configuration ':classpath'.
> Could not find com.android.tools.build:gradle:3.0.0.
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.jar
I compared a build.gradle file created from the older version of Android Studio and from the newer version
3.0 version:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
2.3.3:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
}
}
allprojects {
repositories {
jcenter()
}
}
From the 3.0 version, I removed "google()", because it was also failing.
I am new to Android Development and I would really appreciate it if you can help me to solve my problem of using one project on both of the environments.
Could not resolve all dependencies for configuration ':classpath'. > Could not find com.android.tools.build:gradle:3.0.0. Searched in the following locations: https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom
It happens because you are using the wrong repository.
If you want to use android plugin for gradle 3.x you have to use:
buildscript {
repositories {
...
// You need to add the following repository to download the
// new plugin.
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
}
}
It requires also gradle v4.+ using in gradle/wrapper/gradle-wrapper.properties :
distributionUrl=\
https\://services.gradle.org/distributions/gradle-4.1-all.zip
If you are using Android Studio 2.x you have to change the repository google() with maven { url "https://maven.google.com" }
If you want to use the android plugin for gradle 2.3.x you can use:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
}
}
and you can use gradle v.3.3 with:
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
Of course in this case you can't use the new DSL introduced with gradle v.4.x and the plugin 3.x for example the implementation() and api() DSL.
Android plugin 3.0 located in Google Maven Repository (google() line) and it requires new Gradle. You should update Gradle to version 4.1.
Open file gradle/wrapper/gradle-wrapper.properties and set
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
If you are using android studio <3.0 then go to gradle-wrapper.properties and change the gradle from 4.1 to 3.3.
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
Go to top level gradle and change the gradle version from 3.0.0 to 2.3.3 and then it should work fine.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
If you are using android studio >3.0 then Go to gradle-wrapper.properties and change the gradle to 4.1.
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
Go to top level gradle and change the gradle version from 3.0.0 and then it should work fine.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}

SonarQube - Android not working for gradle 3.0.0

Android sonarqube worked until I updating android studio. Now it gives an error
FAILURE: Build failed with an exception.
* What went wrong:
com.android.build.gradle.api.ApkVariant.getCompileLibraries()Ljava/util/Collection;
I think this happens because gradle dependency syntax changed from 'compile' to 'implementation' like below in newest android version.
from
dependencies {
compile ........
compile ........
}
to
dependencies {
implementation ........
implementation ........
}
Can anyone please help me to configure sonarqube for new android version
Read the last part of the answer to get the latest updates
Original answer
I've performed some researches:
here you can
find the issue tracked internally by SonarQube
here you
can find the issue opened by a SonarQube developer asking Google
about the API change. As stated by Google engineers this change is intended and an alternative API already exists. SonarQube stated they won't support android plugin 3.0.0 until the final release or at least RC version
Result:
To continue to work you are forced to build your project with the current stable Android Studio and Android plugin v2.X.X
UPDATE - 6th November 2017
SonarQube released the new version 2.6 which is fully compatible with the AGP (Android Gradle Plugin) 3.0.0.
buildscript {
repositories {
google()
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.6.1"
}
}
allprojects {
repositories {
google()
jcenter()
}
}
apply plugin: "org.sonarqube"
More info in the release page HERE
You can use my solution https://github.com/SonarSource/sonar-scanner-gradle/pull/33
buildscript {
repositories {
jcenter()
google()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "com.android.tools.build:gradle:3.0.0"
classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.6-rc1"
}
}
apply plugin: 'org.sonarqube'
After sonarqube 2.6 was released just updating the plugin was enough for me
plugins {
id "org.sonarqube" version "2.6"
}
Updating Benoit answer, the official sonar scanner gradle plugin (v2.6-rc1) already supports the new gradle syntax. So, update your root gradle script to:
buildscript {
repositories {
jcenter()
google()
maven {
url "https://jitpack.io"
}
}
dependencies {
classpath "com.android.tools.build:gradle:3.0.0"
classpath "com.github.SonarSource:sonar-scanner-gradle:2.6-rc1"
}
}
apply plugin: 'org.sonarqube'
Try to use lower version of gradle

Can't use Gradle 2.0

I deleted anything related to gradle 1.1 from ~/.gradle and yet I have an error:
Error:Gradle version 1.10 is required. Current version is 2.0. If using the gradle wrapper, try editing the distributionUrl in /home/alex/Documents/projects/android/MyApp/gradle/wrapper/gradle-wrapper.properties to gradle-1.10-all.zip.
My settings were (before I had deleted /gradle from the project):
distributionUrl=http\://services.gradle.org/distributions/gradle-2.0-all.zip
Now in File->Settings->Gradle I have this:
Use local gradle distribution -> /usr/local/gradle/gradle-2.0
which is installed in that folder and has the version of 2.0.
So what's wrong with that?
Here is build.gradle
apply plugin: 'scala'
buildscript {
repositories {
jcenter()
mavenCentral()
maven {
url "http://saturday06.github.io/gradle-android-scala-plugin/repository/snapshot"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.2'
classpath "jp.leafytree.gradle:gradle-android-scala-plugin:1.0-SNAPSHOT"
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
The Android Gradle plugin is currently not compatible with Gradle 2.0. The latest AOSP branch supports 2.0, so it is likely that the next release of the Gradle plugin will support 2.0 as well (source).
I recommend switching back to the wrapper and setting distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-bin.zip in your gradle-wrapper.properties.
Alternatively, switch your local Gradle version to 1.10-1.12.

Categories

Resources