首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >应用程序加载第一个活动需要很长时间

应用程序加载第一个活动需要很长时间
EN

Stack Overflow用户
提问于 2016-04-12 23:02:02
回答 1查看 695关注 0票数 0

我的应用在调用我的应用的启动器活动的onCreate方法之前,在Nexus6上花费了大约20秒的时间。这些是我的第一个活动变得可见之前的日志。

代码语言:javascript
复制
04-12 19:30:46.564 12518-12518/com.dealsmash.dealsmashapp W/System: ClassLoader referenced unknown path: /data/app/com.dealsmash.dealsmashapp-1/lib/arm
04-12 19:31:05.862 12518-12518/com.dealsmash.dealsmashapp W/System: ClassLoader referenced unknown path: /data/app/com.dealsmash.dealsmashapp-1/lib/arm
04-12 19:31:05.909 12518-12518/com.dealsmash.dealsmashapp I/MultiDex: VM with version 2.1.0 has multidex support
04-12 19:31:05.909 12518-12518/com.dealsmash.dealsmashapp I/MultiDex: install
04-12 19:31:05.910 12518-12518/com.dealsmash.dealsmashapp I/MultiDex: VM has multidex support, MultiDex support library is disabled.
04-12 19:31:06.045 12518-13453/com.dealsmash.dealsmashapp I/GMPM: App measurement is starting up
04-12 19:31:06.174 12518-12518/com.dealsmash.dealsmashapp W/sh.dealsmashapp: type=1400 audit(0.0:162190): avc: denied { getattr } for path="/proc/sysrq-trigger" dev="proc" ino=4026544381 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:proc_sysrq:s0 tclass=file permissive=0
04-12 19:31:06.174 12518-12518/com.dealsmash.dealsmashapp W/sh.dealsmashapp: type=1400 audit(0.0:162191): avc: denied { getattr } for path="/proc/1" dev="proc" ino=8630890 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:init:s0 tclass=dir permissive=0
04-12 19:31:06.174 12518-12518/com.dealsmash.dealsmashapp W/sh.dealsmashapp: type=1400 audit(0.0:162192): avc: denied { getattr } for path="/proc/2" dev="proc" ino=8630891 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
04-12 19:31:06.174 12518-12518/com.dealsmash.dealsmashapp W/sh.dealsmashapp: type=1400 audit(0.0:162193): avc: denied { getattr } for path="/proc/3" dev="proc" ino=8630892 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
04-12 19:31:06.174 12518-12518/com.dealsmash.dealsmashapp W/sh.dealsmashapp: type=1400 audit(0.0:162194): avc: denied { getattr } for path="/proc/7" dev="proc" ino=8630893 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
04-12 19:31:06.174 12518-12518/com.dealsmash.dealsmashapp W/sh.dealsmashapp: type=1400 audit(0.0:162195): avc: denied { getattr } for path="/proc/8" dev="proc" ino=8630894 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
04-12 19:31:06.174 12518-12518/com.dealsmash.dealsmashapp W/sh.dealsmashapp: type=1400 audit(0.0:162196): avc: denied { getattr } for path="/proc/9" dev="proc" ino=8630895 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
04-12 19:31:06.174 12518-12518/com.dealsmash.dealsmashapp W/sh.dealsmashapp: type=1400 audit(0.0:162197): avc: denied { getattr } for path="/proc/10" dev="proc" ino=8630896 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
04-12 19:31:06.174 12518-12518/com.dealsmash.dealsmashapp W/sh.dealsmashapp: type=1400 audit(0.0:162198): avc: denied { getattr } for path="/proc/11" dev="proc" ino=8630897 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
04-12 19:31:06.174 12518-12518/com.dealsmash.dealsmashapp W/sh.dealsmashapp: type=1400 audit(0.0:162199): avc: denied { getattr } for path="/proc/12" dev="proc" ino=8630898 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
04-12 19:31:06.174 12518-12518/com.dealsmash.dealsmashapp W/sh.dealsmashapp: type=1400 audit(0.0:162200): avc: denied { getattr } for path="/proc/15" dev="proc" ino=8630899 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
04-12 19:31:06.174 12518-12518/com.dealsmash.dealsmashapp W/sh.dealsmashapp: type=1400 audit(0.0:162201): avc: denied { getattr } for path="/proc/16" dev="proc" ino=8630900 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
04-12 19:31:06.184 12518-12518/com.dealsmash.dealsmashapp W/sh.dealsmashapp: type=1400 audit(0.0:162202): avc: denied { getattr } for path="/proc/19" dev="proc" ino=8630901 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
04-12 19:31:06.184 12518-12518/com.dealsmash.dealsmashapp W/sh.dealsmashapp: type=1400 audit(0.0:162203): avc: denied { getattr } for path="/proc/20" dev="proc" ino=8630902 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
04-12 19:31:06.184 12518-12518/com.dealsmash.dealsmashapp W/sh.dealsmashapp: type=1400 audit(0.0:162204): avc: denied { getattr } for path="/proc/23" dev="proc" ino=8630903 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
04-12 19:31:06.184 12518-12518/com.dealsmash.dealsmashapp W/sh.dealsmashapp: type=1400 audit(0.0:162205): avc: denied { getattr } for path="/proc/24" dev="proc" ino=8630904 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
04-12 19:31:06.184 12518-12518/com.dealsmash.dealsmashapp W/sh.dealsmashapp: type=1400 audit(0.0:162206): avc: denied { getattr } for path="/proc/26" dev="proc" ino=8630905 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
04-12 19:31:06.184 12518-12518/com.dealsmash.dealsmashapp W/sh.dealsmashapp: type=1400 audit(0.0:162207): avc: denied { getattr } for path="/proc/28" dev="proc" ino=8630906 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
04-12 19:31:06.184 12518-12518/com.dealsmash.dealsmashapp W/sh.dealsmashapp: type=1400 audit(0.0:162208): avc: denied { getattr } for path="/proc/29" dev="proc" ino=8630907 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
04-12 19:31:06.184 12518-12518/com.dealsmash.dealsmashapp W/sh.dealsmashapp: type=1400 audit(0.0:162209): avc: denied { getattr } for path="/proc/30" dev="proc" ino=8630908 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:r:kernel:s0 tclass=dir permissive=0
04-12 19:31:08.740 12518-12518/com.dealsmash.dealsmashapp I/CrashlyticsCore: Initializing Crashlytics 2.3.8.97
04-12 19:31:08.772 12518-12518/com.dealsmash.dealsmashapp D/LoginManager: initInstance
04-12 19:31:08.817 12518-12518/com.dealsmash.dealsmashapp D/ContentManager: initInstance
04-12 19:31:08.825 12518-12518/com.dealsmash.dealsmashapp D/BeaconManager: initInstance
04-12 19:31:08.907 12518-13554/com.dealsmash.dealsmashapp D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
04-12 19:31:09.086 12518-12518/com.dealsmash.dealsmashapp D/LoginActivity: onCreate
04-12 19:31:09.585 12518-12524/com.dealsmash.dealsmashapp W/art: Suspending all threads took: 11.012ms
04-12 19:31:09.727 12518-12518/com.dealsmash.dealsmashapp D/ContentManager: fetching all interests
04-12 19:31:09.904 12518-13554/com.dealsmash.dealsmashapp I/Adreno: QUALCOMM build                   : 52af4d2, I8366cd0437
                                                                Build Date                       : 10/20/15
                                                                OpenGL ES Shader Compiler Version: XE031.05.13.02
                                                                Local Branch                     : M14
                                                                Remote Branch                    : 
                                                                Remote Branch                    : 
                                                                Reconstruct Branch               : 
