use fabric on Android - android

I use the fabric in my project.When I use this code classpath 'io.fabric.tools:gradle:1.+ in project's build.gradle and sync project.The following error occurred
Error:Could not find any matches for io.fabric.tools:gradle:1.+ as no versions of io.fabric.tools:gradle are available.
Searched in the following locations:
file:/D:/dev/androidStudio3.0/androidstudio3.0/AS/gradle/m2repository/io/fabric/tools/gradle/maven-metadata.xml
file:/D:/dev/androidStudio3.0/androidstudio3.0/AS/gradle/m2repository/io/fabric/tools/gradle/
https://dl.google.com/dl/android/maven2/io/fabric/tools/gradle/maven-metadata.xml
https://dl.google.com/dl/android/maven2/io/fabric/tools/gradle/
https://jcenter.bintray.com/io/fabric/tools/gradle/maven-metadata.xml
https://jcenter.bintray.com/io/fabric/tools/gradle/
https://twittersdk.artifactoryonline.com/twittersdk/public/io/fabric/tools/gradle/maven-metadata.xml
https://twittersdk.artifactoryonline.com/twittersdk/public/io/fabric/tools/gradle/
Required by:
project :

In your project level gradle add below line
classpath 'io.fabric.tools:gradle:1.25.1'
in your app level gradle add below line to top off app level gradle
apply plugin: 'io.fabric'
if you are trying to use crashlytics, to import crashlytic library add below code to app level gradle
dependencies {
implementation('com.crashlytics.sdk.android:crashlytics:2.8.0#aar') {
transitive = true
}
}

You can download fabric plugin from,
File->Settings->plugin
Then search for fabric and add that to project and open that will automatically add fabric to your project

I was facing the same issue as you, I resolved it via replacing this classpath
classpath 'io.fabric.tools:gradle:1.25.1'
Also add this as well in dependencies
compile('com.crashlytics.sdk.android:crashlytics:2.6.8#aar') {
transitive = true;
}
I Hope it will help you.

Related

unable to connect to firebase variant.getMergeResources() error [duplicate]

