title: Unable to run app in emulator with API 29 android studio
body: <p>I have an app run normally in the emulator with API 28. But when I run the app in the emulator with API 29 it shows</p>
  
  <p><a href="https://i.stack.imgur.com/AeWp0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AeWp0.png" alt="enter image description here"></a></p>
  
  <p>It does not only show keeps stopping in the emulator. I tried to install it on mobile and it also shows the same error. </p>
  
  <p>The log shows this error like this:</p>
  
  <pre><code>2020-02-14 19:48:12.922 20370-20370/? E/stickerappmake: Unknown bits set in runtime_flags: 0x8000
  2020-02-14 19:48:15.326 20370-20454/com.testdev.appname E/eglCodecCommon: glUtilsParamSize: unknow param 0x000088ef
  2020-02-14 19:48:15.326 20370-20454/com.testdev.appname E/eglCodecCommon: glUtilsParamSize: unknow param 0x000088ef
  2020-02-14 19:48:15.385 20370-20454/com.testdev.appname E/eglCodecCommon: glUtilsParamSize: unknow param 0x000088ef
  2020-02-14 19:48:15.385 20370-20454/com.testdev.appname E/eglCodecCommon: glUtilsParamSize: unknow param 0x000088ef
  2020-02-14 19:48:17.138 20370-20454/com.testdev.appname E/eglCodecCommon: glUtilsParamSize: unknow param 0x000088ef
  2020-02-14 19:48:17.139 20370-20454/com.testdev.appname E/eglCodecCommon: glUtilsParamSize: unknow param 0x000088ef
  2020-02-14 19:48:17.243 20370-20454/com.testdev.appname E/eglCodecCommon: glUtilsParamSize: unknow param 0x000088ef
  2020-02-14 19:48:17.243 20370-20454/com.testdev.appname E/eglCodecCommon: glUtilsParamSize: unknow param 0x000088ef
  2020-02-14 19:48:19.984 20370-20464/com.testdev.appname E/eglCodecCommon: glUtilsParamSize: unknow param 0x000088ef
  2020-02-14 19:48:19.984 20370-20464/com.testdev.appname E/eglCodecCommon: glUtilsParamSize: unknow param 0x000088ef
  2020-02-14 19:48:20.048 20370-20454/com.testdev.appname E/eglCodecCommon: glUtilsParamSize: unknow param 0x000088ef
  2020-02-14 19:48:20.048 20370-20454/com.testdev.appname E/eglCodecCommon: glUtilsParamSize: unknow param 0x000088ef
  2020-02-14 19:48:20.059 20370-20454/com.testdev.appname E/eglCodecCommon: glUtilsParamSize: unknow param 0x000088ef
  2020-02-14 19:48:20.063 20370-20454/com.testdev.appname E/eglCodecCommon: glUtilsParamSize: unknow param 0x000088ef
  2020-02-14 19:48:22.727 20370-20370/com.testdev.appname E/AndroidRuntime: FATAL EXCEPTION: main
      Process: com.testdev.appname, PID: 20370
      java.lang.NullPointerException: Attempt to get length of null array
          at com.testdev.appname.activities.CreateFragment.loadStickersCreated(CreateFragment.java:52)
          at com.testdev.appname.activities.CreateFragment.onCreateView(CreateFragment.java:88)
          at android.support.v4.app.Fragment.performCreateView(Fragment.java:2439)
          at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1460)
          at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1784)
          at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:797)
          at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2625)
          at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2411)
          at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2366)
          at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2273)
          at android.support.v4.app.FragmentManagerImpl.dispatchStateChange(FragmentManager.java:3273)
          at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:3229)
          at android.support.v4.app.FragmentController.dispatchActivityCreated(FragmentController.java:201)
          at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:620)
          at android.support.v7.app.AppCompatActivity.onStart(AppCompatActivity.java:178)
          at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1425)
          at android.app.Activity.performStart(Activity.java:7825)
          at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3294)
          at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:221)
          at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201)
          at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173)
          at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
          at android.os.Handler.dispatchMessage(Handler.java:107)
          at android.os.Looper.loop(Looper.java:214)
          at android.app.ActivityThread.main(ActivityThread.java:7356)
          at java.lang.reflect.Method.invoke(Native Method)
          at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
  </code></pre>
  
  <p>I see there some problems with the java code in CreateFragment.java. And the java code is like below:
  The CreateFragment.java code:</p>
  
  <p>package com.devname.appname.activities;</p>
  
  <pre><code>import android.app.Activity;
  import android.app.AlertDialog;
  import android.support.v4.app.Fragment;
  import android.content.ContentValues;
  import android.content.Context;
  import android.content.Intent;
  import android.graphics.Bitmap;
  import android.graphics.Color;
  import android.net.Uri;
  import android.os.Bundle;
  import android.provider.MediaStore;
  import android.support.annotation.NonNull;
  import android.support.v7.widget.GridLayoutManager;
  import android.support.v7.widget.PopupMenu;
  import android.support.v7.widget.RecyclerView;
  import android.util.Log;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.Toast;
  
  import com.facebook.drawee.view.SimpleDraweeView;
  import com.devname.appname.helpers.Admob;
  import com.sangcomz.fishbun.FishBun;
  import com.sangcomz.fishbun.adapter.image.impl.GlideAdapter;
  import com.sangcomz.fishbun.define.Define;
  import com.devname.appname.R;
  import com.devname.appname.backgroundRemover.CutOut;
  import com.devname.appname.helpers.Constants;
  import com.devname.appname.utils.FileUtils;
  import com.devname.appname.utils.StickerPacksManager;
  
  import java.io.File;
  import java.util.ArrayList;
  
  public class CreateFragment extends Fragment {
      ImagesGridAdapter imagesGridAdapter;
      View view;
  
      public CreateFragment() {
          // Required empty public constructor
      }
  
      public static ArrayList&lt;Uri&gt; loadStickersCreated() {
          String directoryPath = Constants.STICKERS_CREATED_DIRECTORY_PATH;
          File directory = new File(directoryPath);
          ArrayList&lt;Uri&gt; images = new ArrayList&lt;&gt;();
          if (directory.exists()) {
              File[] stickersImages = directory.listFiles();
              for (File f : stickersImages) {
                  if (f.isFile() &amp;&amp; (f.getName().contains(".png") || f.getName().contains(".PNG"))) {
                      images.add(Uri.fromFile((f)));
                  }
              }
          } else {
              directory.mkdir();
          }
         // verifyStickersCount();
          return images;
      }
  
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
      }
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState) {
          // Inflate the layout for this fragment
          view = inflater.inflate(R.layout.fragment_create, container, false);
          Admob.createLoadBanner(getContext(), view);
          view.findViewById(R.id.create_sticker).setOnClickListener(v -&gt; FishBun.with(getActivity())
                  .setImageAdapter(new GlideAdapter())
                  .setMaxCount(1)
                  .exceptGif(true)
                  .setMinCount(1)
                  .setActionBarColor(getResources().getColor(R.color.colorPrimaryDark), getResources().getColor(R.color.colorPrimary), false)
                  .setActionBarTitleColor(Color.parseColor("#ffffff"))
                  .startAlbum());
  
          RecyclerView gridview = view.findViewById(R.id.stickers_created_grid);
          GridLayoutManager gridLayoutManager = new GridLayoutManager(view.getContext(), 3);
          gridview.setLayoutManager(gridLayoutManager);
          imagesGridAdapter = new ImagesGridAdapter(view.getContext(), loadStickersCreated());
          gridview.setAdapter(imagesGridAdapter);
          verifyStickersCount();
          return view;
      }
  
      public void verifyStickersCount() {
          View linearLayout = view.findViewById(R.id.no_stickers_icon);
          if (imagesGridAdapter == null || imagesGridAdapter.getItemCount() == 0) {
              linearLayout.setVisibility(View.VISIBLE);
          } else {
              linearLayout.setVisibility(View.GONE);
          }
      }
  
      public static void addImageToGallery(final String filePath, final Context context) {
  
          ContentValues values = new ContentValues();
  
          values.put(MediaStore.Images.Media.DATE_TAKEN, System.currentTimeMillis());
          values.put(MediaStore.Images.Media.MIME_TYPE, "image/jpeg");
          values.put(MediaStore.MediaColumns.DATA, filePath);
  
          context.getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
      }
  
  
      @Override
      public void onActivityResult(int requestCode, int resultCode, Intent data) {
          Log.d("TESTTTTTT",requestCode+"");
          if (requestCode == CutOut.CUTOUT_ACTIVITY_REQUEST_CODE) {
              Log.d("TESTTTTTT :::::",requestCode+"");
              switch (resultCode) {
                  case Activity.RESULT_OK:
                      String imagePath_intent = data.getStringExtra("imagePath");
                      Uri imageUri = Uri.fromFile(new File(imagePath_intent));
  
                      Log.d("TESTTTTTT ::::: He",imageUri+"");
                      String stickerName = FileUtils.generateRandomIdentifier();
                      Uri imagePath = Uri.parse(Constants.STICKERS_CREATED_DIRECTORY_PATH + stickerName + ".PNG");
                      StickerPacksManager.createStickerImageFile(imageUri, imagePath, getActivity(), Bitmap.CompressFormat.PNG);
                      addImageToGallery(imagePath.getPath(), getActivity());
                      imagesGridAdapter.uries = loadStickersCreated();
                      imagesGridAdapter.notifyDataSetChanged();
                      Toast.makeText(getActivity(), "Sticker created", Toast.LENGTH_LONG).show();
                      verifyStickersCount();
                      break;
                  case CutOut.CUTOUT_ACTIVITY_RESULT_ERROR_CODE:
                      Exception ex = CutOut.getError(data);
                      Log.d("TESTTTTTT :::::",ex+"::DDD");
                      break;
                  default:
                      System.out.print("User cancelled the CutOut screen");
              }
          } else if (requestCode == Define.ALBUM_REQUEST_CODE) {
              ArrayList&lt;Uri&gt; uries;
              if (resultCode == Activity.RESULT_OK) {
                  uries = data.getParcelableArrayListExtra(Define.INTENT_PATH);
                  CutOut.activity().src(uries.get(0)).intro().start(getActivity());
              }
          }
      }
  
      public class ImagesGridAdapter extends RecyclerView.Adapter&lt;ImageViewHolder&gt; {
          public ArrayList&lt;Uri&gt; uries = new ArrayList&lt;&gt;();
          Context context;
  
          public ImagesGridAdapter(Context context, ArrayList&lt;Uri&gt; uries) {
              this.uries = uries;
              this.context = context;
          }
  
          @NonNull
          @Override
          public ImageViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
              final Context context = viewGroup.getContext();
              final LayoutInflater layoutInflater = LayoutInflater.from(context);
              final View view = layoutInflater.inflate(R.layout.sticker_created_item, viewGroup, false);
              return new ImageViewHolder(view);
          }
  
          @Override
          public void onBindViewHolder(@NonNull ImageViewHolder imageAdapter, int index) {
              imageAdapter.imageView.setImageURI(uries.get(index));
              imageAdapter.imageView.setPadding(8, 8, 8, 8);
              imageAdapter.imageView.setOnLongClickListener(v -&gt; {
                  PopupMenu popupMenu = new PopupMenu(context, imageAdapter.imageView);
                  popupMenu.inflate(R.menu.sticker_menu);
                  popupMenu.setOnMenuItemClickListener(item -&gt; {
                      switch (item.getItemId()) {
                       /*  case R.id.add_to_exist_stickerpack:
                              addToStickerPack(index);
                              break;*/
                          case R.id.delete_sticker:
                              this.deleteSticker(index);
                              break;
                          default:
                              break;
                      }
                      return false;
                  });
                  popupMenu.show();
                  return false;
              });
          }
  
          void deleteSticker(int index) {
              new AlertDialog.Builder(context)
                      .setTitle("Deleting")
                      .setMessage("Are you sure you want to delete this sticker?")
                      .setPositiveButton("Yes", (dialog, which) -&gt; {
                          Uri uri = uries.get(index);
                          FileUtils.deleteFile(uri.getPath(),context);
                          uries.remove(index);
                          notifyItemRemoved(index);
                          notifyDataSetChanged();
                          Toast.makeText(context, "Deleted", Toast.LENGTH_SHORT).show();
                          verifyStickersCount();
                      })
                      .setNegativeButton("No", null)
                      .show();
          }
  
           void addToStickerPack(int index) {
              Intent intent = new Intent(context, AddToStickerPackActivity.class);
              intent.setData(uries.get(index));
              startActivity(intent);
          }
  
          @Override
          public int getItemCount() {
              return uries.size();
          }
      }
  
      class ImageViewHolder extends RecyclerView.ViewHolder {
          SimpleDraweeView imageView;
  
          public ImageViewHolder(@NonNull View itemView) {
              super(itemView);
              this.imageView = itemView.findViewById(R.id.sticker_created_image);
          }
  
      }
  }
  </code></pre>