Firebase Performance Beta / Plugin build issue - android

When integrating the current Android Firebase Performance Monitoring (beta) version released during I/O 2017 as follows...
Add to project build.gradle:
dependencies {
classpath 'com.google.firebase:firebase-plugins:1.1.0'
}
Add to app build.gradle:
dependencies {
compile 'com.google.firebase:firebase-perf:10.2.6'
}
You may come across the following build error.
Error:Execution failed for task ':app:packageDebug'.
> com.google.common.util.concurrent.MoreExecutors.directExecutor()Ljava/util/concurrent/Executor;
This is caused by a Guava dependency mismatch, which can be resolved as follows, by modifying the project build.gradle as follows:
dependencies {
classpath ('com.google.firebase:firebase-plugins:1.1.0') {
exclude group: 'com.google.guava', module: 'guava-jdk5'
}
}
The Firebase team are aware of this issue, suggested the above workaround and will be fixing in a future release.
Putting this out there to help anyone else scratching their head.

This issue was fixed in version 1.1.1 of firebase plugins. To use the updated version just update your project-level build.gradle file as follows:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath ('com.google.firebase:firebase-plugins:1.1.1')
}
}

Related

Could not create task ':app:injectCrashlyticsMappingFileIdDebug'

* What went wrong:
Could not determine the dependencies of task ':app:mergeDebugResources'.
> Could not create task ':app:injectCrashlyticsMappingFileIdDebug'.
> No signature of method: org.gradle.api.internal.provider.DefaultValueSourceProviderFactory$ValueSourceProvider.forUseAtConfigurationTime() is applicable for argument types: () values: []
project's build.gradle
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.0.0"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.5'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.5.0'
}
}
app's build.gradle
apply plugin: 'com.google.firebase.crashlytics'
//...
dependencies {
implementation 'com.google.firebase:firebase-crashlytics:17.3.1'
}
Downgrading to com.google.firebase:firebase-crashlytics-gradle:2.2.0 helped me, apparently something wrong with the latest version
This is a bug in the Crashlytics plugin that causes an error when used with Gradle 6.1 - Gradle 6.4.1. We'll try to get it fixed in an upcoming release. In the meantime, upgrading to Gradle 6.5+ should fix the error.
Downgrading to com.google.firebase:firebase-crashlytics-gradle:2.4.1 helped me.
Something is wrong with the latest version.
Which Gradle version are you using? I can only say I tried in a single project and it worked perfectly.
I use the next versions in the app/build.gradle:
implementation "com.google.firebase:firebase-crashlytics:17.0.1"
implementation "com.google.firebase:firebase-crashlytics-ndk:17.0.1"
And go to change:
File > Project structure > grade version: 6.7.1
and work fine the compilation project

Firebase crashlytics not building even when downgrading versions

We're using Firebase in our app and while we are still on Support library 28 Not AndoridX.
i have managed to add Analytics and Performance monitoring and they work fine after researching the suitable versions that are compatible with support-lib 28.
Now i'm trying to add crashlytics and i'm getting build errors with each lib version starting from 17.0.0 going down all the way to 2.9.8
with 2.9.8 it get :
ERROR: Failed to resolve: com.google.firebase:firebase-crashlytics:2.9.8
Show in Project Structure dialog
Affected Modules: app
with 17.0.0 i get:
ERROR: Failed to resolve: com.google.firebase:firebase-
crashlytics:com.google.firebase.crashlytics.buildtools.gradle.CrashlyticsExtension_Decorated
Show in Project Structure dialog
Affected Modules: app
My project build.gradle:
buildscript {
ext.kotlin_version = '1.3.60'
repositories {
google()
maven { url "http://dl.bintray.com/populov/maven" }
jcenter()
}
ext {
firebaseAnalytics = "16.3.0" //Firebase SDK for Google Analytics compatible with support lib
firebasePerformanceMonitoring = "17.0.2" //Firebase SDK for performance monitoring compatible with support lib
firebaseCrashlytics = "17.0.0" //Firebase Crashlytics
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.1'
classpath 'com.google.gms:google-services:4.3.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.firebase:perf-plugin:1.3.1' // Performance Monitoring plugin
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.0.0' // Crashlytics Gradle plugin.
}
}
allprojects {
repositories {
maven {
url "https://maven.google.com"
}
maven { url "http://dl.bintray.com/populov/maven" }
mavenCentral()
jcenter()
google()
}
}
app module build.gradle dependencies block:
dependencies {
def supportLib_version = "28.0.0"
implementation "com.android.support:support-v4:$supportLib_version"
implementation "com.android.support:recyclerview-v7:$supportLib_version"
implementation "com.android.support:design:$supportLib_version"
........
implementation "com.google.firebase:firebase-analytics:$firebaseAnalytics"
implementation "com.google.firebase:firebase-perf:$firebasePerformanceMonitoring"
implementation "com.google.firebase:firebase-crashlytics:$firebaseCrashlytics"
}
While some might suggest that we migrate the project to AndroidX, this is a big project with many libraries and i'm not the only developer working on it, hence that won't be feasible IMT
Fabric/Firebaser here - I think that overall there is some incorrect versioning and dependency integration in this project that is causing issues.
You will unfortunately not be able to use Firebase Crashlytics until you upgrade to Android X, as it is a dependency for the Firebase Crashlytics SDK as described here.
You can still use the legacy Fabric Crashlytics SDK in Firebase however, and you can find the instructions for that here: https://firebase.google.com/docs/crashlytics/get-started?platform=android. I recommend taking out whatever Crashlytics setup you've attempted to integrate so far and follow the instructions there. For what it's worth, it looks like you're getting the versioning wrong, as this version does not exist:
com.google.firebase:firebase-crashlytics:2.9.8
firebase-crashltyics only has versions like 17.0.0 and upward. 2.9.8 is a version of our aforementioned legacy Fabric Crashlytics SDK, so you're looking to use something like this:
com.crashlytics.sdk.android:crashlytics:2.10.1
Hope this helps :)

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