Suddenly when Syncing Gradle, I get this error:
WARNING: API 'variant.getJavaCompile()' is obsolete and has been
replaced with 'variant.getJavaCompileProvider()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance
Affected Modules: app
I've got this build.gradle for the app module:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'io.fabric'
android {
compileSdkVersion 28
buildToolsVersion "28.0.2"
defaultConfig {
applicationId "..."
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "..."
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
versionNameSuffix = version_suffix
[...]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
[...]
}
debug {
[...]
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.2.61"
implementation 'androidx.appcompat:appcompat:1.0.0-rc02'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation "com.android.support:preference-v7:28.0.0"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
implementation 'com.google.android.material:material:1.0.0-rc02'
[...]
}
I can compile the app correctly, but it's a bit bothering, and as I see it, something will stop working at the end of 2019. Any ideas of what is it and how to solve it?
I face this issue after updating to 3.3.0
If you are not doing what error states in gradle file, it is some plugin that still didn't update to the newer API that cause this. To figure out which plugin is it do the following (as explained in "Better debug info when using obsolete API" of 3.3.0 announcement):
Add 'android.debug.obsoleteApi=true' to your gradle.properties file which will log error with a more details
Try again and read log details. There will be a trace of "problematic" plugin
When you identify, try to disable it and see if issue is gone, just to be sure
go to github page of plugin and create issue which will contain detailed log and clear description, so you help developers fix it for everyone faster
be patient while they fix it, or you fix it and create PR for devs
Hope it helps others
This issue is fixed now with update Fabric Gradle version 1.30.0:
Update release: March 19, 2019
Please see this Link: https://docs.fabric.io/android/changelog.html#march-15-2019
Please update your classpath dependency in project level Gradle:
buildscript {
// ... repositories, etc. ...
dependencies {
// ...other dependencies ...
classpath 'io.fabric.tools:gradle:1.30.0'
}
}
In my case, it was caused from gms services 4.3.0. So i had to change it to:
com.google.gms:google-services:4.2.0
I have found this by running:
gradlew sync -Pandroid.debug.obsoleteApi=true
in terminal. Go to view -> tool windows -> Terminal in Android Studio.
This is just a warning and it will probably be fixed before 2019 with plugin updates so don't worry about it. I would recommend you to use compatible versions of your plugins and gradle.
You can check your plugin version and gradle version here for better experience and performance.
https://developer.android.com/studio/releases/gradle-plugin
Try using the stable versions for a smooth and warning/error free code.
I also faced the same issue. And after searching for a while, I figured it out that the warning was arising because of using the latest version of google-services plugin (version 4.3.0). I was using this plugin for Firebase functionalities in my application by the way.
All I did was to downgrade my google-services plugin in buildscript in the build.gradle(Project) level file as follows:
buildscript{
dependencies {
// From =>
classpath 'com.google.gms:google-services:4.3.0'
// To =>
classpath 'com.google.gms:google-services:4.2.0'
}
}
1) Add android.debug.obsoleteApi=true to your gradle.properties. It will show you which modules is affected by your the warning log.
2) Update these deprecated functions.
variant.javaCompile to variant.javaCompileProvider
variant.javaCompile.destinationDir to
variant.javaCompileProvider.get().destinationDir
Change your Google Services version from your build.gradle:
dependencies {
classpath 'com.google.gms:google-services:4.2.0'
}
This is a warning spit out by build tools for two reasons.
1. One of the plugin is relying on Task instead of TaskProvider, there is nothing much we can do.
2. You have configured usage of task, where as it supports TaskProvider.
WARNING: API 'variant.getGenerateBuildConfig()' is obsolete and has been replaced with 'variant.getGenerateBuildConfigProvider()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance
WARNING: API 'variant.getJavaCompile()' is obsolete and has been replaced with 'variant.getJavaCompileProvider()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance
WARNING: API 'variant.getMergeResources()' is obsolete and has been replaced with 'variant.getMergeResourcesProvider()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance
Look out for snippets as below & update.
android {
<library|application>Variants.all { variant ->
/* Disable Generating Build config */
// variant.generateBuildConfig.enabled = true // <- Deprecated
variant.generateBuildConfigProvider.configure {
it.enabled = true // Replacement
}
}
}
Similarly, find usages of 'variant.getJavaCompile()' or 'variant.javaCompile', 'variant.getMergeResources()' or 'variant.mergeResources'. Replace as above.
More information at Task Configuration Avoidance
Downgrading the version of Gradle worked for me:
classpath 'com.android.tools.build:gradle:3.2.0'
Upgrading the Kotlin (Plugin and stdLib) version to 1.3.1 solved that warning in my case. Update the Kotlin version in whole project by replacing existing Kotlin version with :
ext.kotlin_version = '1.3.50'
Go back from classpath 'com.android.tools.build:gradle:3.3.0-alpha13' to classpath 'com.android.tools.build:gradle:3.2.0'
this worked for me
Updating gradle to gradle:3.3.0
The default 'assemble' task only applies to normal variants. Add test variants as well.
android.testVariants.all { variant ->
tasks.getByName('assemble').dependsOn variant.getAssembleProvider()
}
also comment apply fabric
//apply plugin: 'io.fabric'
Update fabric plugin to the latest in project level Gradle file (not app level). In my case, this line solved the problem
classpath 'io.fabric.tools:gradle:1.25.4'
to
classpath 'io.fabric.tools:gradle:1.29.0'
In my case
build.gradle(Project)
was
ext.kotlin_version = '1.2.71'
updated to
ext.kotlin_version = '1.3.0'
looks problem has gone for now
In my case, I had to comment out com.google.firebase.firebase-crash plugin:
apply plugin: 'com.android.application'
// apply plugin: 'com.google.firebase.firebase-crash' <== this plugin causes the error
It is a bug since Android Studio 3.3.0
When the plugin detects that you're using an API that's no longer supported, it can now provide more-detailed information to help you determine where that API is being used. To see the additional info, you need to include the following in your project's gradle.properties file:
android.debug.obsoleteApi=true
if I remove this row from application gradle:
apply plugin: 'io.fabric'
error will not appear anymore.
Reference link github
Migrate your project to androidX.
dependencies are upgraded to androidX. so if you want to use androidX contents migrate your project to androidX.
With Android Studio 3.2 and higher, you can quickly migrate an existing project to use AndroidX by selecting Refactor > Migrate to AndroidX from the menu bar.
Downgrading dependencies may fix your problem this time - but not recommended
This fixed my problem.. All I needed to do was to downgrade my google-services plugin in buildscript in the build.gradle(Project) level file as follows
buildscript{
dependencies {
// From =>
classpath 'com.google.gms:google-services:4.3.0'
// To =>
classpath 'com.google.gms:google-services:4.2.0'
// Add dependency
classpath 'io.fabric.tools:gradle:1.28.1'
}
}
Here a temporary workaround, If you are using room just upgrade to 1.1.0 or higher
implementation "android.arch.persistence.room:runtime:1.1.0"
it removes this warning for me.
keep you Project(not app) Build.gradle dependncies classpath version code is new
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0-beta01'
classpath 'com.novoda:bintray-release:0.8.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
This is a popular question. If you do not use these methods, the solution is updating the libraries.
Please update your kotlin version, and all your dependencies like fabric, protobuf etc. If you are sure that you have updated everything, try asking the author of the library.
Upgrading protobuf-gradle-plugin to version 0.8.10 solved my problem. Replace your existing protobuf with
classpath 'gradle.plugin.com.google.protobuf:protobuf-gradle-plugin:0.8.10'
That's mostly due to libraries which are obsolete. To check for new updates manually, you should navigate to
Analyze > "Run Inspection By Name"
That should be enough. Another option is to run a gradle dependency update using
./gradlew dependencyUpdates
that will produce a report like this:
:dependencyUpdates
------------------------------------------------------------
: Project Dependency Updates (report to plain text file)
------------------------------------------------------------
The following dependencies are using the latest milestone version:
- com.github.ben-manes:gradle-versions-plugin:0.15.0
The following dependencies have later milestone versions:
- com.google.auto.value:auto-value [1.4 -> 1.4.1]
- com.google.errorprone:error_prone_core [2.0.19 -> 2.0.21]
- com.google.guava:guava [21.0 -> 23.0-rc1]
- net.ltgt.gradle:gradle-apt-plugin [0.9 -> 0.10]
- net.ltgt.gradle:gradle-errorprone-plugin [0.0.10 -> 0.0.11]
...
upgrading the google services in project-level build.gradle solved my problem.
After upgrading:
dependencies {
...
classpath 'com.google.gms:google-services:4.3.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
I had same problem and it solved by defining kotlin gradle plugin version in build.gradle file.
change this
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
to
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50{or latest version}"
In my case I followed this.
Summary, in gradle app level: change this :
variant.outputs.all { output ->
variant.assemble.doLast {
....
}
}
to
variant.outputs.all { output ->
variant.getAssembleProvider().configure() {
it.doLast {
....
}
}

How to resolve dependency problem with version conflicts?

I am using this version implementation com.google.android.gms:play-services:10.2.0, but I need to use this com.google.android.gms:play-services-location:15.0.1 or above.
Every time I build, it says all dependencies either should be above or below 14.0.0. But no version of play-services is available higher than this version 10.2.0 (Not in my knowledge).
And is there any way that I can simply remove this Google play service dependency without getting any error. Because every time I remove it and build it gives this error (see the attached picture).
in app.gradle :
dependencies {
implementation 'com.google.android.gms:play-services-location:16.0.0'
}
apply plugin: 'com.google.gms.google-services'
in project gradle:
dependencies {
classpath 'com.google.gms:google-services:4.2.0'
}

Android Studio Error The library com.google.android.gms:play-services-measurement-base

How to this i am new on Android Studio.
The library com.google.android.gms:play-services-measurement-base is being requested by various other libraries at [[15.0.0,15.0.0], [15.0.2,15.0.2]], but resolves to 15.0.2. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.
As reported here:
You will need to update the version of the latter dependency to 15.0.2. This addresses the issue where version 3.3.0 of the Google Services Gradle plugin reports: The library com.google.android.gms:play-services-measurement-base is being requested by various other libraries at [[15.0.0,15.0.0], [15.0.2,15.0.2]], but resolves to 15.0.2...
Then update your google play services plugin to 3.3.0
classpath 'com.google.gms:google-services:3.3.0'
and update the dependencies to 15.0.2.
Resolve this issue with me - If You are choosing Firestore Database then do this:
first We will add updated these things in Gradle :
buildscript {
// ...
dependencies {
// ...
classpath 'com.google.gms:google-services:4.0.1' // google-services plugin
}
}
allprojects {
// ...
repositories {
// ...
maven {
url "https://maven.google.com" // Google's Maven repository
}
}
}
after this update :
apply plugin: 'com.android.application'
android {
// ...
}
dependencies {
// ...
implementation 'com.google.firebase:firebase-core:16.0.0'
// Getting a "Could not find" error? Make sure you have
// added the Google maven respository to your root build.gradle
}
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'
Then Rebuild or Sunc Now , issue will be resolve.
if You are working on RealTime Database then do this thing :-
Set Dependency :
implementation 'com.google.firebase:firebase-database:15.0.0'
and remove above FireStore Dependency.
This will sure resolve your issue ... If you like then vote for me
buildscript {
// ...
dependencies {
// ...
classpath 'com.google.gms:google-services:4.0.1' // google-services plugin
}
}
This works for me. By adding the latest version, i.e 4.0.1

Can't add firebase-perf version 9.0.0 dependency

How can I tell what is the minimum version of firebase-perf?
I want to use version 9.0.0 and I get the error:
Failed to resolve: com.google.firebase:firebase-perf:9.0.0
I tried to add
maven {
url "https://maven.google.com"
}
but it didn't fix the problem.
Please use this (inside app build.gradle):
apply plugin: 'com.google.firebase.firebase-perf'
//inside dependencies add the below
compile 'com.google.firebase:firebase-perf:11.6.0'
and check this site for the guide: https://firebase.google.com/docs/perf-mon/get-started-android

Two classpath on gradle Android

I am using gradle experimental on my android proyect.
I was getting this error on the gradle build:
Error: Unable to find method com.android.build.gradle.internal.ApplicationTaskManager
My gradle project is:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.android.tools.build:gradle-experimental:0.3.0-alpha7'
}
When I delete the first classpath: classpath 'com.android.tools.build:gradle:1.5.0' the error disappears the gradle built it without any problems.
I need the two classpath for my project.
Cannot I use two classpath?
Does exist another alternative?
Thanks for your help.
http://tools.android.com/tech-docs/new-build-system/gradle-experimental
Plugin name is com.android.model.application instead of com.android.application. Or use apply plugin: "com.android.model.library" if you want to create an Android aar library.
Maybe this will help.
Did you try syncing your project by enabling the online sync mode after you added the new dependencies?

Categories

Resources