Android Studio - 内置应用程序需要很长时间才能加载

时间:2016-01-17 02:24:20

标签: android android-studio

我是Android开发的新手。我建立了一个音板应用程序,在Play商店下载近1万个:),它没有任何问题也可以正常工作,启动时有一个小问题。当我点击图标启动应用程序时,我会看到一个白色的屏幕,在那里停留6秒钟,然后主要活动出现。 注意Logcat的第一行。这花了这么长时间是正常的吗?我尝试设置启动画面,但加载启动画面看起来仍然很长。任何帮助/建议将受到高度赞赏。 Here's the app on the playstore if anyone's curious to see the long wait. Logcat日志下面是应用程序的代码:

logcat的:

01-16 21:00:13.436 7562-7562/? I/art: Late-enabling -Xcheck:jni (THIS STEP TAKES ABOUT 6 SECONDS)
01-16 21:00:20.254 7562-7928/com.appnamehere.soundboard D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
01-16 21:00:20.270 7562-7562/com.appnamehere.soundboard D/Atlas: Validating map...
01-16 21:00:20.353 7562-7928/com.appnamehere.soundboard I/Adreno-EGL: <qeglDrvAPI_eglInitialize:410>: EGL 1.4 QUALCOMM build: AU_LINUX_ANDROID_LA.BF.1.1.1_RB1.05.01.00.042.030_msm8974_LA.BF.1.1.1_RB1__release_AU ()
01-16 21:00:20.353 7562-7928/com.appnamehere.soundboard I/Adreno-EGL: OpenGL ES Shader Compiler Version: E031.25.03.06
01-16 21:00:20.353 7562-7928/com.appnamehere.soundboard I/Adreno-EGL: Build Date: 04/15/15 Wed
01-16 21:00:20.353 7562-7928/com.appnamehere.soundboard I/Adreno-EGL: Local Branch: mybranch9068252
01-16 21:00:20.353 7562-7928/com.appnamehere.soundboard I/Adreno-EGL: Remote Branch: quic/LA.BF.1.1.1_rb1.19
01-16 21:00:20.353 7562-7928/com.appnamehere.soundboard I/Adreno-EGL: Local Patches: NONE
01-16 21:00:20.353 7562-7928/com.appnamehere.soundboard I/Adreno-EGL: Reconstruct Branch: AU_LINUX_ANDROID_LA.BF.1.1.1_RB1.05.01.00.042.030 +  NOTHING
01-16 21:00:20.354 7562-7928/com.appnamehere.soundboard I/OpenGLRenderer: Initialized EGL, version 1.4
01-16 21:00:20.388 7562-7928/com.appnamehere.soundboard D/OpenGLRenderer: Enabling debug mode 0
01-16 21:00:20.594 7562-7562/com.appnamehere.soundboard I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@3faeac2c time:273348490

以下是Java代码:

package com.appnamehere.soundboard;

import android.media.AudioManager;
import android.media.SoundPool;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;


