Reputation: 49
I have tried to get Crashlytics to work but even though I followed all steps I still do not seem to get any errors visible in Crashlytics.
Can you please have a look?
This is the code i use to start a crash:
Crashlytics.getInstance().crash(); // Force a crash
My App Gradle:
apply plugin: 'com.android.application'
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
lintOptions {
disable 'MissingTranslation'
}
}
}
buildToolsVersion '27.0.3'
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
maven { url 'https://maven.fabric.io/public' }
}
}
repositories {
mavenCentral()
}
apply plugin: 'io.fabric'
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:25.+'
implementation 'com.android.support:design:25.+'
implementation 'com.android.support:support-v4:25.+'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.roughike:bottom-bar:2.3.1'
testImplementation 'junit:junit:4.12'
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.firebaseui:firebase-ui-auth:4.1.0'
// Required only if Facebook login support is r6equired
implementation 'com.facebook.android:facebook-android-sdk:4.27.0'
// Required only if Twitter login support is required
implementation("com.twitter.sdk.android:twitter-core:3.0.0@aar") { transitive = true }
implementation 'com.google.firebase:firebase-storage:16.0.1'
implementation 'com.google.firebase:firebase-messaging:17.3.0'
//compile 'com.google.firebase:firebase-crash:16.0.0'
// Displaying images
implementation 'com.github.bumptech.glide:glide:3.7.0'
//implementation 'com.google.android.gms:play-services:15.0.0'
implementation 'com.google.android.gms:play-services-auth:16.0.0'
implementation 'com.google.android.gms:play-services-base:15.0.1'
implementation 'com.google.android.gms:play-services-identity:15.0.1'
implementation 'com.google.android.gms:play-services-analytics:16.0.3'
implementation 'com.google.android.gms:play-services-gcm:15.0.1'
implementation 'com.google.android.gms:play-services-vision:15.0.2'
implementation 'com.github.amlcurran.showcaseview:library:5.4.3'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.5'
implementation files('libs/YouTubeAndroidPlayerApi.jar')
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '25.3.1'
}
}
}
}
apply plugin: 'com.google.gms.google-services'
My Build Gradle (I also took a fresh google-services.json file from Firebase Settings):
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.fabric.io/public'
}
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.google.gms:google-services:4.0.1'
classpath 'io.fabric.tools:gradle:1.25.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And this is my manifest
<?xml version="1.0" encoding="utf-8" ?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="blah">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CLEAR_APP_CACHE" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/SplashScreenTheme">
// metadata for Facebook login
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="@string/facebook_app_id"
tools:replace="android:value" />
<activity
android:name=".SplashScreen"
android:screenOrientation="portrait">
-
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:configChanges="orientation|screenSize"
android:screenOrientation="portrait"
android:theme="@style/Theme.TransNav" />
<activity
android:name=".QRCodeScannerActivity"
android:theme="@style/Theme.TransNav" />
//Facebook activities for Facebook login
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="@string/app_name" />
<activity
android:name="com.facebook.CustomTabActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="@string/fb_login_protocol_scheme" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.gms.vision.DEPENDENCIES"
android:value="barcode" />
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/ic_logo_without_text" />
<meta-data
android:name="com.google.firebase.messaging.default_notification_color"
android:resource="@color/white" />
<meta-data
android:name="io.fabric.ApiKey"
android:value="blh"/>
<service android:name=".MyFirebaseInstanceIDService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
<service android:name=".MyFirebaseMessaging">
-
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
</application>
</manifest>
Upvotes: 0
Views: 4877
Reputation: 1697
Try enabling the debug mode like in the documentation here.
1) Add these lines to the Manifest
<meta-data
android:name="firebase_crashlytics_collection_enabled"
android:value="false" />
2) When initializing Crashlytics, enable debug mode.
final Fabric fabric = new Fabric.Builder(this)
.kits(new Crashlytics())
.debuggable(true) // Enables Crashlytics debugger
.build();
Fabric.with(fabric);
Upvotes: 1
Reputation: 258
At times Firebase Crashlytics, takes time to register Crashes. Wait for a while and if you have followed the correct steps, I'm sure the crash will appear in a while.
EDIT:
Follow the following steps:
Add Crashlytics repositories and dependency to your project-level build.gradle file.
maven {
url 'https://maven.fabric.io/public'
}
dependencies {
// ...
classpath 'io.fabric.tools:gradle:1.25.4'
}
allprojects {
repositories {
maven {
url 'https://maven.google.com/'
}
}
}
Also, Check Crashlytics requires Google Services plugin version 3.1.2 or higher. Check the com.google.gms:google-services version number in your project's build.gradle dependencies.
2.) Add the Crashlytics dependencies to your app-level build.gradle:
apply plugin: 'io.fabric'
dependencies {
// ...
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.5'
}
Keep this as your Force Crash Button:
Button crashButton = new Button(this);
crashButton.setText("Crash!");
crashButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Crashlytics.getInstance().crash(); // Force a crash
}
});
addContentView(crashButton, new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT));
Upvotes: 0