0

I'm trying to set Crashlytics on my app.

I downloaded and installed the plugin for Android Studio, created an Account and successfully integrated it to my app - I can login and see the dashboard and I can see my application, but can't see any crashes.

In adb log, after the exception has fired, I see:

11-09 11:55:17.231 17255-17297/com.example.test I/CrashlyticsCore: Crashlytics report upload complete: 5A03D19A02E8-0001-4367-EE097F894C89

But if you take a look at the full log, you will see some strange things:

11-09 11:55:15.251 17255-17507/com.example.test W/dalvikvm: threadid=77: thread exiting with uncaught exception (group=0x2c6e8fc0)
11-09 11:55:15.331 17255-17297/com.example.test E/CrashlyticsCore: An error occurred in the fatal exception logger
                                                                    java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
                                                                        at android.os.Handler.<init>(Handler.java:121)
                                                                        at android.hardware.SystemSensorManager.<init>(SystemSensorManager.java:50)
                                                                        at android.app.ContextImpl$26.createService(ContextImpl.java:417)
                                                                        at android.app.ContextImpl$ServiceFetcher.getService(ContextImpl.java:207)
                                                                        at android.app.ContextImpl.getSystemService(ContextImpl.java:1250)
                                                                        at android.content.ContextWrapper.getSystemService(ContextWrapper.java:416)
                                                                        at android.content.ContextWrapper.getSystemService(ContextWrapper.java:416)
                                                                        at io.fabric.sdk.android.services.common.CommonUtils.getProximitySensorEnabled(CommonUtils.java:416)
                                                                        at com.crashlytics.android.core.CrashlyticsController.writeSessionEvent(CrashlyticsController.java:1245)
                                                                        at com.crashlytics.android.core.CrashlyticsController.writeFatal(CrashlyticsController.java:885)
                                                                        at com.crashlytics.android.core.CrashlyticsController.access$400(CrashlyticsController.java:66)
                                                                        at com.crashlytics.android.core.CrashlyticsController$7.call(CrashlyticsController.java:318)
                                                                        at com.crashlytics.android.core.CrashlyticsController$7.call(CrashlyticsController.java:311)
                                                                        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
                                                                        at java.util.concurrent.FutureTask.run(FutureTask.java:137)
                                                                        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
                                                                        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
                                                                        at io.fabric.sdk.android.services.common.ExecutorUtils$1$1.onRun(ExecutorUtils.java:75)
                                                                        at io.fabric.sdk.android.services.common.BackgroundPriorityRunnable.run(BackgroundPriorityRunnable.java:30)
                                                                        at java.lang.Thread.run(Thread.java:856)
11-09 11:55:15.541 17255-17507/com.example.test E/AndroidRuntime: FATAL EXCEPTION: Thread-261
                                                                   java.lang.RuntimeException: test
                                                                       at com.example.test.system.HODSystem.calcSystemStatus(HODSystem.java:574)
                                                                       at com.example.test.system.HODSystem.UpdateAllSystemCalculation(HODSystem.java:798)
                                                                       at com.example.test.bl.SystemCalculator.run(SystemCalculator.java:21)
                                                                       at java.lang.Thread.run(Thread.java:856)
11-09 11:55:16.021 17255-17257/com.example.test D/dalvikvm: GC_CONCURRENT freed 659K, 5% free 24065K/25219K, paused 11ms+41ms, total 348ms
11-09 11:55:16.021 17255-17255/com.example.test D/dalvikvm: WAIT_FOR_CONCURRENT_GC blocked 138ms
11-09 11:55:16.021 17255-17506/com.example.test D/dalvikvm: WAIT_FOR_CONCURRENT_GC blocked 104ms
11-09 11:55:17.231 17255-17297/com.example.test I/CrashlyticsCore: Crashlytics report upload complete: 5A03D19A02E8-0001-4367-EE097F894C89

Here is some of my configuration:

build.gradle:

