why App is Starting with 40 seconds of delay?

826 views Asked by At

in my SplashActivity I used retrofit and eventbus .

I must wait for starting retrofit request or maybe starting APP at least 40 second .

before that is just showing a white page.

in each second I get two Log series like this :

01-04 09:36:08.104 5217-5217/? W/dex2oat: Unexpected CPU variant for X86 using defaults: x86
01-04 09:36:08.104 5217-5217/? W/dex2oat: Mismatch between dex2oat instruction set features (ISA: X86 Feature string: smp,-ssse3,-sse4.1,-sse4.2,-avx,-avx2,-lock_add,-popcnt) and those of dex2oat executable (ISA: X86 Feature string: smp,ssse3,-sse4.1,-sse4.2,-avx,-avx2,-lock_add,-popcnt) for the command line:
01-04 09:36:08.104 5217-5217/? W/dex2oat: /system/bin/dex2oat --runtime-arg -classpath --runtime-arg & --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,-sse4.1,-sse4.2,-avx,-avx2,-lock_add,-popcnt --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/data/com.idek_2.titrefarsi/files/instant-run/dex/slice-com.android.support-cardview-v7-25.0.1_1baeb40f31cb26daebad20328eaaeda07318001c-classes.dex --oat-fd=35 --oat-location=/data/user/0/com.idek_2.titrefarsi/cache/slice-com.android.support-cardview-v7-25.0.1_1baeb40f31cb26daebad20328eaaeda07318001c-classes.dex --compiler-filter=speed
01-04 09:36:08.106 5217-5217/? I/dex2oat: /system/bin/dex2oat --debuggable --dex-file=/data/data/com.idek_2.titrefarsi/files/instant-run/dex/slice-com.android.support-cardview-v7-25.0.1_1baeb40f31cb26daebad20328eaaeda07318001c-classes.dex --oat-fd=35 --oat-location=/data/user/0/com.idek_2.titrefarsi/cache/slice-com.android.support-cardview-v7-25.0.1_1baeb40f31cb26daebad20328eaaeda07318001c-classes.dex --compiler-filter=speed
01-04 09:36:08.618 5217-5217/? I/dex2oat: dex2oat took 514.000ms (threads: 2) arena alloc=259KB (266112B) java alloc=86KB (88464B) native alloc=830KB (850408B) free=1729KB (1771032B)

what should I do ?

Thanks.

2

There are 2 answers

0
Manoj Perumarath On BEST ANSWER

Disable Instant run, and also disable deploy in instant run from File -> Settings

0
d4vidi On

In particular, the Mismatch between dex2oat instruction set features warning - which could be causing the delay, can result from the fact that the running emulator has been configured to run with an ABI (e.g. x86, x86_64) for which the native libraries are not available inside the associated APK.

For example, it is possible that the emulator is running one an x86_64 CPU/ABI and that the APK only includes native libraries for x86 and (maybe) armeabi-v7a.

Checking the emulator's ABI is easy to do using Android Studio:

AVD's dialog in Android Studio

(here the emulator is a x86).

Checking which native libraries' flavors have been included is also easy using Android Studio. Open the APK file by double tapping on it in the Project file-tree view, or drag and drop it from outside. Then, expand the 'lib' part of the content tree:

APK content: lib

(Here you see that all common ABI's have been included, namely x86_64, x86 and armeabi-v7a).

So in order to try to resolve this kind of an issue (this worked for me), you can try to either recreate a proper AVD, or revisit your app's splits configuration. This is a typical configuration for a standard, single-flavored APK:

android {
    // ...

    splits {
        abi {
            reset()
            enable false
            universalApk false
            include 'armeabi-v7a', 'x86', 'x86_64'
        }
    }
}

You can control the APK's content in this regard under the include part. Be advised, however, that without splitting the APK its overall size increases.

If you have more complex APK splitting configuration, you can still get this result, but better refer to the official documentation first.