Failed to resolve: com.android.databinding:library:3.1.2

After updating android studio 3.1.2 my existing project gives error at
dataBinding.enabled = true
error is as follows-
Failed to resolve: com.android.databinding:library:3.1.2
Failed to resolve: com.android.databinding:adapters:3.1.2
my gradle dependency are as follows-
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:25.1.0'
implementation 'com.android.support:recyclerview-v7:25.1.0'
implementation 'com.android.support:preference-v7:25.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.0-beta3'
implementation 'com.firebase:firebase-jobdispatcher:0.5.0'
// Instrumentation dependencies use androidTestCompile
// (as opposed to testCompile for local unit tests run in the JVM)
androidTestImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support:support-annotations:25.1.0'
androidTestImplementation 'com.android.support.test:runner:0.5'
androidTestImplementation 'com.android.support.test:rules:0.5'
}
I also tried
android.databinding.enableV2=true
but its also not working
When I tried to update build tool version to 4.4 then I found this error. I f I do not update the build tool version then its working fine.
check it this below code in your project level gradle file ..
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
According to the Android Team answer you had to add
google()
too all repositories
and priority is important. so other repositories must be added after google()
Downgrade to 3.1.0 in project level build.gradle file, then rebuild the project.
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
I hope this helps
I also has the same issue I ensured that I added google() to all repositories and also I downgraded gradle to 3.1.0 from 3.1.4 and my project was successfully build.
Another TIP: We can also add the below code to our build.gradle(project) which takes cares of libraries conflicts with new dependencies
configurations.all {
resolutionStrategy {
force"com.android.support:supportannotations:$androidSupportVersion"
force "com.android.support:support-v4:$androidSupportVersion"
force "com.android.support:appcompat-v7:$androidSupportVersion"
force "com.android.support:design:$androidSupportVersion"
force "com.android.support:recyclerview-v7:$androidSupportVersion"
}
}
And you can keep your libraries in a separate file such as libraries.gradle and include them in build.gradle(project)
buildscript
{
apply from: "./libraries.gradle"
}
I added Data-Binding to my project and the next time I build project, I faced the same issue, more specifically logcat displayed this message:
Failed to resolve: com.android.databinding:library:3.1.2
Failed to resolve: com.android.databinding:adapters:3.1.2
As per accepted answer, I checked my Project Level Gradle File to see whether it was missing google() in its repositories, but it was already there.
Build multiple times, but all in vain.
Then I did what my Android Master once told me to do, just in case when everything fails.
File -> Invalidate Caches/Restart.
Next time the project opened it build successfully.

how to downgrade proguard version in android studio gradle?

I am trying to build an android app using scala and android studio.
The compile fails at proguard with an exception:
Error:java.lang.ArrayIndexOutOfBoundsException: 4
at proguard.classfile.editor.InterfaceDeleter.visitSignatureAttribute(InterfaceDeleter.java:162)
at proguard.classfile.attribute.SignatureAttribute.accept(SignatureAttribute.java:97)
I found at another place (http://sourceforge.net/p/proguard/bugs/549/) that this issue is caused by a bug in scala, but that it only occurs in proguard 5.1 and not in proguard 5.0.
Now my question is: how can I setup android studio so that it will use proguard 5.0?
Found it!
The trick is to exclude proguard 5.1 in the toplevel buildfile, and add a dependency on 5.0 instead.
Here is my toplevel build file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath ('com.android.tools.build:gradle:1.0.0') {
exclude module: 'proguard-gradle'
}
classpath "jp.leafytree.gradle:gradle-android-scala-plugin:1.3.1"
classpath ('net.sf.proguard:proguard-gradle:5.0') {
force = true
}
}
}
allprojects {
repositories {
jcenter()
}
}

Categories

Resources