Android加载错误:执行停止未恢复的活动

时间:2016-04-19 02:17:11

标签: java android android-activity firebase

我正在为我的应用程序创建一个加载屏幕,检查Firebase以查看用户是否已登录。根据用户的身份验证状态,我将在应用程序中加载特定活动。

我收到的似乎是一个冗余错误,它冻结了我的应用程序而没有访问下一个活动:

  04-18 21:13:52.400 32330-32512/com.sourcey.materialloginexample E/Surface: queueBuffer: error queuing buffer to SurfaceTexture, -2147483646
    04-18 21:13:52.475 32330-32512/com.sourcey.materialloginexample     E/Parcel: dup() failed in Parcel::read, i is 0, fds[i] is -1, fd_count is 2, error: Bad file descriptor
    04-18 21:13:52.475 32330-32512/com.sourcey.materialloginexample E/Surface: dequeueBuffer: IGraphicBufferProducer::requestBuffer failed: -22
    04-18 21:13:52.840 32330-32512/com.sourcey.materialloginexample E/Surface: queueBuffer: error queuing buffer to SurfaceTexture, -22
    04-18 21:13:53.147 32330-32512/com.sourcey.materialloginexample E/Surface: queueBuffer: error queuing buffer to SurfaceTexture, -22
04-18 21:13:53.240 32330-32512/com.sourcey.materialloginexample E/Parcel: dup() failed in Parcel::read, i is 0, fds[i] is -1, fd_count is 2, error: Bad file descriptor
04-18 21:13:53.240 32330-32512/com.sourcey.materialloginexample E/Surface: dequeueBuffer: IGraphicBufferProducer::requestBuffer failed: -22
04-18 21:13:53.653 32330-32512/com.sourcey.materialloginexample E/Surface: queueBuffer: error queuing buffer to SurfaceTexture, -22
04-18 21:13:53.972 32330-32330/com.sourcey.materialloginexample E/ActivityThread: Performing stop of activity that is not resumed: {com.sourcey.materialloginexample/com.troychuinard.fanpolls.PreferencesActivity}
                                                                                  java.lang.RuntimeException: Performing stop of activity that is not resumed: {com.sourcey.materialloginexample/com.troychuinard.fanpolls.PreferencesActivity}
                                                                                      at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:3496)
                                                                                      at android.app.ActivityThread.handleStopActivity(ActivityThread.java:3593)
                                                                                      at android.app.ActivityThread.access$1200(ActivityThread.java:157)
                                                                                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1385)
                                                                                      at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                      at android.os.Looper.loop(Looper.java:148)
                                                                                      at android.app.ActivityThread.main(ActivityThread.java:5527)
                                                                                      at java.lang.reflect.Method.invoke(Native Method)
                                                                                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730)
                                                                                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
