gpt4 book ai didi

android - Crashlytics 织物 : Failed to execute task

转载 作者:IT老高 更新时间:2023-10-28 21:53:09 29 4
gpt4 key购买 nike

我遇到了问题,不知道如何解决。

我的项目使用 crashlytics,但它总是崩溃且未发送报告。我有一个超时异常:

08-25 03:04:31.876    2856-2856/connectivit.app E/Fabric﹕ Failed to execute task.
java.util.concurrent.TimeoutException
at java.util.concurrent.FutureTask.get(FutureTask.java:176)
at com.crashlytics.android.core.CrashlyticsExecutorServiceWrapper.executeSyncLoggingException(CrashlyticsExecutorServiceWrapper.java:44)
at com.crashlytics.android.core.CrashlyticsUncaughtExceptionHandler.uncaughtException(CrashlyticsUncaughtExceptionHandler.java:275)
at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693)
at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690)
--------- beginning of crash
08-25 03:04:31.876 2856-2856/connectivit.app E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: connectivit.app, PID: 2856
java.lang.RuntimeException: Unable to start activity ComponentInfo{connectivit.app/connectivit.app.Activity.Main.MainActivity}: java.lang.RuntimeException: This is a crash
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: java.lang.RuntimeException: This is a crash
at connectivit.app.Activity.Main.MainActivity.initTabs(MainActivity.java:117)
at connectivit.app.Activity.Main.MainActivity.onCreate(MainActivity.java:57)
at android.app.Activity.performCreate(Activity.java:5933)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)

编辑

我的 build.gradle 文件:

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

dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

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

android {
signingConfigs {
release {
keyAlias 'android.keystore'
storeFile file('/Users/jordan/android.keystore.jks')
storePassword ""
keyPassword ""
}
config {
keyAlias 'androiddebugkey'
keyPassword 'android'
storeFile file('/Users/jordan/.android/debug.keystore')
storePassword 'android'
}
}
compileSdkVersion 23
buildToolsVersion '23'
defaultConfig {
applicationId “com.test"
minSdkVersion 14
targetSdkVersion 23
versionCode 12
versionName '1'

// Enabling multidex support.
multiDexEnabled true
}

buildTypes {
debug {
versionNameSuffix "-DEBUG"
}
release {
minifyEnabled true
zipAlignEnabled true

proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
packagingOptions {
exclude 'META-INF/ASL2.0'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
lintOptions {
// set to true to turn off analysis progress reporting by lint
quiet false
// if true, stop the gradle build if errors are found
abortOnError false
// if true, only report errors
ignoreWarnings true
}
productFlavors {
}
}

dependencies {
//--- Android
compile 'com.android.support:design:23.0.0'
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:multidex:1.0.0'

//--- Fabric
compile('com.crashlytics.sdk.android:crashlytics:2.4.0@aar') {
transitive = true;
}
}

Crashlytics 初始化:

public class MyApplication extends MultiDexApplication {

@Override
public void onCreate() {
super.onCreate();

Fabric.with(this, new Crashlytics());

if (!BuildConfig.DEBUG) {
Log.d("Ez", "Release mode. Crashlytics enable");
//Fabric.with(this, new Crashlytics());
} else {
Log.d("Ez", "Debug mode. Crashlytics disable");
}

throw new RuntimeException("This is a crash");
}
}

最佳答案

这个问题在 2019 年仍然让我抓狂,但我想我终于想通了,异常是什么原因造成的。

我按照 official firebase documentation 中给出的所有设置说明进行操作。 ,但是当我测试我的解决方案时,由于 TimeoutException,我没有收到有关 Firebase Crashlytics 管理员的任何报告。

就我而言,原因是我在主要 Activity 的 onCreate() 或 onResume() 方法中触发了异常。当我让我的应用程序在第一次启动时正常运行时,后来我开始没有任何错误地获取报告,所以我认为这很重要,在第一次启动时应用程序不应该在钩子(Hook)方法

希望我的经验有所帮助。

关于android - Crashlytics 织物 : Failed to execute task,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32197659/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com