My Crashlytics data is not appearing in the Firebase Crashlytics view. It does show "Crash-free statistics" as being 75%, so it appears to be recording some data. I also see the crashes appearing instantly both in Fabric and in the old Firebase Crash Reporting interface, as well as in the DebugView as general events but nothing in the Issues section of the Crashlytics page. I thought that perhaps my Fabric project had not been linked to my Firebase project, but when I tried doing it manually using this link https://www.fabric.io/firebase_migration/apps it tells me the projects are already linked, specifically it says Project already contains a linked app with that bundle ID and platform. Every time I open my app in Android studio I immediately run the command adb shell setprop debug.firebase.analytics.app ie.moses.keepitlocal so that my events will appear in the DebugView, perhaps this could be affecting it, but I doubt it.
Here is my project build.gradle file:
buildscript {
repositories {
google()
jcenter()
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.google.gms:google-services:3.3.0'
classpath 'io.fabric.tools:gradle:1.25.4'
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url 'https://maven.google.com/'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and this is the build.gradle for my specific app module
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
def supportLibraryVersion = '27.1.1'
android {
compileSdkVersion 27
defaultConfig {
applicationId "ie.moses.keepitlocal"
minSdkVersion 16
targetSdkVersion 27
versionCode 5
versionName "0.3.1-alpha"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
debug {
buildConfigField 'boolean', 'CRASHLYTICS', 'true'
}
release {
buildConfigField 'boolean', 'CRASHLYTICS', 'true'
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'com.android.support') {
// Used to prevent conflicting versions of Android support library
// contained in other dependencies (e.g. all the firebase dependencies)
details.useVersion supportLibraryVersion
}
}
}
dependencies {
implementation files('libs/YouTubeAndroidPlayerApi.jar')
implementation "com.android.support:appcompat-v7:$supportLibraryVersion"
implementation "com.android.support:recyclerview-v7:$supportLibraryVersion"
implementation "com.android.support:cardview-v7:$supportLibraryVersion"
implementation 'com.google.firebase:firebase-core:16.0.3'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.3'
implementation 'com.google.firebase:firebase-crash:16.2.0'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.5'
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
implementation 'com.github.bumptech.glide:glide:4.7.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'
implementation 'com.google.guava:guava:26.0-android'
}
apply plugin: 'com.google.gms.google-services'
I am using a Button to force a crash with the following code (as I mentioned, these crashes appear almost immediately in Fabric and in the old Crash Reporting interface which has been deprecated and will be removed in 2 days!). Here is the code for the crash button:
Button crashButton = new Button(this);
crashButton.setText("Crash!");
crashButton.setOnClickListener(view -> {
throw new IllegalStateException("you hit the crash button!");
});
addContentView(crashButton, new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT));
EDIT
I have just noticed that on the firebase transition status page it says "0/1 APP LINKED" and "NO PROJECTS YET".
I also need to reinstall the Crashlytics library from the Fabric plugin every time I open Android studio. The dependencies already exist in my gradle file but the plugin does not seem to recognise them.
EDIT
I am now trying to unlink fabric and firebase so I can try linking them again from fresh. I came across this question Unlink an existing firebase app?, but fabric is not even listed as an integration in my project.
Forget Fabric, it's not required. Just follow instructions in your Firebase console and Firebase documentation: https://firebase.google.com/docs/crashlytics/get-started#android
Don't mess with Fabric console, you should completly remove any calls to Fabric console and configure your project from scratch as Firebase doc says. As soon as you run app correctly configured, you will see Crashlytics panel in your Firebase console
The only solution I could find was as follows (I am including all steps exactly as I carried them out even if they may not be relevant):
I exported my realtime database to JSON and made a copy of my database rules.
I deleted my app from the Firebase project.
I deleted the Firebase project.
I deleted my project from Fabric.
I removed all references to Fabric, Crashlytics and the old Firebase Crash Reporting library from my project, this consisted of removing the dependencies from both my build.gradle files and deleting the fabric.properties file.
I ran gradlew.bat clean (I'm on Windows) on my project from the command line.
I did a Ctrl+Shift+F (search all project files) for the words fabric and crash just to make sure there was absolutely no remaining references to Fabric, Crashlytics or the deprecated Crash Reporting library (which was still a dependency in my build.gradle without me realising it because Firebase assistant tool added that as the crash reporting dependency when I first tried to get this working and then immediately told me it was deprecated :/ ).
I searched in File Explorer on windows for any files referencing "Fabric" or "Crash" (there weren't any).
I created a new project on Firebase.
I imported my realtime database from the previously exported JSON file and copy/pasted back in my rules.
I recreated my one test user account (thankfully the app is not yet in production :p).
I reenabled analytics (although this was simply a matter of going to the Analytics tab and seeing that it was already enabled as I still had the dependency in my build.gradle for my app module).
I went to the Crashlytics tab and saw the original screen explaining how to enable Crashlytics. This time however I did not create the project on Fabric or install the Fabric plugin, I only copied in the Fabric dependencies as I think #jake was suggesting, these can be found here https://firebase.google.com/docs/crashlytics/get-started?authuser=0.
I then tried to produce a crash using the method described here https://firebase.google.com/docs/crashlytics/force-a-crash?authuser=0.
And then voilà! The crash appeared immediately in the Crashlytics tab of Firebase. No Fabric project, no Fabric plugin, just the dependencies.
This method had the added benefit of allowing me to be rid of extra databases and user properties I did not want (which Firebase does not currently allow you to remove once you create them >:( ), but this method obviously may not be feasible for anyone who already has a lot invested in their Firebase project and cannot simply start over. Luckily for me this was not too much of a pain.
add apply plugin: 'com.google.firebase.crashlytics' in app module
and dependencies {
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.1.1'
classpath 'com.google.gms:google-services:4.3.3'
} in project module
I had the same issue as you. I was able to link Fabric to Firebase after unlinking Crashlytics from Firebase following the instructions from this answer. Sadly this could only be done with building a custom url myself.
Related
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 {
....
}
}
We have programming an Android app and try to implement Crashlytics to our app.
We have different types of problem .
Version we used :
Android studio version :
3.3
Gradle version :
classpath 'com.android.tools.build:gradle:3.3.1'
Plugin :
Fabric for Android studio v4.3.0
Implementation :
implementation('com.crashlytics.sdk.android:crashlytics:2.9.9') { transitive = true }
implementation('io.fabric.sdk.android:fabric:1.4.0#aar') { transitive = true }
gradle-wrapper.properties :
distributionUrl=https://services.gradle.org/distributions/gradle-5.2.1-all.zip
First Problem :
When we implement Crashlytics, you know that developers have 3 steps. We can not skip 2,3.steps. Because we have not compiled our application yet. We had two main errors:
Error 1:
This app relies on Crashlytics. Please sign up for access at https://fabric.io/sign_up,
Error 2 :
E/CrashlyticsCore: The Crashlytics build ID is missing.This occurs when
Crashlytics tooling is absent from your app's build configuration.
Please review Crashlytics onboarding instructions and ensure you have a valid Crashlytics account.
So, we had to be disabled "Debug Mod" to complete implementation of Crashlytic.
Crashlytics crashlyticsKit = new Crashlytics.Builder()
.core(new CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build())
.build();
Fabric.with(this, crashlyticsKit); // Tod from Fabric suggested in stackoverflow
And implementation was completed.
But we do not want to do that. Because, when we have a crash, it does not any report to Crashlytics or Firebase. We also want to have debug mod’s crashes.
When we removed -> ....disabled(BuildConfig.DEBUG) - it shows again : Error 1, Error 2.
Second Problem :
In gradle ; apply plugin : ‘io.fabric’, we made the comment line, when we remove comments line, we have errors below :
Error 3 :
WARNING: API 'variant.getExternalNativeBuildTasks()' is obsolete and has been replaced with 'variant.getExternalNativeBuildProviders()'.
It will be removed at the end of 2019.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
To determine what is calling variant.getExternalNativeBuildTasks(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace.
Affected Modules: app
When we searched it, this error related to new android studio gradle. So we needed to make comment line “apply plugin: fabric.io” again.
There is no good solution about that.
To run application we can not remove:
new CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build() : (due to Error1 Error2)
So we try to enable report different ways :
What have we try to add until here?
1. Enable in gradle :
buildTypes {
debug {
manifestPlaceholders = [crashlyticsEnabled: true]
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
manifestPlaceholders = [crashlyticsEnabled: false]
}
2. Enable in Manifest
<meta-data
android:name="firebase_crashlytics_collection_enabled"
android:value="true" />
3.Enable in ADB
adb shell setprop log.tag.Fabric DEBUG
adb shell setprop log.tag.CrashlyticsCore DEBUG
But still, Crashlytics or Firebase does not get any Debug Crash reports.
We have expecting your solutions.
I managed to get this fixed without adding android.debug.obsoleteApi=true in gradle.properties.
I basically connected 3 flavors to different Firebase projects using proper flavor configuration and the provided google-services.json file.
What your gradle file is missing comparing it to mine is this:
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath "com.google.gms:google-services:$google_services_version" // google-services plugin
classpath "io.fabric.tools:gradle:$fabric_tools_version"
}
apply plugin: "io.fabric"
And finally: implementation "com.google.firebase:firebase-crash:16.2.1"
I know Fabric is going to shut down this year, but by running the apps this way, they connected to the Firebase console with no problem whatsoever.
Regarding the flavor configuration, I downloaded three different json files (I have 3 flavors) and added them in the root directory of each flavor. For example:
flavor1:
assets
java
res
AndroidManifest
google-services.json (for flavor1)
flavor2:
assets
java
res
AndroidManifest
google-services.json (for flavor2)
And that's it. Hope this helps someone.
EDIT
So, as you guys may already know, Fabric is shutting down and Firebase Crashlytics is ready, making this answer deprecated.
Please check here so you can successfully update your app and avoid weird behaviors.
This also happens if you set ext.enableCrashlytics = false for a build variant but still try to call Fabric.with(context, Crashlytics()) in your app initialization code. ext.enableCrashlytics = false disables the build plugin (an optimization I made to make my debug builds faster) but then of course the build ID will be missing.
Today I migrated from Fabric Crashlytics to Firebase Crashlytics and encountered a fatal error that didn't keep me going. What I did was this:
In app-> build.gradle:
apply plugin: 'io.fabric'
dependencies {
implementation "com.google.firebase:firebase-core:17.2.0"
// Add dependency
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
}
In general build.gradle:
buildscript {
repositories {
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'io.fabric.tools:gradle:1.31.2' // Crashlytics plugin
}
And of course download the json file from Firebase and insert it in the app folder.
After completing these simple steps, I received this error when I started the application
The Crashlytics build ID is missing. This occurs when Crashlytics
tooling is absent from your app's build configuration. Please review
Crashlytics onboarding instructions and ensure you have a valid
Crashlytics account.
I went to check that there wasn't any code that could call up old Fabric methods, and in fact I discovered that in app-> build.gradle I had this:
buildTypes {
debug {
minifyEnabled false
debuggable true
**ext.enableCrashlytics = false**
ext.alwaysUpdateBuildId = false
}
}
ext.enableCrashlytics = false certainly it was a method that referred to the old Fabric, so I removed this line and everything worked perfectly! I hope to help someone with this
just set apply plugin: 'io.fabric' in ur build.gradle (app)
In my case I was missing Crashlytics plugin:
apply plugin: 'com.google.firebase.crashlytics'
Put that line at the top of your module's build.gradle file e.g.
apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.crashlytics'
I faced the same issue when migrating from Fabric Crashlytics to Firebase Crashlytics, following steps fixed the issue for me
Clean your project
Update google-services.json file
Just add this line in your build.gradle (Project):
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.0'
and this plugin in your build Gradle (app):
apply plugin: 'com.google.firebase.crashlytics'
I had the same problem in my app (Android Studio 3.4.1)
I fixed trough conecting to the Fabric Plugin. Creating an account and linking my app to it.
In my case i just update implementation 'com.google.firebase:firebase-core:16.0.9' to implementation 'com.google.firebase:firebase-core:17.0.1'
and added apply plugin: 'io.fabric' to my app level gradle. This solved Error 2 for me.
if you migrate from Fabric to Firebase please ensure you've called:
FirebaseApp.initializeApp(this)
in your Application onCreate().
No need any relation to Fabric anymore, just follow this guidance:
https://firebase.google.com/docs/crashlytics/get-started?platform=android
In My case, I hade two modules that used a different version of FireBase Crashlytics.
In My case, I miss this line: apply plugin: 'com.google.gms.google-services'
For reference, https://rnfirebase.io/crashlytics/android-setup
I had the same problem here and I fixed it by adding Fabric to Gradle
Here's my project Gradle file:
google()
jcenter()
maven { url 'https://jitpack.io' }
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'io.fabric.tools:gradle:1.+'
classpath 'com.google.gms:google-services:4.3.3'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.4.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
I am developing a google map app using Android Studio. When I sync the project with Gradle Files (Select Tools/Android/Sync Project with Gradle Files on Android Studio), I get the following error:
Could not resolve com.google.android.gms:play-services-maps:11.6.2.
Couold not get resource 'https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-maps/11.62./play-services-maps-11.6.2.pom
This is the software I am using:
Android Studio 3.0.1
Android Version 7.1.1
Google Play Services 46
Google Repository 58 (under Support Repository)
I've tried using both the google maps project template and the empty activity project but I get the same error.
I am using the http proxy setup I used from earlier projects. I am able to install the play-services-maps and the google repository.
I also added the maven url to the Gradle Project file in the All Projects/Repositories section.
I have tried the suggestions from Stack Overflow but none have not worked.
Any ideas?
Gradle Project Build file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
The gradle app build file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "hansen.scott.googlemaps"
minSdkVersion 25
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.android.gms:play-services-maps:11.6.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
The error is in the line:
implementation 'com.google.android.gms:play-services-maps:11.6.2'
try adding this in project level gradle file
allprojects {
repositories {
maven {
url "https://maven.google.com"
}
}
}
Someone had the same issue I did and entered it on Stack Overflow a day or two ago. The user was getting a build error when using player-services-maps 11.6.2. If the user changed the version to 11.0.0, the build succeeded.
Once I back-dated the maps version to 11.0.0, this solved my problem too. I created a new Google Map project and didn't modify the Gradle Build files.
The problem appears to be that play-services-maps won't build using a versions after 11.0.0. I will post the issue on Github.
Thank you for everybody's help.
I have been facing the same issue for the past one week and posted it on Stack Overflow as well but to no effect.
I have since then figured out the root cause. I am working out of my office and thus have firewalls in place. I got it checked with the system admin and on turning off the firewall the build worked.
So i would advice you to have this checked as well.
Kind regards,
Kabir
I followed all the steps on the docs to use Firebase Crash Reporting in my Android app (I use Android Studio and everything is up-to-date).
I used their own code to throw an exception to see if it works:
try {
throw new NullPointerException();
} catch (NullPointerException ex) {
FirebaseCrash.logcat(Log.ERROR, TAG, "NPE caught");
FirebaseCrash.report(ex);
}
And the console gives me this log:
E/MainActivity: NPE caught
V/FirebaseCrash: Firebase Crash Reporting is disabled.
Here is one build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
// Firebase - Google Services 3.0.0
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Here is the other build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 'android-N'
buildToolsVersion '24.0.0-rc2'
defaultConfig {
applicationId "com.app.test"
minSdkVersion 19
targetSdkVersion 'N'
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
useProguard true
}
}
}
dependencies {
compile 'com.android.support:support-v4:24.0.0-alpha1'
compile 'com.android.support:appcompat-v7:24.0.0-alpha1'
compile 'com.android.support:design:24.0.0-alpha1'
compile 'com.google.firebase:firebase-core:9.0.0'
compile 'com.google.firebase:firebase-analytics:9.0.0'
compile 'com.google.firebase:firebase-crash:9.0.0'
compile 'com.google.firebase:firebase-messaging:9.0.0'
compile 'com.google.firebase:firebase-config:9.0.0'
compile 'com.google.firebase:firebase-invites:9.0.0'
compile 'com.google.android.gms:play-services-appindexing:9.0.0'
}
apply plugin: 'com.google.gms.google-services'
I also use:
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
FirebaseMessaging.getInstance().subscribeToTopic("news");
Log.d(TAG, "Subscribed to news topic");
I added all dependencies that I'll need, but I'm adding one by one and testing one by one, and Notifications works, Analytics: no idea, it takes about 24 hours to update, so until it does, I don't know if is working...
So, the thing is how can I enable it?
NOTE: I have all of the dependencies added including the crash and core ones, also the plugin and the classpath
Thank you in advanced.
Please note the following:
After adding the SDK you can try using:
FirebaseCrash.report(new Exception("My first Android non-fatal error"));
Errors take up to 20 minutes to show up in the Crash Reporting console. Check back to see your report there.
(It may seem obvious but) make sure you have:INTERNET and ACCESS_NETWORK_STATE permission.
Crash reporting was not working for me too after correctly setting it up in my App. To fix this I visited my developer console, API Manager, and enabled the "Mobile Crash and Performance Reporting API". To find out exactly where you need to do this follow the steps on this page.
If you follow the steps in the link above, the logcat that has the text "E/FirebaseCrashSenderServiceImpl: Error sending crash report" gives you a URL to where you must go in the console to enable crash reporting.
The FirebaseCrash is deprecated. The FirebaseCrashlytics.getInstance() should be used instead:
FirebaseCrashlytics.getInstance().log(message)
FirebaseCrashlytics.getInstance().recordException(throwable)
Source: https://firebase.google.com/docs/crashlytics/customize-crash-reports?platform=android#add-logs
Add following code:
In Project-level build.gradle (/build.gradle):
buildscript {
dependencies {
// Add this line
classpath 'com.google.gms:google-services:3.0.0'
}
}
In App-level build.gradle (//build.gradle):
// Add to the bottom of the file
apply plugin: 'com.google.gms.google-services'
//Add following in In App-level build.gradle
compile 'com.google.firebase:firebase-crash:9.0.0'
Now sync your project,
Use following code in your activity to throw exception:
FirebaseCrash.report(new Exception("App Name : My first Android non-fatal error"));
check android crash reporting tutorial using firebase for complete guidance.
I had the same issue. Turns out I was missing dependency in my project gradle file. Try adding this. It should help.
buildscript {
repositories {
jcenter()
// ...
}
dependencies {
// ...
classpath 'com.google.firebase:firebase-plugins:1.0.5'
}
}
You should allow some time to show up. Even though the documentation says the errors will show up within 5 minutes, it can take up to 15-20 minutes. Also, you have to change your old modules to AndroidX by migrating it if you use native development. Finally, make sure that all the tools and plugins are added in the appropriate Gradle files.
I have followed everything according to document provided by google, but am facing some issues, I have added google-services.json in root directory i.e in app.
Error:
Execution failed for task ':app:processDebugGoogleServices'.
No matching client found for package name 'com.google.samples.quickstart.analytics'
am getting this error. do help am working on android studio.
Try resolving the issue by adding the following line in the dependencies of the project-level build.gradle:
classpath 'com.google.gms:google-services:1.5.0'
Now Use like this in build.gradle:
com.google.android.gms:play-services-analytics:8.4.0
And follow this instructions:
Add Analytics to Your Android App
You can also generate configuration file from there
Follow the title: Add the configuration file to your project
Hope it will helpful for you.
EDIT:
Also please check if your build.gradle contains this line then remove it:
apply plugin: 'com.google.gms.google-services'
Seriously, Google should really make GA easier for all of us!!
Here's how I manage to get it work on buildToolsVersion '23.0.3' with com.google.android.gms:play-services:8.4.0
app build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.3'
defaultConfig {
applicationId 'com.xxx.xxx'
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName '1.0'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
res.srcDirs =
[
'src/main/res/layouts/account',
'src/main/res/layouts/drawer',
'src/main/res/layouts/ntd',
'src/main/res/layouts/main',
'src/main/res/layouts',
'src/main/res'
]
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
compile 'com.google.android.gms:play-services:8.4.0'
}
I actually remove this line compile 'com.google.android.gms:play-services-analytics:8.4.0' and it still works.
top-level build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0'
classpath 'com.google.gms:google-services:2.0.0-alpha6'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
GAV4 is really a pain in the axx, so I would also like to remind you somethings.
google-services.json
Official GAV4 Document tells you to generate google-services.json and put it under your project/app/ folder. However, it never says anything about this message.
AnalyticsService not registered in the app manifest. Hits might not be
delivered reliably. See google short url for instructions.
And I end up find the solution here analyticsservice-not-registered-in-the-app-manifest-error
json with flavor
If you are building a complex project, you might also want to use flavor for different json files. See the flavor config here google-services-json-for-different-productflavors?lq=1
xml app tracker
Yet, you would still have a hard time using xml to configure the tracker, so I also advice you to see this thread google-analytics-v4-string-xml-configuration-name-not-recognized-ga-trackingi
google_app_id
Finally, you would still see this message
GoogleService failed to initialize, status: 10, Missing an expected
resource: 'R.string.google_app_id' for initializing Google services.
Possible causes are missing google-services.json or
com.google.gms.google-services gradle plugin.
which you could find some discussion here googleservice-failed-to-initialize
In strings.xml, I do add R.string.google_app_id which is your project id in google api console, but I think it would still work even without it. I just want to get rid of that message from the log.
Wish you all good luck!