public class MainActivity extends AppCompatActivity implements        View.OnClickListener{

Button Button1,Button2,Button3,Button4,Button5,Button6,Button7,Button8,Button9,Button10,Button11,Button12,Button13,Button14,Button15,Button16,Button17,Button18,Button19,Button20,Button21,Button22,Button23,Button24,Button25,Button26,Button27,Button28,Button29,Button30,Button31,Button32,Button33,Button34,Button35,Button36,Button37,Button38,Button39;

SoundPool sp;
int ahhId;
int all_hailId;
int attack_an_enemy_nowId;
int back_to_age_1Id;
int being_rushedId;
int blame_your_ispId;
int build_a_navyId;
int build_a_wonderId;
int cease_creating_extra_villagersId;
int create_extra_villagersId;
int dadgumId;
int dont_point_that_thingId;
int enemy_sightedId;
int food_pleaseId;
int give_me_your_extra_resourcesId;
int gold_pleaseId;
int herb_laughId;
int i_need_a_monkId;
int it_is_goodId;
int long_time_no_siegeId;
int my_grannyId;
int nice_town_ill_take_itId;
int noId;
int ooohId;
int quit_touchinId;
int raiding_partyId;
int rogganId;
int smite_meId;
int start_the_gameId;
int stone_pleaseId;
int stop_building_a_navyId;
int the_wonderId;
int wait_for_my_signalId;
int what_age_are_you_inId;
int wololoId;
int wood_pleaseId;
int yesId;
int you_play_2_hoursId;
int you_should_seeId;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);

    Button1 = (Button)findViewById(R.id.Button1);
    Button2 = (Button)findViewById(R.id.Button2);
    Button3 = (Button)findViewById(R.id.Button3);
    Button4 = (Button)findViewById(R.id.Button4);
    Button5 = (Button)findViewById(R.id.Button5);
    Button6 = (Button)findViewById(R.id.Button6);
    Button7 = (Button)findViewById(R.id.Button7);
    Button8 = (Button)findViewById(R.id.Button8);
    Button9 = (Button)findViewById(R.id.Button9);
    Button10 = (Button)findViewById(R.id.Button10);
    Button11 = (Button)findViewById(R.id.Button11);
    Button12 = (Button)findViewById(R.id.Button12);
    Button13 = (Button)findViewById(R.id.Button13);
    Button14 = (Button)findViewById(R.id.Button14);
    Button15 = (Button)findViewById(R.id.Button15);
    Button16 = (Button)findViewById(R.id.Button16);
    Button17 = (Button)findViewById(R.id.Button17);
    Button18 = (Button)findViewById(R.id.Button18);
    Button19 = (Button)findViewById(R.id.Button19);
    Button20 = (Button)findViewById(R.id.Button20);
    Button21 = (Button)findViewById(R.id.Button21);
    Button22 = (Button)findViewById(R.id.Button22);
    Button23 = (Button)findViewById(R.id.Button23);
    Button24 = (Button)findViewById(R.id.Button24);
    Button25 = (Button)findViewById(R.id.Button25);
    Button26 = (Button)findViewById(R.id.Button26);
    Button27 = (Button)findViewById(R.id.Button27);
    Button28 = (Button)findViewById(R.id.Button28);
    Button29 = (Button)findViewById(R.id.Button29);
    Button30 = (Button)findViewById(R.id.Button30);
    Button31 = (Button)findViewById(R.id.Button31);
    Button32 = (Button)findViewById(R.id.Button32);
    Button33 = (Button)findViewById(R.id.Button33);
    Button34 = (Button)findViewById(R.id.Button34);
    Button35 = (Button)findViewById(R.id.Button35);
    Button36 = (Button)findViewById(R.id.Button36);
    Button37 = (Button)findViewById(R.id.Button37);
    Button38 = (Button)findViewById(R.id.Button38);
    Button39 = (Button)findViewById(R.id.Button39);

    Button1.setOnClickListener(this);
    Button2.setOnClickListener(this);
    Button3.setOnClickListener(this);
    Button4.setOnClickListener(this);
    Button5.setOnClickListener(this);
    Button6.setOnClickListener(this);
    Button7.setOnClickListener(this);
    Button8.setOnClickListener(this);
    Button9.setOnClickListener(this);
    Button10.setOnClickListener(this);
    Button11.setOnClickListener(this);
    Button12.setOnClickListener(this);
    Button13.setOnClickListener(this);
    Button14.setOnClickListener(this);
    Button15.setOnClickListener(this);
    Button16.setOnClickListener(this);
    Button17.setOnClickListener(this);
    Button18.setOnClickListener(this);
    Button19.setOnClickListener(this);
    Button20.setOnClickListener(this);
    Button21.setOnClickListener(this);
    Button22.setOnClickListener(this);
    Button23.setOnClickListener(this);
    Button24.setOnClickListener(this);
    Button25.setOnClickListener(this);
    Button26.setOnClickListener(this);
    Button27.setOnClickListener(this);
    Button28.setOnClickListener(this);
    Button29.setOnClickListener(this);
    Button30.setOnClickListener(this);
    Button31.setOnClickListener(this);
    Button32.setOnClickListener(this);
    Button33.setOnClickListener(this);
    Button34.setOnClickListener(this);
    Button35.setOnClickListener(this);
    Button36.setOnClickListener(this);
    Button37.setOnClickListener(this);
    Button38.setOnClickListener(this);
    Button39.setOnClickListener(this);

    sp = new SoundPool(20, AudioManager.STREAM_MUSIC, 0);

    ahhId = sp.load(this, R.raw.ahh, 1);
    all_hailId = sp.load(this, R.raw.all_hail, 1);
    attack_an_enemy_nowId = sp.load(this, R.raw.attack_an_enemy_now, 1);
    back_to_age_1Id = sp.load(this, R.raw.back_to_age_1, 1);
    being_rushedId = sp.load(this, R.raw.being_rushed, 1);
    blame_your_ispId = sp.load(this, R.raw.blame_your_isp, 1);
    build_a_navyId = sp.load(this, R.raw.build_a_navy, 1);
    build_a_wonderId = sp.load(this, R.raw.build_a_wonder, 1);
    cease_creating_extra_villagersId = sp.load(this, R.raw.cease_creating_extra_villagers, 1);
    create_extra_villagersId = sp.load(this, R.raw.create_extra_villagers, 1);
    dadgumId = sp.load(this, R.raw.dadgum, 1);
    dont_point_that_thingId = sp.load(this, R.raw.dont_point_that_thing, 1);
    enemy_sightedId = sp.load(this, R.raw.enemy_sighted, 1);
    food_pleaseId = sp.load(this, R.raw.food_please, 1);
    give_me_your_extra_resourcesId = sp.load(this, R.raw.give_me_your_extra_resources, 1);
    gold_pleaseId = sp.load(this, R.raw.gold_please, 1);
    herb_laughId = sp.load(this, R.raw.herb_laugh, 1);
    i_need_a_monkId = sp.load(this, R.raw.i_need_a_monk, 1);
    it_is_goodId = sp.load(this, R.raw.it_is_good, 1);
    long_time_no_siegeId = sp.load(this, R.raw.long_time_no_siege, 1);
    my_grannyId = sp.load(this, R.raw.my_granny, 1);
    nice_town_ill_take_itId = sp.load(this, R.raw.nice_town_ill_take_it, 1);
    noId = sp.load(this, R.raw.no, 1);
    ooohId = sp.load(this, R.raw.oooh, 1);
    quit_touchinId = sp.load(this, R.raw.quit_touchin, 1);
    raiding_partyId = sp.load(this, R.raw.raiding_party, 1);
    rogganId = sp.load(this, R.raw.roggan, 1);
    smite_meId = sp.load(this, R.raw.smite_me, 1);
    start_the_gameId = sp.load(this, R.raw.start_the_game, 1);
    stone_pleaseId = sp.load(this, R.raw.stone_please, 1);
    stop_building_a_navyId = sp.load(this, R.raw.stop_building_a_navy, 1);
    the_wonderId = sp.load(this, R.raw.the_wonder, 1);
    wait_for_my_signalId = sp.load(this, R.raw.wait_for_my_signal, 1);
    what_age_are_you_inId = sp.load(this, R.raw.what_age_are_you_in, 1);
    wololoId = sp.load(this, R.raw.wololo, 1);
    wood_pleaseId = sp.load(this, R.raw.wood_please, 1);
    yesId = sp.load(this, R.raw.yes, 1);
    you_play_2_hoursId = sp.load(this, R.raw.you_play_2_hours, 1);
    you_should_seeId = sp.load(this, R.raw.you_should_see, 1);


}

