Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/226.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
android调试中的结构初始化非常慢_Android_Android Ndk_Crashlytics_Google Fabric_Crashlytics Android - Fatal编程技术网

android调试中的结构初始化非常慢

android调试中的结构初始化非常慢,android,android-ndk,crashlytics,google-fabric,crashlytics-android,Android,Android Ndk,Crashlytics,Google Fabric,Crashlytics Android,我正在尝试在android上集成fabric(包括crashlytics和NDK支持以及answers),我让它们工作起来了 然而,当我尝试调试我的应用程序时,fabric需要很长时间(大约5MN)来完成它的工作 以下是日志: 10-16 11:41:49.680 1534-1559/? V/WindowManager: Relayout Window{326db3dd0 u0 Starting app.company.com}: viewVisibility=0 req=2048x1536 W

我正在尝试在android上集成fabric(包括crashlytics和NDK支持以及answers),我让它们工作起来了

然而,当我尝试调试我的应用程序时,fabric需要很长时间(大约5MN)来完成它的工作

以下是日志:

10-16 11:41:49.680 1534-1559/? V/WindowManager: Relayout Window{326db3dd0 u0 Starting app.company.com}: viewVisibility=0 req=2048x1536 WM.LayoutParams{(0,0)(fillxfill) sim=#20 ty=3 fl=#81830518 pfl=0x20011 wanim=0x103038a vsysui=0x600 needsMenuKey=2 naviIconColor=0}
10-16 11:41:49.701 1534-1559/? D/WindowManager: finishDrawingWindow: Window{326db3dd0 u0 Starting app.company.com} mDrawState=DRAW_PENDING
10-16 11:41:49.714 1534-1559/? I/WindowManager: Screen frozen for +113ms due to Window{326db3dd0 u0 Starting app.company.com}
10-16 11:41:49.945 21418-21684/app.company.com W/art: Verification of io.fabric.sdk.android.services.settings.Settings io.fabric.sdk.android.services.settings.Settings.initialize(io.fabric.sdk.android.Kit, io.fabric.sdk.android.services.common.IdManager, io.fabric.sdk.android.services.network.HttpRequestFactory, java.lang.String, java.lang.String, java.lang.String) took 173.644ms
10-16 11:44:51.139 21418-21684/app.company.com W/art: Verification of boolean io.fabric.sdk.android.services.settings.Settings.loadSettingsSkippingCache() took 181.194s
10-16 11:44:51.164 21418-21418/app.company.com D/libcrashlytics: Initializing libcrashlytics version 1.1.5
10-16 11:44:51.165 21418-21418/app.company.com D/libcrashlytics: Attempting to load unwinder...
10-16 11:49:24.955 21418-21684/app.company.com W/art: Verification of java.lang.String io.fabric.sdk.android.services.common.AbstractSpiCall.overrideProtocolAndHost(java.lang.String) took 303.615ms
10-16 11:49:25.366 21418-21418/app.company.com D/libcrashlytics: Done; using libunwind
10-16 11:49:25.366 21418-21418/app.company.com D/libcrashlytics: Attempting to register signal handler...
10-16 11:49:25.367 21418-21418/app.company.com D/libcrashlytics: Signal handler registered.
10-16 11:49:25.370 21418-21418/app.company.com D/libcrashlytics: Initializing native crash handling successful.
正如你所看到的

Verification of boolean io.fabric.sdk.android.services.settings.Settings.loadSettingsSkippingCache() took 181.194s
花费了近300万美元

Attempting to load unwinder...
也花了3分钟

当我尝试在没有调试器连接的情况下启动应用程序时(只需在AndroidStudio中运行而不是调试),应用程序可以正常启动

如果您有任何关于在何处查找此问题的指示,我们将不胜感激

吉勒姆

编辑1: 挖掘一点之后,实际上是从JNITINAVEAPI发出的调用调用

System.loadLibrary("crashlytics");
这首先需要很多时间。还不知道第二次冻结的时间

这很奇怪,因为这个库看起来很轻(libcrashlytics.so大约是600ko)

编辑2: 以下是我的gradle构建的结构:

在顶层,proj.android文件夹中有一个build.gradle,其中包含所有子项目通用的所有配置选项(abiFilters、minSdkVersion…):

然后我有一个build.gradle文件用于我所有的子项目(1 com.android.application和4 com.android.library)

我不认为library build.gradle文件是相关的,因为我没有在其中放入任何与结构相关的初始化,所以这里是我的build.gradle,用于主应用程序:

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

    dependencies {
        // These docs use an open ended version so that our plugin
        // can be updated quickly in response to Android tooling updates

        // We recommend changing it to the latest version from our changelog:
        // https://docs.fabric.io/android/changelog.html#fabric-gradle-plugin
        classpath 'io.fabric.tools:gradle:1.24.2'
    }
}

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

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

