java.lang.IllegalStateException:AssetManager已完成

前端之家收集整理的这篇文章主要介绍了java.lang.IllegalStateException:AssetManager已完成前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我昨天在我的应用程序工作时去睡觉,今天当我试图运行它时根本无法启动.一旦我尝试打开它崩溃与 java.lang.IllegalStateException.我已经在我的代码中提交了几个提交,只是为了排除这是我最近做过的事情.这没有任何意义,应用程序如何才能停止工作过夜?我在互联网上寻找错误,并没有很多有用的信息.这真的是一个奇怪的错误吗?

这是完整的堆栈跟踪:

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)

因为我说它似乎不是我做的任何事情我不知道要发布什么代码.但是考虑到应用程序在此处崩溃,这是应该首先启动的两个主要类的代码

应用

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;
    }
}

解决方法

您的stacktrace链接AOSP中的 to this class.

我认为此崩溃与您的应用程序无关,但是作为Launcher类中的错误.尝试从USB调试安装,看看是否有效.

但仍有一些细节模糊不清.这些行(从stacktrace的底部到顶部)是导致com.android.launcher2包中出现问题的行:

https://android.googlesource.com/platform/packages/apps/Launcher2/+/android-4.2.2_r1/src/com/android/launcher2/AppsCustomizePagedView.java#584

https://android.googlesource.com/platform/packages/apps/Launcher2/+/master/src/com/android/launcher2/Launcher.java#2469

https://android.googlesource.com/platform/packages/apps/Launcher2/+/master/src/com/android/launcher2/Launcher.java#2442

从这个错误,我假设您正在使用Nexus或Pixel(或任何具有未更改的源代码的设备,意思是股票android.).

从我从这个错误中可以看出,这不是与您的应用程序相关的错误.它似乎与您正在使用的启动器有关.尝试从USB调试安装,或更改启动器,看看是否有效.尝试重启设备.

此外,根据我对您的代码的看法,没有可用的parcelable类

原文链接:https://www.f2er.com/java/129573.html

猜你在找的Java相关文章