@Override
public void onClick(View v) {
    if(v==Button1) {sp.play(ahhId, 1, 1, 1, 0, 1);
    } else if(v==Button2) {sp.play(all_hailId, 1, 1, 1, 0, 1);
    } else if(v==Button3) {sp.play(attack_an_enemy_nowId, 1, 1, 1, 0, 1);
    } else if(v==Button4) {sp.play(back_to_age_1Id,1,1,1,0,1);
    } else if(v==Button5) {sp.play(being_rushedId,1,1,1,0,1);
    } else if(v==Button6) {sp.play(blame_your_ispId,1,1,1,0,1);
    } else if(v==Button7) {sp.play(build_a_navyId,1,1,1,0,1);
    } else if(v==Button8) {sp.play(build_a_wonderId,1,1,1,0,1);
    } else if(v==Button9) {sp.play(cease_creating_extra_villagersId,1,1,1,0,1);
    } else if(v==Button10) {sp.play(create_extra_villagersId,1,1,1,0,1);
    } else if(v==Button11) {sp.play(dadgumId,1,1,1,0,1);
    } else if(v==Button12) {sp.play(dont_point_that_thingId,1,1,1,0,1);
    } else if(v==Button13) {sp.play(enemy_sightedId,1,1,1,0,1);
    } else if(v==Button14) {sp.play(food_pleaseId,1,1,1,0,1);
    } else if(v==Button15) {sp.play(give_me_your_extra_resourcesId,1,1,1,0,1);
    } else if(v==Button16) {sp.play(gold_pleaseId,1,1,1,0,1);
    } else if(v==Button17) {sp.play(herb_laughId,1,1,1,0,1);
    } else if(v==Button18) {sp.play(i_need_a_monkId,1,1,1,0,1);
    } else if(v==Button19) {sp.play(it_is_goodId,1,1,1,0,1);
    } else if(v==Button20) {sp.play(long_time_no_siegeId,1,1,1,0,1);
    } else if(v==Button21) {sp.play(my_grannyId,1,1,1,0,1);
    } else if(v==Button22) {sp.play(nice_town_ill_take_itId,1,1,1,0,1);
    } else if(v==Button23) {sp.play(noId,1,1,1,0,1);
    } else if(v==Button24) {sp.play(ooohId,1,1,1,0,1);
    } else if(v==Button25) {sp.play(quit_touchinId,1,1,1,0,1);
    } else if(v==Button26) {sp.play(raiding_partyId,1,1,1,0,1);
    } else if(v==Button27) {sp.play(rogganId,1,1,1,0,1);
    } else if(v==Button28) {sp.play(smite_meId,1,1,1,0,1);
    } else if(v==Button29) {sp.play(start_the_gameId,1,1,1,0,1);
    } else if(v==Button30) {sp.play(stone_pleaseId,1,1,1,0,1);
    } else if(v==Button31) {sp.play(stop_building_a_navyId,1,1,1,0,1);
    } else if(v==Button32) {sp.play(the_wonderId, 1, 1, 1, 0, 1);
    } else if(v==Button33) {sp.play(wait_for_my_signalId, 1, 1, 1, 0, 1);
    } else if(v==Button34) {sp.play(what_age_are_you_inId, 1, 1, 1, 0, 1);
    } else if(v==Button35) {sp.play(wololoId,1,1,1,0,1);
    } else if(v==Button36) {sp.play(wood_pleaseId,1,1,1,0,1);
    } else if(v==Button37) {sp.play(yesId, 1, 1, 1, 0, 1);
    } else if(v==Button38) {sp.play(you_play_2_hoursId,1,1,1,0,1);
    } else if(v==Button39) {sp.play(you_should_seeId,1,1,1,0,1);
    }
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.menu_main, menu);
    return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    //noinspection SimplifiableIfStatement
    if (id == R.id.action_settings) {
        return true;
    }
    return super.onOptionsItemSelected(item);
}
}

1 个答案:

答案 0 :(得分:0)

其他用户的评论:

经过漫长的一小时后,我找出了我的drawable文件夹中的问题,实际的错误来源。我修改了一些png,清理和重建项目。有用。谢谢你的回复。 - Ritesh Bhagat 8月24日&#39; 15 at 7:10

问题:How to solve Late-enabling CheckJNI?

看看这对你有帮助。