android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    buildToolsVersion rootProject.ext.buildToolsVersion

    sourceSets.main {
        res.srcDir "res"
        assets.srcDirs 'sources'
        jniLibs.srcDirs "jni"
        java.srcDirs "java sources dirs"
        manifest.srcFile "AndroidManifest.xml"
    }

    defaultConfig {
        applicationId 'app.company.com'
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 2
        versionName '0.1'
        ndk {
            moduleName "moduleName"
            abiFilters rootProject.ext.abiFilters.join(",").split(",")
        }
        externalNativeBuild {
            cmake {
                cppFlags rootProject.ext.cppReleaseFlags.join(",").split(",")
                arguments rootProject.ext.arguments.join(",").split(",")
                targets "target"
            }
        }
    }

    buildTypes {
        debug {
            externalNativeBuild {
                cmake {
                    cppFlags rootProject.ext.cppDebugFlags.join(",").split(",")
                }
                // to do: swap those two lines when when debug testing will be done
                ext.alwaysUpdateBuildId = false // STACKOVERFLOW NOTE: commenting this line doesn't change anything to the problem
                //ext.enableCrashlytics = false
            }
        }
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    externalNativeBuild {
        cmake {
            path "../../CMakeLists.txt"
        }
    }

    aaptOptions {
        cruncherEnabled = false
        noCompress 'zspine', 'zparticles', 'gz'
    }
}

crashlytics {
    enableNdk true
    manifestPath 'AndroidManifest.xml'
    // are these needed?
    // STACKOVERFLOW NOTE: I tried put the values that are given in the docs, but it doesn't seems to change anything
    //androidNdkOut 'build/intermediates/cmake/release/obj'
    //androidNdkLibsOut 'build/intermediates/bundles/default/jni'
}

// STACKOVERFLOW NOTE: here are some task definition to automatically update sources, I don't think they are relevant to the matter at hand
...

dependencies {
    compile fileTree(dir:'someJars')

    compile('com.crashlytics.sdk.android:crashlytics:2.7.0@aar') {
        transitive = true;
    }
    compile('com.crashlytics.sdk.android:crashlytics-ndk:1.1.6@aar') {
        transitive = true;
    }

    debugCompile project(path: ':lib1', configuration: 'debug')
    debugCompile project(path: ':lib2', configuration: 'debug')
    debugCompile project(path: ':lib3', configuration: 'debug')
    debugCompile project(path: ':lib4', configuration: 'debug')

    releaseCompile project(path: ':lib1', configuration: 'release')
    releaseCompile project(path: ':lib2', configuration: 'release')
    releaseCompile project(path: ':lib3', configuration: 'release')
    releaseCompile project(path: ':lib4', configuration: 'release')
}
我还在清单中添加了

...
<application android:label="@string/app_name"
    android:icon="@drawable/icon">

    <!-- name of our .so -->
    <meta-data android:name="android.app.lib_name"
        android:value="name" />

    <meta-data android:name="io.fabric.ApiKey"
        android:value="API Key"
        />
...
非常感谢您的快速回答,我希望更多的信息将有帮助

编辑3
我在几个设备上进行了测试(galaxy tab s3@7.0和google pixel C@7.1.1),没有任何区别,问题仍然存在。

我现在不知道具体如何解决,但一旦我重新启动笔记本电脑,问题就消失了。我想这与adb调试器不知何故被卡住有关?

对于
crashlytics
使用
FIREBASE
这里的Fabric中的Mike。嗯,我正在本地测试,没有看到相同的问题。你能分享你的Fabric初始化代码和build.gradle吗?你好!非常感谢你的快速回答。我已经更新了我的问题(编辑2),以提供build.gradle和其他相关文件的详细信息。感谢您的其他编辑,因为它们看起来都很好,但无论是通过模拟器还是设备进行测试,我都无法生成3分钟的初始时间。您正在测试哪些设备和操作系统?再次感谢您花时间回答。我通过重启我的laptotp解决了这个问题,但我不明白为什么它解决了这个问题,可能是因为adb在某个时候被绊倒了,或者其他一些事情,我真的不知道,但现在一切都很好…是的。。!这是亚行的问题
...
<application android:label="@string/app_name"
    android:icon="@drawable/icon">

    <!-- name of our .so -->
    <meta-data android:name="android.app.lib_name"
        android:value="name" />

    <meta-data android:name="io.fabric.ApiKey"
        android:value="API Key"
        />
...
// TODO uncomment this when testing's over
//Crashlytics crashlyticsKit = new Crashlytics.Builder().core(new CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build()).build();
//Fabric.with(this, crashlyticsKit);

Fabric fabric = new Fabric.Builder(this).kits(new Crashlytics(), new CrashlyticsNdk())
        .debuggable(true)
        .build();
Fabric.with(fabric);