04-18 21:13:54.086 32330-32512/com.sourcey.materialloginexample E/Surface: queueBuffer: error queuing buffer to SurfaceTexture, -22
04-18 21:13:54.173 32330-32512/com.sourcey.materialloginexample E/Parcel: dup() failed in Parcel::read, i is 0, fds[i] is -1, fd_count is 2, error: Bad file descriptor
04-18 21:13:54.173 32330-32512/com.sourcey.materialloginexample E/Surface: dequeueBuffer: IGraphicBufferProducer::requestBuffer failed: -22
04-18 21:13:54.783 32330-32512/com.sourcey.materialloginexample E/Surface: queueBuffer: error queuing buffer to SurfaceTexture, -22
04-18 21:13:55.063 32330-32512/com.sourcey.materialloginexample E/Surface: queueBuffer: error queuing buffer to SurfaceTexture, -22
04-18 21:13:55.144 32330-32512/com.sourcey.materialloginexample E/Parcel: dup() failed in Parcel::read, i is 0, fds[i] is -1, fd_count is 2, error: Bad file descriptor
04-18 21:13:55.144 32330-32512/com.sourcey.materialloginexample E/Surface: dequeueBuffer: IGraphicBufferProducer::requestBuffer failed: -22
04-18 21:13:55.538 32330-32512/com.sourcey.materialloginexample E/Surface: queueBuffer: error queuing buffer to SurfaceTexture, -22
04-18 21:13:55.820 32330-32512/com.sourcey.materialloginexample E/Surface: queueBuffer: error queuing buffer to SurfaceTexture, -22
04-18 21:13:55.913 32330-32512/com.sourcey.materialloginexample E/Parcel: dup() failed in Parcel::read, i is 0, fds[i] is -1, fd_count is 2, error: Bad file descriptor
04-18 21:13:55.914 32330-32512/com.sourcey.materialloginexample E/Surface: dequeueBuffer: IGraphicBufferProducer::requestBuffer failed: -22
04-18 21:13:56.341 32330-32512/com.sourcey.materialloginexample E/Surface: queueBuffer: error queuing buffer to SurfaceTexture, -22
04-18 21:13:56.710 32330-32512/com.sourcey.materialloginexample E/Surface: queueBuffer: error queuing buffer to SurfaceTexture, -22
04-18 21:13:56.790 32330-32512/com.sourcey.materialloginexample E/Parcel: dup() failed in Parcel::read, i is 0, fds[i] is -1, fd_count is 2, error: Bad file descriptor
04-18 21:13:56.790 32330-32512/com.sourcey.materialloginexample E/Surface: dequeueBuffer: IGraphicBufferProducer::requestBuffer failed: -22
04-18 21:13:57.260 32330-32512/com.sourcey.materialloginexample E/Surface: queueBuffer: error queuing buffer to SurfaceTexture, -22
04-18 21:13:57.527 32330-32512/com.sourcey.materialloginexample E/Surface: queueBuffer: error queuing buffer to SurfaceTexture, -22
04-18 21:13:57.612 32330-32512/com.sourcey.materialloginexample E/Parcel: dup() failed in Parcel::read, i is 0, fds[i] is -1, fd_count is 2, error: Bad file descriptor
04-18 21:13:57.612 32330-32512/com.sourcey.materialloginexample E/Surface: dequeueBuffer: IGraphicBufferProducer::requestBuffer failed: -22
04-18 21:13:58.099 32330-32512/com.sourcey.materialloginexample E/Surface: queueBuffer: error queuing buffer to SurfaceTexture, -22
04-18 21:13:58.456 32330-32512/com.sourcey.materialloginexample E/Surface: queueBuffer: error queuing buffer to SurfaceTexture, -22
04-18 21:13:58.637 32330-32512/com.sourcey.materialloginexample E/Parcel: dup() failed in Parcel::read, i is 0, fds[i] is -1, fd_count is 2, error: Bad file descriptor
04-18 21:13:58.637 32330-32512/com.sourcey.materialloginexample E/Surface: dequeueBuffer: IGraphicBufferProducer::requestBuffer failed: -22
04-18 21:13:59.263 32330-32512/com.sourcey.materialloginexample E/Surface: queueBuffer: error queuing buffer to SurfaceTexture, -22
04-18 21:14:00.224 32330-32512/com.sourcey.materialloginexample E/Surface: queueBuffer: error queuing buffer to SurfaceTexture, -22
04-18 21:14:00.308 32330-32512/com.sourcey.materialloginexample E/Parcel: dup() failed in Parcel::read, i is 0, fds[i] is -1, fd_count is 2, error: Bad file descriptor
04-18 21:14:00.308 32330-32512/com.sourcey.materialloginexample E/Surface: dequeueBuffer: IGraphicBufferProducer::requestBuffer failed: -22
04-18 21:14:00.644 32330-32330/com.sourcey.materialloginexample E/ActivityThread: Performing stop of activity that is not resumed: {com.sourcey.materialloginexample/com.troychuinard.fanpolls.PreferencesActivity}
                                                                                  java.lang.RuntimeException: Performing stop of activity that is not resumed: {com.sourcey.materialloginexample/com.troychuinard.fanpolls.PreferencesActivity}
                                                                                      at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:3496)
                                                                                      at android.app.ActivityThread.handleStopActivity(ActivityThread.java:3593)
                                                                                      at android.app.ActivityThread.access$1200(ActivityThread.java:157)
                                                                                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1385)
                                                                                      at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                      at android.os.Looper.loop(Looper.java:148)
                                                                                      at android.app.ActivityThread.main(ActivityThread.java:5527)
                                                                                      at java.lang.reflect.Method.invoke(Native Method)
                                                                                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730)
                                                                                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
