Ошибка ответа залпа: java .lang.IllegalArgumentException - PullRequest
0 голосов
/ 02 мая 2020

Я создаю приложение в формате PDF, использующее залп, но на некоторых устройствах использую sh. Когда я тестирую, работаю нормально. Но я получил чуть ниже cra sh отчетов о Play Console cra sh отчетов. Я не могу понять эту ошибку. Пожалуйста, помогите мне кто-нибудь сказать, почему я получил эту ошибку и как это исправить.

Консоль Play cra sh отчеты

java.lang.IllegalArgumentException: 
  at android.view.WindowManagerGlobal.findViewLocked (WindowManagerGlobal.java:485)
  at android.view.WindowManagerGlobal.removeView (WindowManagerGlobal.java:394)
  at android.view.WindowManagerImpl.removeViewImmediate (WindowManagerImpl.java:124)
  at android.app.Dialog.dismissDialog (Dialog.java:371)
  at android.app.Dialog.dismiss (Dialog.java:354)
  at com.spcurrent.pdfsuccess.S1Activity$5.onResponse (S1Activity.java:7)
  at com.spcurrent.pdfsuccess.S1Activity$5.onResponse (S1Activity.java:7)
  at com.android.volley.toolbox.StringRequest.deliverResponse (StringRequest.java:8)
  at com.android.volley.Response.success (Response.java:2)
  at com.android.volley.toolbox.StringRequest.parseNetworkResponse (StringRequest.java:2)
  at com.android.volley.ExecutorDelivery$ResponseDeliveryRunnable.run (ExecutorDelivery.java:2)
  at android.os.Handler.handleCallback (Handler.java:790)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at android.os.Looper.loop (Looper.java:164)
  at android.app.ActivityThread.main (ActivityThread.java:6647)
  at java.lang.reflect.Method.invoke (Method.java)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:438)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:811)

S1Activity. java Код

public class S1Activity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener {

