0

After updating my app, crashlytics started reporting this issue. with this logcat

androidx.activity.ComponentActivity.onCreate (ComponentActivity.java:149)
androidx.fragment.app.FragmentActivity.onCreate (FragmentActivity.java:313)
androidx.appcompat.app.AppCompatActivity.onCreate (AppCompatActivity.java:106)
com.viyatek.ultimatefacts.Activites.LockScreenActivity.onCreate (LockScreenActivity.java:87)
android.app.Activity.performCreate (Activity.java:7154)
android.app.Activity.performCreate (Activity.java:7145)
android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1225)

When I look questions with same error code. I saw it causes because of the iteration in lists. In this activity there is no iteration. Even more there is no list or array. So it is not same question with others. The line it says it failed:

 @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState); //(LockScreenActivity.java:87)

    if(new NewVersionControl(this).CheckVersion())
            {
                new NewSharedPrefs(this).LookForNewSharedPrefs();

            handleAlarms = new HandleAlarms(this);
            handleAlarms.SetAlarmManager(); }
        else
        {if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
                this.setShowWhenLocked(true);
            }
            else {            getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
            }

            setContentView(R.layout.opaque_full_screen_lock_screen);

            SharedPrefsHandler sharedPrefsHandler = new SharedPrefsHandler(this);


            //Ads initialized
            MobileAds.initialize(getApplicationContext(), getString(R.string.app_id));

            SdkConfiguration sdkConfiguration =
                    new SdkConfiguration.Builder(getString(R.string.twitter_banner_ad_unit_id)).build();
    MoPub.initializeSdk(this, sdkConfiguration, null);
    Declarations();
    GetRemoteConfig();
    if(handleRealmInit == null) {handleRealmInit = new HandleRealmInit(this);}
    lockScreenRealm = handleRealmInit.GetRealmInstance();
    BindData();
     if(sharedPrefsHandler.GetPref(SharedPrefsHandler.IS_PREMIUM).getIntegerValue()== 0) 
    {
LoadAd();
}
                if(lockScreenFact!= null)   {
                    if(lockScreenFact.isValid())
                    {
                        ReportProperties();
                    }
                }
            }

So I think it occurs due to handling of views or view group by Android. But I couldn't define or reproduce the problem. I am stuck at this point.

Thank you for reading this. Any help is appreciated.

Eren Tüfekçi
  • 2,463
  • 3
  • 16
  • 35

1 Answers1

1

ConcurrentModificationException means you are trying to add/remove elements from an array while iterating over it without an interator.

What is inside your onCreate method ?

Lena Bru
  • 13,521
  • 11
  • 61
  • 126
  • Thank you for response. I added on create. There is no array inside OnCreate or its methods. I started to have crashes after implementing different Ad libraris. Can it cause because of the libraries ? (got after implementing MoPub Mediation part) – Eren Tüfekçi Jan 22 '20 at 21:55
  • 1
    what is on line 87 of the onCreate? – Lena Bru Jan 22 '20 at 21:57
  • super.onCreate(savedInstanceState); //(LockScreenActivity.java:87) – Eren Tüfekçi Jan 22 '20 at 21:57
  • 1
    does this activity inherit from something other than the provided android activity classes ? – Lena Bru Jan 22 '20 at 21:58
  • public class LockScreenActivity extends AppCompatActivity implements View.OnClickListener No it doesnt – Eren Tüfekçi Jan 22 '20 at 22:00
  • 1
    do you have anything to do with lists/arrays in your code ? – Lena Bru Jan 22 '20 at 22:01
  • First thank you for your patience, I really appreciated it. I checked two times, now will look for third. I have no array nor list and I just started to have it recently. – Eren Tüfekçi Jan 22 '20 at 22:03
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/206475/discussion-between-lena-bru-and-eren-tufekci). – Lena Bru Jan 22 '20 at 22:06
  • Have you managed to find the root cause? I'm struggling with this error where in my code I'm not using any arrays / lists. – Renjith Nov 16 '21 at 22:23