04-18 21:14:00.694 32330-32512/com.sourcey.materialloginexample E/Surface: queueBuffer: error queuing buffer to SurfaceTexture, -22
04-18 21:14:00.895 32330-32512/com.sourcey.materialloginexample E/Parcel: dup() failed in Parcel::read, i is 0, fds[i] is -1, fd_count is 2, error: Bad file descriptor
04-18 21:14:00.895 32330-32512/com.sourcey.materialloginexample E/Surface: dequeueBuffer: IGraphicBufferProducer::requestBuffer failed: -22
04-18 21:14:01.378 32330-32512/com.sourcey.materialloginexample E/Surface: queueBuffer: error queuing buffer to SurfaceTexture, -2147483646
04-18 21:14:01.735 32330-32512/com.sourcey.materialloginexample E/Surface: queueBuffer: error queuing buffer to SurfaceTexture, -22
04-18 21:14:01.825 32330-32512/com.sourcey.materialloginexample E/Parcel: dup() failed in Parcel::read, i is 0, fds[i] is -1, fd_count is 2, error: Bad file descriptor
04-18 21:14:01.825 32330-32512/com.sourcey.materialloginexample E/Surface: dequeueBuffer: IGraphicBufferProducer::requestBuffer failed: -22
04-18 21:14:02.940 32330-32512/com.sourcey.materialloginexample E/Surface: queueBuffer: error queuing buffer to SurfaceTexture, -22
04-18 21:14:03.687 32330-32512/com.sourcey.materialloginexample E/Surface: queueBuffer: error queuing buffer to SurfaceTexture, -22
04-18 21:14:03.793 32330-32512/com.sourcey.materialloginexample E/Parcel: dup() failed in Parcel::read, i is 0, fds[i] is -1, fd_count is 2, error: Bad file descriptor
04-18 21:14:03.793 32330-32512/com.sourcey.materialloginexample E/Surface: dequeueBuffer: IGraphicBufferProducer::requestBuffer failed: -22
04-18 21:14:03.984 32330-32330/com.sourcey.materialloginexample E/ActivityThread: Performing stop of activity that is not resumed: {com.sourcey.materialloginexample/com.troychuinard.fanpolls.PreferencesActivity}
                                                                                  java.lang.RuntimeException: Performing stop of activity that is not resumed: {com.sourcey.materialloginexample/com.troychuinard.fanpolls.PreferencesActivity}
                                                                                      at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:3496)
                                                                                      at android.app.ActivityThread.handleStopActivity(ActivityThread.java:3593)
                                                                                      at android.app.ActivityThread.access$1200(ActivityThread.java:157)
                                                                                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1385)
                                                                                      at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                      at android.os.Looper.loop(Looper.java:148)
                                                                                      at android.app.ActivityThread.main(ActivityThread.java:5527)
                                                                                      at java.lang.reflect.Method.invoke(Native Method)
                                                                                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730)
                                                                                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
04-18 21:14:04.166 32330-32512/com.sourcey.materialloginexample E/Surface: queueBuffer: error queuing buffer to SurfaceTexture, -22
04-18 21:14:04.307 32330-32512/com.sourcey.materialloginexample E/Parcel: dup() failed in Parcel::read, i is 0, fds[i] is -1, fd_count is 2, error: Bad file descriptor
04-18 21:14:04.307 32330-32512/com.sourcey.materialloginexample E/Surface: dequeueBuffer: IGraphicBufferProducer::requestBuffer failed: -22
04-18 21:14:04.677 32330-32512/com.sourcey.materialloginexample E/Surface: queueBuffer: error queuing buffer to SurfaceTexture, -22
04-18 21:14:05.072 32330-32512/com.sourcey.materialloginexample E/Surface: queueBuffer: error queuing buffer to SurfaceTexture, -22
04-18 21:14:05.165 32330-32512/com.sourcey.materialloginexample E/Parcel: dup() failed in Parcel::read, i is 0, fds[i] is -1, fd_count is 2, error: Bad file descriptor
04-18 21:14:05.165 32330-32512/com.sourcey.materialloginexample E/Surface: dequeueBuffer: IGraphicBufferProducer::requestBuffer failed: -22
04-18 21:14:05.561 32330-32512/com.sourcey.materialloginexample E/Surface: queueBuffer: error queuing buffer to SurfaceTexture, -2147483646
04-18 21:14:05.844 32330-32512/com.sourcey.materialloginexample E/Surface: queueBuffer: error queuing buffer to SurfaceTexture, -22
04-18 21:14:05.958 32330-32512/com.sourcey.materialloginexample E/Parcel: dup() failed in Parcel::read, i is 0, fds[i] is -1, fd_count is 2, error: Bad file descriptor
04-18 21:14:05.958 32330-32512/com.sourcey.materialloginexample E/Surface: dequeueBuffer: IGraphicBufferProducer::requestBuffer failed: -22
04-18 21:14:07.326 32330-32512/com.sourcey.materialloginexample E/Surface: queueBuffer: error queuing buffer to SurfaceTexture, -22
04-18 21:14:07.644 32330-32330/com.sourcey.materialloginexample E/ActivityThread: Performing stop of activity that is not resumed: {com.sourcey.materialloginexample/com.troychuinard.fanpolls.PreferencesActivity}
                                                                                  java.lang.RuntimeException: Performing stop of activity that is not resumed: {com.sourcey.materialloginexample/com.troychuinard.fanpolls.PreferencesActivity}
                                                                                      at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:3496)
                                                                                      at android.app.ActivityThread.handleStopActivity(ActivityThread.java:3593)
                                                                                      at android.app.ActivityThread.access$1200(ActivityThread.java:157)
                                                                                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1385)
                                                                                      at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                      at android.os.Looper.loop(Looper.java:148)
                                                                                      at android.app.ActivityThread.main(ActivityThread.java:5527)
                                                                                      at java.lang.reflect.Method.invoke(Native Method)
                                                                                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730)
                                                                                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
