java.lang.IllegalStateException:AssetManager已完成 [英] java.lang.IllegalStateException: AssetManager has been finalized

查看:91
本文介绍了java.lang.IllegalStateException:AssetManager已完成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

昨天,我在使用我的应用程序的情况下进入睡眠状态,而今天,当我尝试运行该应用程序时,它根本无法启动.一旦我尝试打开它,它就会以java.lang.IllegalStateException崩溃.我已经在代码中进行了几次提交,只是为了排除那是我最近仍在做的事情.这没有任何意义,一个应用程序如何才能整夜停止工作?我已经在互联网上寻找该错误,并且没有很多有用的信息.这真的是一个奇怪的错误吗?

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?

这是完整的堆栈跟踪:

E/Android运行时:致命异常:主要 java.lang.IllegalStateException:AssetManager已完成! 在android.os.Parcel.readException(Parcel.java:1439) 在android.os.Parcel.readException(Parcel.java:1385) 在android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:1947) 在android.app.Instrumentation.execStartActivity(Instrumentation.java:1419) 在android.app.Activity.startActivityForResult(Activity.java:3390) 在android.app.Activity.startActivity(Activity.java:3583) 在com.android.launcher2.Launcher.startActivity(Launcher.java:2442) 在com.android.launcher2.Launcher.startActivitySafely(Launcher.java:2469) 在com.android.launcher2.AppsCustomizePagedView.onClick(AppsCustomizePagedView.java:584) 在android.view.View.performClick(View.java:4240) 在android.view.View $ PerformClick.run(View.java:17721) 在android.os.Handler.handleCallback(Handler.java:730) 在android.os.Handler.dispatchMessage(Handler.java:92) 在android.os.Looper.loop(Looper.java:137) 在android.app.ActivityThread.main(ActivityThread.java:5136) 在java.lang.reflect.Method.invokeNative(本机方法) 在java.lang.reflect.Method.invoke(Method.java:525) 在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:737) 在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 在dalvik.system.NativeStart.main(本机方法)

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:

应用

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

推荐答案

您的堆栈跟踪链接我认为这次崩溃与您的应用无关,但这是Launcher类中的错误.尝试通过USB调试进行安装,看看是否可行.

I think this crash has nothing to do with your app, but as an error in the Launcher class. Try installing from USB debugging and see if that works.

但是有些细节仍然模糊.这些行是(从stacktrace的底部到顶部)在com.android.launcher2程序包中引起问题的行:

But there are still some details that are blurry. These lines are (from bottom of the stacktrace to the top) the lines that cause problems in com.android.launcher2 package:

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.)

From this error, I assume you are using a Nexus or Pixel (or any device with the unaltered source code, meaning stock android.).

从我可以从该错误中看出来,这不是与您的应用相关的错误.您使用的启动器似乎有问题.尝试通过USB调试进行安装,或更改启动器,看看是否可行.也尝试重新启动设备.

From what I can tell from this error, this is not an error related to your app. It appears to be an issue with the launcher you are using. Try installing from USB debugging, or change launcher, and see if that works. Try rebooting your device as well.

另外,据我了解,您的代码中没有使用可打包的类

Further, from what I see of your code, there are no parcelable classes in use

这篇关于java.lang.IllegalStateException:AssetManager已完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