    private RecyclerView recyclerView;
    private DD4YouConfig dd4YouConfig;
    private ProgressDialog progressDialog;
    private MyConfig myConfig;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_s1);

        Toolbar toolbar = findViewById(R.id.toolbar);
        toolbar.setTitle("Home");
        setSupportActionBar(toolbar);
        dd4YouConfig = new DD4YouConfig(this);
        myConfig = new MyConfig(this);
        DrawerLayout drawer = findViewById(R.id.drawer_layout);
        NavigationView navigationView = findViewById(R.id.nav_view);
        ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
                this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
        drawer.addDrawerListener(toggle);
        toggle.syncState();
        navigationView.setNavigationItemSelectedListener(this);
       // frameLayout = findViewById(R.id.fl_adplaceholder);

        recyclerView = findViewById(R.id.recycler_view);
        RecyclerView.LayoutManager layoutManager = new GridLayoutManager(this, 2);
        recyclerView.setLayoutManager(layoutManager);
        recyclerView.setHasFixedSize(true);
        v3();
        progressDialog = new ProgressDialog(this);
        progressDialog.setMessage("Please wait");
        progressDialog.setCanceledOnTouchOutside(false);
        progressDialog.setCancelable(false);
        progressDialog.show();
        v1();
        v2();
    }


    @Override
    public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
        // Handle navigation view item clicks here.
        int id = menuItem.getItemId();

        if (id == R.id.nav_more) {
            dd4YouConfig.moreApps(YOUR_PLAY_CONSOLE_ID);
        } else if (id == R.id.nav_contact_us) {
            dd4YouConfig.contactByEmail(YOUR_EMAIL_ID,"","");
        } else if (id == R.id.nav_follow_us) {
            dd4YouConfig.followOnInstagram(YOUR_INSTAGRAM_ID);
        } else if (id == R.id.nav_rate_us) {
            dd4YouConfig.rateUs();
        } else if (id == R.id.nav_share) {
            dd4YouConfig.shareApp(SHARE_TEXT +" ");
        } else if (id == R.id.nav_privacy_police) {
            startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(APP_PRIVACY_POLICY_LINK)));
        } else if (id == R.id.nav_dev_info) {
            myConfig.c354787987();
        }

        DrawerLayout drawer = findViewById(R.id.drawer_layout);
        drawer.closeDrawer(GravityCompat.START);
        return true;
    }

    @Override
    public void onBackPressed() {
        v4(); // show exit popup
    }

    private void v4(){
        AlertDialog.Builder mBuilder = new AlertDialog.Builder(this);
        final View view = LayoutInflater.from(this).inflate(R.layout.exit_popup, null);
        ImageButton imgclosebtn = view.findViewById(R.id.close_btn);
        Button btnExit = view.findViewById(R.id.btn_exit);

        final NativeAdLayout nativeAdLayout = view.findViewById(R.id.native_ad_container);
        final NativeAd nativeAd = new NativeAd(this, getString(R.string.native_ad));
      //  nativeAd.loadAd();

        final LinearLayout customAdView = (LinearLayout) LayoutInflater.from(this).inflate(R.layout.native_ad_layout, nativeAdLayout,false);
        nativeAdLayout.addView(customAdView);
        final AdIconView nativeAdIcon = customAdView.findViewById(R.id.native_ad_icon);
        final TextView nativeAdTitle = customAdView.findViewById(R.id.native_ad_title);
        final MediaView nativeAdMedia = customAdView.findViewById(R.id.native_ad_media);
        final TextView nativeAdSocialContext = customAdView.findViewById(R.id.native_ad_social_context);
        final TextView nativeAdBody = customAdView.findViewById(R.id.native_ad_body);
        final TextView sponsoredLabel = customAdView.findViewById(R.id.native_ad_sponsored_label);
        final Button nativeAdCallToAction = customAdView.findViewById(R.id.native_ad_call_to_action);
        final LinearLayout adChoicesContainer = customAdView.findViewById(R.id.ad_choices_container);

        mBuilder.setView(view);
        final AlertDialog dialog = mBuilder.create();

        imgclosebtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dialog.dismiss();
            }
        });
        btnExit.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finishAffinity();
            }
        });

        nativeAd.setAdListener(new NativeAdListener() {
            @Override
            public void onMediaDownloaded(Ad ad) {
            }
            @Override
            public void onError(Ad ad, AdError adError) {

            }
            @Override
            public void onAdLoaded(Ad ad) {
                if (nativeAd == null || nativeAd != ad) {
                    return;
                }
                nativeAdTitle.setText(nativeAd.getAdvertiserName());
                nativeAdBody.setText(nativeAd.getAdBodyText());
                nativeAdSocialContext.setText(nativeAd.getAdSocialContext());
                nativeAdCallToAction.setVisibility(nativeAd.hasCallToAction() ? View.VISIBLE : View.INVISIBLE);
                nativeAdCallToAction.setText(nativeAd.getAdCallToAction());
                sponsoredLabel.setText(nativeAd.getSponsoredTranslation());
                AdOptionsView adOptionsView = new AdOptionsView(view.getContext(), nativeAd, nativeAdLayout);
                adChoicesContainer.addView(adOptionsView);

                List<View> clickableViews = new ArrayList<>();
                clickableViews.add(nativeAdTitle);
                clickableViews.add(nativeAdCallToAction);

                nativeAd.registerViewForInteraction(customAdView,nativeAdMedia,nativeAdIcon);
            }
            @Override
            public void onAdClicked(Ad ad) {
            }
            @Override
            public void onLoggingImpression(Ad ad) {
            }
        });

        // Request an ad
        nativeAd.loadAd();

        dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
        dialog.setCanceledOnTouchOutside(true);
        dialog.setCancelable(true);
        dialog.show();
    }

    private void v1() {
        StringRequest stringRequest = new StringRequest(Request.Method.POST, API_URL,
                new Response.Listener<String>() {
                    @Override
                    public void onResponse(String response) {
                        try {
                            JSONArray jsonArray = new JSONArray(response);
                            List<RvS1Model> modelList = new ArrayList<>();
                            for (int i = 0; i < jsonArray.length(); i++) {
                                JSONObject setobj = jsonArray.getJSONObject(i);
                                modelList.add(new RvS1Model(setobj.getInt("cid"),
                                        setobj.getString("cname"),
                                        setobj.getString("cdesc")));
                            }
                            RvS1Adapter adapter = new RvS1Adapter(modelList);
                            recyclerView.setAdapter(adapter);
                            adapter.notifyDataSetChanged();
                            progressDialog.dismiss();
                        } catch (JSONException e) {
                            e.printStackTrace();
                            progressDialog.dismiss();
                        }
                    }
                }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
                error.printStackTrace();
                progressDialog.dismiss();
            }
        }) {
            @Override
            protected Map<String, String> getParams() {
                Map<String, String> params = new HashMap<>();
                params.put(KEY_TABLE, TABLE_CATEGORY);
                return params;
            }
        };
        stringRequest.setRetryPolicy(new DefaultRetryPolicy(0, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
        Volley.newRequestQueue(this).add(stringRequest);
    }
    private void v2() {
        dd4YouConfig.createApkFolder(APP_NAME);
    }
    private void v3() {
        myConfig.updateStatistics(dd4YouConfig.getDeviceId(), myConfig.getVersionID(dd4YouConfig.getDeviceVersion()));
    }
}
...