04-18 21:14:07.654 32330-32512/com.sourcey.materialloginexample E/Surface: queueBuffer: error queuing buffer to SurfaceTexture, -22
04-18 21:14:07.839 32330-32512/com.sourcey.materialloginexample E/Parcel: dup() failed in Parcel::read, i is 0, fds[i] is -1, fd_count is 2, error: Bad file descriptor
04-18 21:14:07.839 32330-32512/com.sourcey.materialloginexample E/Surface: dequeueBuffer: IGraphicBufferProducer::requestBuffer failed: -22
04-18 21:14:09.065 32330-32512/com.sourcey.materialloginexample E/Parcel: dup() failed in Parcel::read, i is 0, fds[i] is -1, fd_count is 2, error: Bad file descriptor
04-18 21:14:09.065 32330-32512/com.sourcey.materialloginexample E/Surface: dequeueBuffer: IGraphicBufferProducer::requestBuffer failed: -22
04-18 21:14:12.391 32330-32330/com.sourcey.materialloginexample E/ActivityThread: Performing stop of activity that is not resumed: {com.sourcey.materialloginexample/com.troychuinard.fanpolls.PreferencesActivity}
                                                                                  java.lang.RuntimeException: Performing stop of activity that is not resumed: {com.sourcey.materialloginexample/com.troychuinard.fanpolls.PreferencesActivity}
                                                                                      at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:3496)
                                                                                      at android.app.ActivityThread.handleStopActivity(ActivityThread.java:3593)
                                                                                      at android.app.ActivityThread.access$1200(ActivityThread.java:157)
                                                                                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1385)
                                                                                      at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                      at android.os.Looper.loop(Looper.java:148)
                                                                                      at android.app.ActivityThread.main(ActivityThread.java:5527)
                                                                                      at java.lang.reflect.Method.invoke(Native Method)
                                                                                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730)
                                                                                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
04-18 21:14:12.502 32330-32512/com.sourcey.materialloginexample E/Parcel: dup() failed in Parcel::read, i is 1, fds[i] is -1, fd_count is 2, error: Bad file descriptor
04-18 21:14:12.502 32330-32512/com.sourcey.materialloginexample E/Surface: dequeueBuffer: IGraphicBufferProducer::requestBuffer failed: -22
04-18 21:14:13.738 32330-32512/com.sourcey.materialloginexample E/Parcel: dup() failed in Parcel::read, i is 1, fds[i] is -1, fd_count is 2, error: Bad file descriptor
04-18 21:14:13.738 32330-32512/com.sourcey.materialloginexample E/Surface: dequeueBuffer: IGraphicBufferProducer::requestBuffer failed: -22
04-18 21:14:16.893 32330-32330/com.sourcey.materialloginexample E/ActivityThread: Performing stop of activity that is not resumed: {com.sourcey.materialloginexample/com.troychuinard.fanpolls.PreferencesActivity}
                                                                                  java.lang.RuntimeException: Performing stop of activity that is not resumed: {com.sourcey.materialloginexample/com.troychuinard.fanpolls.PreferencesActivity}
                                                                                      at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:3496)
                                                                                      at android.app.ActivityThread.handleStopActivity(ActivityThread.java:3593)
                                                                                      at android.app.ActivityThread.access$1200(ActivityThread.java:157)
                                                                                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1385)
                                                                                      at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                      at android.os.Looper.loop(Looper.java:148)
                                                                                      at android.app.ActivityThread.main(ActivityThread.java:5527)
                                                                                      at java.lang.reflect.Method.invoke(Native Method)
                                                                                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:730)
                                                                                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