buildscript {
    repositories {
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'
        classpath 'io.fabric.tools:gradle:1.+'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

app/build.gradle:

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    maven { url 'https://maven.fabric.io/public' }
}

android {
    compileSdkVersion = 22
    buildToolsVersion = "25.0.2"

    defaultConfig {
        applicationId "com.example.test"
        minSdkVersion 15
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters 'x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'arm64-v8a', 'mips', 'mips64'
        }
        externalNativeBuild {
            cmake {
                cppFlags.addAll(['-std=c++11', '-fexceptions', '-Wall', '-Wno-literal-suffix','-g3'])
            }
        }
    }
    buildTypes {
        release {
            minifyEnabled = false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            ext.enableCrashlytics = false
        }
        debug {
            debuggable = true
            ext.enableCrashlytics = true
        }
        dev {
            initWith debug
            ext.enableCrashlytics = true
        }
    }



    externalNativeBuild {
        cmake {
            path "CMakeLists.txt"
        }
    }
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:22.2.1'
    compile 'com.android.support:design:22.2.1'
    compile('com.crashlytics.sdk.android:crashlytics:2.7.1@aar') {
        transitive = true;
    }
    compile('com.crashlytics.sdk.android:crashlytics-ndk:1.1.6@aar') {
        transitive = true;
    }
}
crashlytics {
    enableNdk true
    androidNdkOut 'src/main/cpp'
    androidNdkLibsOut 'src/main/cpp'
}

Application class:

public class App extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        Fabric.with(getApplicationContext(), new Crashlytics(), new CrashlyticsNdk());
    }

    @Override
    public void onTerminate() {
        super.onTerminate();
        System.exit(0);
    }
}

I also tried to throw a runtime exception in the activity's onCreate but still got the same results.

  • Internet permission added to manifest file
  • I'm using Android Studio 2.3.3, Windows 10.

I thought maybe System.exit(0) caused the issue but I tried to remove it and still I got this error. Didn't find ANYTHING about this in Google. Need your help please.

Thanks!

sharonooo
  • 684
  • 3
  • 8
  • 25
  • https://stackoverflow.com/questions/3875184/cant-create-handler-inside-thread-that-has-not-called-looper-prepare – IntelliJ Amiya Nov 09 '17 at 10:07
  • FYI, Using `System.exit(0);` is not good appraoch. – IntelliJ Amiya Nov 09 '17 at 10:09
  • 1
    @IntelliJAmiya I know :) It's just a workaround – sharonooo Nov 09 '17 at 10:10
  • @IntelliJAmiya I tried to throw exception in activity's on create but still got the same results.. – sharonooo Nov 09 '17 at 10:14
  • @IntelliJAmiya do u mean the code to i used raise an exception? – sharonooo Nov 09 '17 at 10:19
  • Possible duplicate of [Can't create handler inside thread that has not called Looper.prepare()](https://stackoverflow.com/questions/3875184/cant-create-handler-inside-thread-that-has-not-called-looper-prepare) – AesSedai101 Nov 09 '17 at 11:05
  • @AesSedai101 Still, I don't understand why Im getting this.. I'm trying to throw exception in the activity's onCreate method and still got the same issue – sharonooo Nov 09 '17 at 11:06
  • Isn't `ext.enableCrashlytics = false` in release build configuration the case you are not getting crash info in crashlytics? – Prokky Nov 09 '17 at 11:28
  • @Prokky No, I chose debug/dev build type – sharonooo Nov 09 '17 at 11:31
  • Mike from Fabric here. This is very strange, can you share your actual package name? – Mike Bonnell Nov 09 '17 at 15:36
  • Thanks, this is a strange one. Can you cause a test crash once more, relaunch the app and if you don't see the crash come through share the output of this line? Crashlytics report upload complete: 5A03D19A02E8-0001-4367-EE097F894C89 – Mike Bonnell Nov 10 '17 at 02:16
  • 11-10 11:10:40.829 2421-2465/com.example.test I/CrashlyticsCore: Crashlytics report upload complete: 5A05182600A6-0001-02C2-EE097F894C89 11-10 11:10:41.019 2421-2465/com.example.test I/CrashlyticsCore: Crashlytics report upload complete: 5A0518A601F4-0001-0975-EE097F894C89 11-10 11:10:41.219 2421-2465/com.example.test I/CrashlyticsCore: Crashlytics report upload complete: 5A0449C302F0-0001-0685-EE097F894C89 11-10 11:10:41.419 2421-2465/com.example.test I/CrashlyticsCore: Crashlytics report upload complete: 5A0449920382-0001-029F-EE097F894C89 – sharonooo Nov 10 '17 at 09:07
  • @MikeBonnell sorry for the line breaks. i see those four lines – sharonooo Nov 10 '17 at 09:08

0 Answers0