Program: 172695
Project: 172695
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  prefs=PreferenceManager.getDefaultSharedPreferences(this);
  titleView=findViewById(R.id.title);
  highScoreView=findViewById(R.id.highScore);
  hintView=findViewById(R.id.hint);
  buttonLayout=findViewById(R.id.buttonLayout);
  musicView=findViewById(R.id.music);
  soundView=findViewById(R.id.sound);
  achievementsView=findViewById(R.id.achievements);
  rankView=findViewById(R.id.rank);
  aboutView=findViewById(R.id.about);
  pauseView=findViewById(R.id.pause);
  stopView=findViewById(R.id.stop);
  gameView=findViewById(R.id.game);
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    soundPool=new SoundPool.Builder().setMaxStreams(2).setAudioAttributes(new AudioAttributes.Builder().setContentType(AudioAttributes.CONTENT_TYPE_MUSIC).build()).build();
  }
 else   soundPool=new SoundPool(2,AudioManager.STREAM_MUSIC,0);
  explosionId=soundPool.load(this,R.raw.explosion,1);
  explosion2Id=soundPool.load(this,R.raw.explosion_two,1);
  buttonId=soundPool.load(this,R.raw.button,1);
  hissId=soundPool.load(this,R.raw.hiss,1);
  coinId=soundPool.load(this,R.raw.coin,1);
  replenishId=soundPool.load(this,R.raw.replenish,1);
  upgradeId=soundPool.load(this,R.raw.upgrade,1);
  errorId=soundPool.load(this,R.raw.error,1);
  WeaponData.loadSounds(this,soundPool);
  Typeface typeface=FontUtils.getTypeface(this);
  int colorPrimary=ContextCompat.getColor(this,R.color.colorPrimary);
  int colorAccent=ContextCompat.getColor(this,R.color.colorAccent);
  titleView.setTypeface(typeface);
  titleView.setPaintFlags(titleView.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
  titleView.getPaint().setShader(new LinearGradient(0,0,0,titleView.getLineHeight(),colorAccent,colorPrimary,Shader.TileMode.REPEAT));
  highScoreView.setTypeface(typeface);
  highScoreView.getPaint().setShader(new LinearGradient(0,0,0,hintView.getLineHeight(),colorAccent,colorPrimary,Shader.TileMode.REPEAT));
  hintView.setTypeface(typeface);
  hintView.getPaint().setShader(new LinearGradient(0,0,0,hintView.getLineHeight(),colorAccent,colorPrimary,Shader.TileMode.REPEAT));
  appName=getString(R.string.app_name);
  hintStart=getString(R.string.hint_start);
  isMusic=prefs.getBoolean(PreferenceUtils.PREF_MUSIC,true);
  musicEnabled=ImageUtils.gradientBitmap(ImageUtils.getVectorBitmap(this,R.drawable.ic_music_enabled),colorAccent,colorPrimary);
  musicDisabled=ImageUtils.gradientBitmap(ImageUtils.getVectorBitmap(this,R.drawable.ic_music_disabled),colorAccent,colorPrimary);
  musicView.setImageBitmap(isMusic ? musicEnabled : musicDisabled);
  musicView.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      isMusic=!isMusic;
      prefs.edit().putBoolean(PreferenceUtils.PREF_MUSIC,isMusic).apply();
      musicView.setImageBitmap(isMusic ? musicEnabled : musicDisabled);
      if (isMusic)       player.start();
 else       player.pause();
      if (isSound)       soundPool.play(buttonId,1,1,0,0,1);
    }
  }
);
  isSound=prefs.getBoolean(PreferenceUtils.PREF_SOUND,true);
  soundEnabled=ImageUtils.gradientBitmap(ImageUtils.getVectorBitmap(this,R.drawable.ic_sound_enabled),colorAccent,colorPrimary);
  soundDisabled=ImageUtils.gradientBitmap(ImageUtils.getVectorBitmap(this,R.drawable.ic_sound_disabled),colorAccent,colorPrimary);
  soundView.setImageBitmap(isSound ? soundEnabled : soundDisabled);
  soundView.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      isSound=!isSound;
      prefs.edit().putBoolean(PreferenceUtils.PREF_SOUND,isSound).apply();
      soundView.setImageBitmap(isSound ? soundEnabled : soundDisabled);
      if (isSound)       soundPool.play(buttonId,1,1,0,0,1);
    }
  }
);
  achievementsView.setImageBitmap(ImageUtils.gradientBitmap(ImageUtils.getVectorBitmap(this,R.drawable.ic_achievements),colorAccent,colorPrimary));
  achievementsView.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      if (isSound)       soundPool.play(buttonId,1,1,0,0,1);
    }
  }
);
  rankView.setImageBitmap(ImageUtils.gradientBitmap(ImageUtils.getVectorBitmap(this,R.drawable.ic_rank),colorAccent,colorPrimary));
  rankView.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      if (isSound)       soundPool.play(buttonId,1,1,0,0,1);
    }
  }
);
  aboutView.setImageBitmap(ImageUtils.gradientBitmap(ImageUtils.getVectorBitmap(this,R.drawable.ic_info),colorAccent,colorPrimary));
  aboutView.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      if (!gameView.isPlaying() && (animator == null || !animator.isStarted())) {
        gameView.setOnClickListener(null);
        gameView.playTutorial();
        animateTitle(false);
        if (isSound)         soundPool.play(hissId,1,1,0,0,1);
      }
    }
  }
);
  play=ImageUtils.gradientBitmap(ImageUtils.getVectorBitmap(this,R.drawable.ic_play),colorAccent,colorPrimary);
  pause=ImageUtils.gradientBitmap(ImageUtils.getVectorBitmap(this,R.drawable.ic_pause),colorAccent,colorPrimary);
  stop=ImageUtils.gradientBitmap(ImageUtils.getVectorBitmap(this,R.drawable.ic_stop),colorAccent,colorPrimary);
  pauseView.setImageBitmap(pause);
  pauseView.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      isPaused=!isPaused;
      if (isPaused) {
        pauseView.setImageBitmap(play);
        stopView.setVisibility(View.VISIBLE);
        gameView.onPause();
      }
 else {
        pauseView.setImageBitmap(pause);
        pauseView.setAlpha(1f);
        stopView.setVisibility(View.GONE);
        gameView.onResume();
      }
    }
  }
);
  stopView.setImageBitmap(stop);
  stopView.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      if (isPaused) {
        pauseView.setImageBitmap(pause);
        pauseView.setAlpha(1f);
        gameView.onResume();
        isPaused=false;
      }
      gameView.stop();
      onStop(0);
    }
  }
);
  int highScore=prefs.getInt(PreferenceUtils.PREF_HIGH_SCORE,0);
  if (highScore > 0)   highScoreView.setText(String.format(getString(R.string.score_high),highScore));
  player=MediaPlayer.create(this,R.raw.music);
  player.setLooping(true);
  if (isMusic)   player.start();
  handler.postDelayed(hintRunnable,1000);
  gameView.setListener(this);
  if (prefs.getBoolean(PreferenceUtils.PREF_TUTORIAL,true)) {
    prefs.edit().putBoolean(PreferenceUtils.PREF_TUTORIAL,false).apply();
    gameView.playTutorial();
  }
 else {
    gameView.setOnClickListener(this);
    animateTitle(true);
  }
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  prefs=PreferenceManager.getDefaultSharedPreferences(this);
  titleView=findViewById(R.id.title);
  highScoreView=findViewById(R.id.highScore);
  hintView=findViewById(R.id.hint);
  buttonLayout=findViewById(R.id.buttonLayout);
  musicView=findViewById(R.id.music);
  soundView=findViewById(R.id.sound);
  achievementsView=findViewById(R.id.achievements);
  rankView=findViewById(R.id.rank);
  aboutView=findViewById(R.id.about);
  pauseView=findViewById(R.id.pause);
  stopView=findViewById(R.id.stop);
  gameView=findViewById(R.id.game);
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    soundPool=new SoundPool.Builder().setMaxStreams(2).setAudioAttributes(new AudioAttributes.Builder().setContentType(AudioAttributes.CONTENT_TYPE_MUSIC).build()).build();
  }
 else   soundPool=new SoundPool(2,AudioManager.STREAM_MUSIC,0);
  explosionId=soundPool.load(this,R.raw.explosion,1);
  explosion2Id=soundPool.load(this,R.raw.explosion_two,1);
  buttonId=soundPool.load(this,R.raw.button,1);
  hissId=soundPool.load(this,R.raw.hiss,1);
  coinId=soundPool.load(this,R.raw.coin,1);
  replenishId=soundPool.load(this,R.raw.replenish,1);
  upgradeId=soundPool.load(this,R.raw.upgrade,1);
  errorId=soundPool.load(this,R.raw.error,1);
  WeaponData.loadSounds(this,soundPool);
  Typeface typeface=FontUtils.getTypeface(this);
  int colorPrimary=ContextCompat.getColor(this,R.color.colorPrimary);
  int colorAccent=ContextCompat.getColor(this,R.color.colorAccent);
  titleView.setTypeface(typeface);
  titleView.setPaintFlags(titleView.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
  titleView.getPaint().setShader(new LinearGradient(0,0,0,titleView.getLineHeight(),colorAccent,colorPrimary,Shader.TileMode.REPEAT));
  highScoreView.setTypeface(typeface);
  highScoreView.getPaint().setShader(new LinearGradient(0,0,0,hintView.getLineHeight(),colorAccent,colorPrimary,Shader.TileMode.REPEAT));
  hintView.setTypeface(typeface);
  hintView.getPaint().setShader(new LinearGradient(0,0,0,hintView.getLineHeight(),colorAccent,colorPrimary,Shader.TileMode.REPEAT));
  appName=getString(R.string.app_name);
  hintStart=getString(R.string.hint_start);
  isMusic=prefs.getBoolean(PreferenceUtils.PREF_MUSIC,true);
  musicEnabled=ImageUtils.gradientBitmap(ImageUtils.getVectorBitmap(this,R.drawable.ic_music_enabled),colorAccent,colorPrimary);
  musicDisabled=ImageUtils.gradientBitmap(ImageUtils.getVectorBitmap(this,R.drawable.ic_music_disabled),colorAccent,colorPrimary);
  musicView.setImageBitmap(isMusic ? musicEnabled : musicDisabled);
  musicView.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      isMusic=!isMusic;
      prefs.edit().putBoolean(PreferenceUtils.PREF_MUSIC,isMusic).apply();
      musicView.setImageBitmap(isMusic ? musicEnabled : musicDisabled);
      if (isMusic)       player.start();
 else       player.pause();
      if (isSound)       soundPool.play(buttonId,1,1,0,0,1);
    }
  }
);
  isSound=prefs.getBoolean(PreferenceUtils.PREF_SOUND,true);
  soundEnabled=ImageUtils.gradientBitmap(ImageUtils.getVectorBitmap(this,R.drawable.ic_sound_enabled),colorAccent,colorPrimary);
  soundDisabled=ImageUtils.gradientBitmap(ImageUtils.getVectorBitmap(this,R.drawable.ic_sound_disabled),colorAccent,colorPrimary);
  soundView.setImageBitmap(isSound ? soundEnabled : soundDisabled);
  soundView.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      isSound=!isSound;
      prefs.edit().putBoolean(PreferenceUtils.PREF_SOUND,isSound).apply();
      soundView.setImageBitmap(isSound ? soundEnabled : soundDisabled);
      if (isSound)       soundPool.play(buttonId,1,1,0,0,1);
    }
  }
);
  achievementsView.setImageBitmap(ImageUtils.gradientBitmap(ImageUtils.getVectorBitmap(this,R.drawable.ic_achievements),colorAccent,colorPrimary));
  achievementsView.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      if (isSound)       soundPool.play(buttonId,1,1,0,0,1);
    }
  }
);
  rankView.setImageBitmap(ImageUtils.gradientBitmap(ImageUtils.getVectorBitmap(this,R.drawable.ic_rank),colorAccent,colorPrimary));
  rankView.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      if (isSound)       soundPool.play(buttonId,1,1,0,0,1);
    }
  }
);
  aboutView.setImageBitmap(ImageUtils.gradientBitmap(ImageUtils.getVectorBitmap(this,R.drawable.ic_info),colorAccent,colorPrimary));
  aboutView.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      if (!gameView.isPlaying() && (animator == null || !animator.isStarted())) {
        gameView.setOnClickListener(null);
        gameView.playTutorial();
        animateTitle(false);
        if (isSound)         soundPool.play(hissId,1,1,0,0,1);
      }
    }
  }
);
  play=ImageUtils.gradientBitmap(ImageUtils.getVectorBitmap(this,R.drawable.ic_play),colorAccent,colorPrimary);
  pause=ImageUtils.gradientBitmap(ImageUtils.getVectorBitmap(this,R.drawable.ic_pause),colorAccent,colorPrimary);
  stop=ImageUtils.gradientBitmap(ImageUtils.getVectorBitmap(this,R.drawable.ic_stop),colorAccent,colorPrimary);
  pauseView.setImageBitmap(pause);
  pauseView.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      isPaused=!isPaused;
      if (isPaused) {
        pauseView.setImageBitmap(play);
        stopView.setVisibility(View.VISIBLE);
        gameView.onPause();
      }
 else {
        pauseView.setImageBitmap(pause);
        pauseView.setAlpha(1f);
        stopView.setVisibility(View.GONE);
        gameView.onResume();
      }
    }
  }
);
  stopView.setImageBitmap(stop);
  stopView.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      if (isPaused) {
        pauseView.setImageBitmap(pause);
        pauseView.setAlpha(1f);
        gameView.onResume();
        isPaused=false;
      }
      onStop(gameView.score);
      gameView.stop();
    }
  }
);
  int highScore=prefs.getInt(PreferenceUtils.PREF_HIGH_SCORE,0);
  if (highScore > 0)   highScoreView.setText(String.format(getString(R.string.score_high),highScore));
  player=MediaPlayer.create(this,R.raw.music);
  player.setLooping(true);
  if (isMusic)   player.start();
  handler.postDelayed(hintRunnable,1000);
  gameView.setListener(this);
  if (prefs.getBoolean(PreferenceUtils.PREF_TUTORIAL,true)) {
    prefs.edit().putBoolean(PreferenceUtils.PREF_TUTORIAL,false).apply();
    gameView.playTutorial();
  }
 else {
    gameView.setOnClickListener(this);
    animateTitle(true);
  }
}