这是完整的堆栈跟踪:
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; } }
解决方法
我认为此崩溃与您的应用程序无关,但是作为Launcher类中的错误.尝试从USB调试安装,看看是否有效.
但仍有一些细节模糊不清.这些行(从stacktrace的底部到顶部)是导致com.android.launcher2包中出现问题的行:
从这个错误,我假设您正在使用Nexus或Pixel(或任何具有未更改的源代码的设备,意思是股票android.).
从我从这个错误中可以看出,这不是与您的应用程序相关的错误.它似乎与您正在使用的启动器有关.尝试从USB调试安装,或更改启动器,看看是否有效.尝试重启设备.
此外,根据我对您的代码的看法,没有可用的parcelable类