04-18 21:14:17.250 32330-32512/com.sourcey.materialloginexample E/Parcel: dup() failed in Parcel::read, i is 1, fds[i] is -1, fd_count is 2, error: Bad file descriptor
04-18 21:14:17.251 32330-32512/com.sourcey.materialloginexample E/Surface: dequeueBuffer: IGraphicBufferProducer::requestBuffer failed: -22
04-18 21:14:38.321 5484-5644/com.sourcey.materialloginexample E/Surface: getSlotFromBufferLocked: unknown buffer: 0xb8cc2500

这是我的简单加载活动,我不确定是什么产生了这个错误:

public class LoadingActivity extends AppCompatActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_loading);
    Firebase.setAndroidContext(this);

    final Firebase userRef = FirebaseUtil.FIREBASE.child("Users");
    final AuthData authData = userRef.getAuth();

    if (authData != null) {
        userRef.addListenerForSingleValueEvent(new ValueEventListener() {
            @Override
            public void onDataChange(DataSnapshot dataSnapshot) {
                String selectedPrefs = (String) dataSnapshot.child(authData.getUid()).child("Selected_Prefs").getValue();
                if (TextUtils.isEmpty(selectedPrefs) || !selectedPrefs.equals("true")) {
                    startActivity(new Intent(LoadingActivity.this, PreferencesActivity.class));
                } else {
                    startActivity(new Intent(LoadingActivity.this, MainActivity.class));
                }
                finish();
            }

            @Override
            public void onCancelled(FirebaseError firebaseError) {
                startActivity(new Intent(LoadingActivity.this, SignupActivity.class));
                finish();
            }
        });
    } else {
        startActivity(new Intent(LoadingActivity.this, SignupActivity.class));
        finish();
    }
  }
}

这是PreferencesActivity:

public class PreferencesActivity extends AppCompatActivity {

private Toolbar toolbar;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Firebase.setAndroidContext(this);
    setContentView(R.layout.activity_preferences);
    toolbar = (Toolbar) findViewById(R.id.tool_bar);
    setSupportActionBar(toolbar);
    createNavDrawer();
}

private void createNavDrawer() {

    final PrimaryDrawerItem item1 = new PrimaryDrawerItem().withName(R.string.drawer_item_home).withIdentifier(1);
    SecondaryDrawerItem item2 = new SecondaryDrawerItem().withName(R.string.drawer_item_previous_polls).withIdentifier(2);
    SecondaryDrawerItem item3 = new SecondaryDrawerItem().withName(R.string.drawer_item_preferences).withIdentifier(3);
    SecondaryDrawerItem item4 = new SecondaryDrawerItem().withName(R.string.drawer_item_request_poll).withIdentifier(4);
    SecondaryDrawerItem item5 = new SecondaryDrawerItem().withName(R.string.drawer_item_suppport).withIdentifier(5);
    SecondaryDrawerItem item6 = new SecondaryDrawerItem().withName(R.string.drawer_item_logut).withIdentifier(6);

    AccountHeader headerResult = new AccountHeaderBuilder()
            .withActivity(this)
            .withHeaderBackground(R.drawable.ic_facebook)
            .addProfiles(
                    new ProfileDrawerItem().withEmail("bob@gmail.com").withIcon(getResources().getDrawable(R.drawable.logo))
            )
            .withOnAccountHeaderListener(new AccountHeader.OnAccountHeaderListener() {
                @Override
                public boolean onProfileChanged(View view, IProfile profile, boolean currentProfile) {
                    return false;
                }
            })
            .build();


    Drawer result = new DrawerBuilder()
            .withAccountHeader(headerResult)
            .withActivity(this)
            .withToolbar(toolbar)
            .addDrawerItems(
                    item1,
                    new DividerDrawerItem(),
                    item2,
                    item3,
                    item4,
                    item5,
                    item6
            )
            .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
                @Override
                public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
                    drawerItem.withSetSelected(true);
                    switch ((int)drawerItem.getIdentifier()) {
                        case 1:
                            Intent toHomeActivity = new Intent(getApplicationContext(), MainActivity.class);
                            startActivity(toHomeActivity);
                            break;
                        case 2:
                            break;
                        case 3:
                            Intent toPreferencesActivity = new Intent(getApplicationContext(), PreferencesActivity.class);
                            startActivity(toPreferencesActivity);
                            break;
                    }

                    return false;
                }
            })
            .build();
         result.setSelection(3);
        }
    }

1 个答案:

答案 0 :(得分:0)

我正在使用第三方库来初始化我的导航抽屉: https://github.com/mikepenz/MaterialDrawer

我已删除此库,现在一切正常。 Google最近的更新似乎已弃用此库(无论是有意还是无意)。我的最佳方法是继续使用本机代码。

createNavDrawer()方法是我初始化库的地方。