04-12 19:31:09.909 12518-13554/com.dealsmash.dealsmashapp I/OpenGLRenderer: Initialized EGL, version 1.4

请注意,应用程序在46秒启动,但我的第一个activity LoginActivityonCreate方法在下一分钟的第9秒被调用。

首先,我怀疑这是由于一些新添加的依赖,但在我删除它们之后,问题仍然是他们的。这是我的模块的build.gradle文件,以防万一。

代码语言:javascript
复制
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'
apply plugin: 'com.google.gms.google-services'

android {
    signingConfigs {
        releaseConfig {
            keyAlias 'ds_a'
            keyPassword 'dealsmash'
            storeFile file('C:/Android/keystore/dealsmash_android.keystore')
            storePassword 'dealsmash'
        }
    }
    compileSdkVersion 23
    buildToolsVersion "23.0.2"
    defaultConfig {
        applicationId "com.dealsmash.dealsmashapp"
        minSdkVersion 15
        targetSdkVersion 22
        versionCode 21
        versionName "2.1"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            zipAlignEnabled true
            signingConfig signingConfigs.releaseConfig
        }
        debug {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    dexOptions {
        javaMaxHeapSize "4g"
    }
    packagingOptions {
        exclude 'main/AndroidManifest.xml'
    }
}

repositories {
    mavenCentral()
    maven { url 'https://maven.fabric.io/public' }
    maven { url "https://jitpack.io" }
    maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
//    maven { url 'https://github.com/taplytics/Taplytics-Android-SDK/raw/master/AndroidStudio/' }
}

dependencies {
    compile 'com.facebook.android:facebook-android-sdk:4.7.0'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.shamanland:xdroid-toaster:0.2.4'
    compile 'com.kontaktio.sdk:kontakt-sdk:2.1.2'
    compile 'com.google.android.gms:play-services:8.3.0'
    compile "com.android.support:design:${android_support_lib_version}"
    compile "com.android.support:cardview-v7:${android_support_lib_version}"
    compile 'com.github.bumptech.glide:glide:3.6.1'
    compile 'com.mcxiaoke.volley:library:1.0.17'
    compile 'com.google.zxing:core:3.2.0'
    compile 'com.google.code.gson:gson:2.4'
    compile 'com.google.android.gms:play-services-analytics:8.3.0'
    compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') { transitive = true; }
    //    compile 'com.github.javiersantos:MaterialStyledDialogs:1.3'
    compile 'com.bugfender.sdk:android:0.1.8-SNAPSHOT'

    //  compile 'com.github.nitinverma:ViewPagerIndicator:2.4.2.0:release@aar'

    // Taplytics
    //    compile("com.taplytics.sdk:taplytics:+@aar")
    // Dependencies for Taplytics
    //    compile("com.squareup.okhttp:okhttp-urlconnection:+")
    //    compile("com.squareup.okhttp:okhttp:+")
    //Excluding org.json due to compiler warnings
    //    compile("com.github.nkzawa:socket.io-client:+") {
    //        exclude group: "org.json"
    //    }
    //    compile("com.github.nkzawa:engine.io-client:+") {
    //        exclude group: "org.json"
    //    }
}  

这是我的Application类。

代码语言:javascript
复制
public class DealSmashApplication extends Application
{
    private Tracker mTracker;
    public PollManager pollManager;

    @Override
    public void onCreate()
    {
        super.onCreate();
        Bugfender.init(this, "Eu6Djgg8dakcYwjBQKIlmYL9A3Xxo7AK", BuildConfig.DEBUG);
//        Taplytics.startTaplytics(this, "ce36925556402e12404b38586de9cb5fb7d4e5ec");
        Fabric.with(this, new Crashlytics());
        LoginManager.initInstance(this);
        pollManager = PollManager.initInstance(this);
        ContentManager.initInstance(this);
        BeaconManager.initInstance(this);
    }

    @Override
    protected void attachBaseContext(Context base)
    {
        super.attachBaseContext(base);
        MultiDex.install(this);
    }

    @Override
    public void onTerminate()
    {
        AlertsAndLogs.log("Application", "onTerminate");
        super.onTerminate();
        pollManager.stopPolling();
    }

    /**
     * Gets the default {@link Tracker} for this {@link Application}.
     *
     * @return tracker
     */
    synchronized public Tracker getDefaultTracker()
    {
        if (mTracker == null)
        {
            GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
            // To enable debug logging use: adb shell setprop log.tag.GAv4 DEBUG
            mTracker = analytics.newTracker(R.xml.global_tracker);
        }
        return mTracker;
    }
}
EN

回答 1

Stack Overflow用户

发布于 2016-04-12 23:12:46

要找出哪种方法需要很长时间,可以尝试使用下面的http://developer.android.com/tools/debugging/debugging-tracing.html

在创建时,您真的需要应用程序中的所有方法吗?我想其中一个是需要一段时间的

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/36577097

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档