java.lang.IllegalStateException: AssetManager has been finalized

Viewed 2666

I went to sleep yesterday with my app working and today when I tried to run it won't start at all. As soon as I try to open it crashes with a java.lang.IllegalStateException. I've gone several commits back in my code just to rule out it was something I did recently and still. This makes no sense, how can an app just stop working over night? I've looked for the error in the internet and there is not a lot of useful information about it. Is this really an odd error?

Here's the complete stack trace:

E/AndroidRuntime: FATAL EXCEPTION: main java.lang.IllegalStateException: AssetManager has been finalized! at android.os.Parcel.readException(Parcel.java:1439) at android.os.Parcel.readException(Parcel.java:1385) at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:1947) at android.app.Instrumentation.execStartActivity(Instrumentation.java:1419) at android.app.Activity.startActivityForResult(Activity.java:3390) at android.app.Activity.startActivity(Activity.java:3583) at com.android.launcher2.Launcher.startActivity(Launcher.java:2442) at com.android.launcher2.Launcher.startActivitySafely(Launcher.java:2469) at com.android.launcher2.AppsCustomizePagedView.onClick(AppsCustomizePagedView.java:584) at android.view.View.performClick(View.java:4240) at android.view.View$PerformClick.run(View.java:17721) at android.os.Handler.handleCallback(Handler.java:730) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5136) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) at dalvik.system.NativeStart.main(Native Method)

Since like I said it doesn't seem to be anything that I did I'm not sure what code to post. But given that the app crashes on start here's the code for the two main classes that are supposed to start first:

App

public class App extends Application {

  private static App instance;
  private static final String TAG = "Starter";

  @Override
  public void onCreate() {
    super.onCreate();

    instance = this;
    // Enable Local Datastore.
    Parse.enableLocalDatastore(this);

    //TODO: Register subclasses
//    ParseObject.registerSubclass(Challenge.class);

    //Parse server
    Log.d(TAG, "Initializing Parse");
    Parse.initialize(new Parse.Configuration.Builder(this)
            .applicationId(getString(R.string.parse_app_id))
            .clientKey(getString(R.string.parse_client_key))
            .server(getString(R.string.server_address)).build()
    );

    //Facebook
    if (AccessToken.getCurrentAccessToken() == null)
      ParseFacebookUtils.initialize(this);

    ParseUser.enableAutomaticUser();
    ParseACL defaultACL = new ParseACL();
    // Optionally enable public read access.
    defaultACL.setPublicReadAccess(true);
    defaultACL.setPublicWriteAccess(true);
    ParseACL.setDefaultACL(defaultACL, true);
    Log.d(TAG, "Parse ready");
  }

  public static App getInstance(){
    return instance;
  }
}

SplashActivity

public class SplashActivity extends AppCompatActivity {

    private static final String TAG = "Splash";
    private boolean firstTime = true;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // Hide title bar
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_splash);

        firstTime = getSharedPreferences(Constants.GENERAL_SHARED_PREFS, MODE_PRIVATE)
                .getBoolean(Constants.FIRSTTIME, true);


        if (isLoggedIn())
            if (firstTime)
                startActivity(new Intent(SplashActivity.this, FirstTimeActivity.class));
            else
                startActivity(new Intent(SplashActivity.this, MenuActivity.class));

        else {
            Log.d(TAG, "Calling Home");
            startActivity(new Intent(SplashActivity.this, WelcomeActivity.class));
            finish();
        }
    }

    @Override
    protected void onResume() {
        super.onResume();
    }

    @Override
    protected void onPause() {
        super.onPause();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }

    public boolean isLoggedIn() {
        AccessToken accessToken = AccessToken.getCurrentAccessToken();
        String parseSession = ParseUser.getCurrentUser().getSessionToken();
        return parseSession != null;
    }
}
2 Answers
Related