Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Menu button crashes application when has overflow actions on API 7

I am trying to implement Action Bar for API 7 and above.
I am using Android Studio to create a new simple project with the following configuration:
- Minimum SDK: API 7
- Target SDK: API 14
- Compile: Google APIs 14
- Theme: Holo Light with Dark Action Bar
- Set the Create Activity, Fragments, Navigation Drawer, Action Bar

Then in the next screen I select Blank Activity
On the last screen I select Navigation Drawer for additional features.

I run the application on the Emulator with API 14 and everything is working fine.
But when I run it on the Emulator with API 7 (also on a real device) it crash when I press the menu button.

After doing some experiments I found that it only happens if there are overflow actions in the action bar.

What am I missing?

All the code is auto-generated by Android Studio (Some small modification for testing purposes)
MainActivity.java

package com.test.myapplication4.app;

import android.app.Activity;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBar;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.support.v4.widget.DrawerLayout;
import android.widget.ArrayAdapter;
import android.widget.TextView;


public class MainActivity extends ActionBarActivity
        implements NavigationDrawerFragment.NavigationDrawerCallbacks {
    private NavigationDrawerFragment mNavigationDrawerFragment;
    private CharSequence mTitle;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        mNavigationDrawerFragment = (NavigationDrawerFragment)
                getSupportFragmentManager().findFragmentById(R.id.navigation_drawer);
        mTitle = getTitle();

        mNavigationDrawerFragment.setUp(
                R.id.navigation_drawer,
                (DrawerLayout) findViewById(R.id.drawer_layout));
    }

    @Override
    public void onNavigationDrawerItemSelected(int position) {
        // update the main content by replacing fragments
        FragmentManager fragmentManager = getSupportFragmentManager();
        fragmentManager.beginTransaction()
                .replace(R.id.container, PlaceholderFragment.newInstance(position + 1))
                .commit();
    }

    public void onSectionAttached(int number) {
        switch (number) {
            case 1:
                mTitle = getString(R.string.title_section1);
                break;
            case 2:
                mTitle = getString(R.string.title_section2);
                break;
            case 3:
                mTitle = getString(R.string.title_section3);
                break;
        }
    }

    public void restoreActionBar() {
        ActionBar actionBar = getSupportActionBar();
        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
        actionBar.setDisplayShowTitleEnabled(true);
        actionBar.setTitle(mTitle);
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        if (!mNavigationDrawerFragment.isDrawerOpen()) {
            getMenuInflater().inflate(R.menu.main, menu);
            restoreActionBar();
            return true;
        }
        return super.onCreateOptionsMenu(menu);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        int id = item.getItemId();
        if (id == R.id.action_settings) {
            return true;
        }
        return super.onOptionsItemSelected(item);
    }

    public static class PlaceholderFragment extends Fragment {
        private static final String ARG_SECTION_NUMBER = "section_number";

        public static PlaceholderFragment newInstance(int sectionNumber) {
            PlaceholderFragment fragment = new PlaceholderFragment();
            Bundle args = new Bundle();
            args.putInt(ARG_SECTION_NUMBER, sectionNumber);
            fragment.setArguments(args);
            return fragment;
        }

        public PlaceholderFragment() {
        }

        @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                Bundle savedInstanceState) {
            View rootView = inflater.inflate(R.layout.fragment_main, container, false);
            TextView textView = (TextView) rootView.findViewById(R.id.section_label);
            textView.setText(Integer.toString(getArguments().getInt(ARG_SECTION_NUMBER)));
            return rootView;
        }

        @Override
        public void onAttach(Activity activity) {
            super.onAttach(activity);
            ((MainActivity) activity).onSectionAttached(
                    getArguments().getInt(ARG_SECTION_NUMBER));
        }
    }

}

NavigationDrawerFragment.java

package com.test.myapplication4.app;

import android.support.v7.app.ActionBarActivity;
import android.app.Activity;
import android.support.v7.app.ActionBar;
import android.support.v4.app.Fragment;
import android.support.v4.app.ActionBarDrawerToggle;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;

public class NavigationDrawerFragment extends Fragment {
    private static final String STATE_SELECTED_POSITION = "selected_navigation_drawer_position";
    private static final String PREF_USER_LEARNED_DRAWER = "navigation_drawer_learned";
    private NavigationDrawerCallbacks mCallbacks;
    private ActionBarDrawerToggle mDrawerToggle;

    private DrawerLayout mDrawerLayout;
    private ListView mDrawerListView;
    private View mFragmentContainerView;

    private int mCurrentSelectedPosition = 0;
    private boolean mFromSavedInstanceState;
    private boolean mUserLearnedDrawer;

    public NavigationDrawerFragment() {
    }

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

        SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getActivity());
        mUserLearnedDrawer = sp.getBoolean(PREF_USER_LEARNED_DRAWER, false);

        if (savedInstanceState != null) {
            mCurrentSelectedPosition = savedInstanceState.getInt(STATE_SELECTED_POSITION);
            mFromSavedInstanceState = true;
        }

        selectItem(mCurrentSelectedPosition);
    }

    @Override
    public void onActivityCreated (Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        mDrawerListView = (ListView) inflater.inflate(
                R.layout.fragment_navigation_drawer, container, false);
        mDrawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                selectItem(position);
            }
        });
        mDrawerListView.setAdapter(new ArrayAdapter<String>(
                getActionBar().getThemedContext(),
                android.R.layout.simple_list_item_1,
                android.R.id.text1,
                new String[]{
                        getString(R.string.title_section1),
                        getString(R.string.title_section2),
                        getString(R.string.title_section3),
                }));
        mDrawerListView.setItemChecked(mCurrentSelectedPosition, true);
        return mDrawerListView;
    }

    public boolean isDrawerOpen() {
        return mDrawerLayout != null && mDrawerLayout.isDrawerOpen(mFragmentContainerView);
    }

    public void setUp(int fragmentId, DrawerLayout drawerLayout) {
        mFragmentContainerView = getActivity().findViewById(fragmentId);
        mDrawerLayout = drawerLayout;

        mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);

        ActionBar actionBar = getActionBar();
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setHomeButtonEnabled(true);

        mDrawerToggle = new ActionBarDrawerToggle(
                getActivity(),
                mDrawerLayout,
                R.drawable.ic_drawer,
                R.string.navigation_drawer_open,
                R.string.navigation_drawer_close
        ) {
            @Override
            public void onDrawerClosed(View drawerView) {
                super.onDrawerClosed(drawerView);
                if (!isAdded()) {
                    return;
                }

                getActivity().supportInvalidateOptionsMenu(); // calls onPrepareOptionsMenu()
            }

            @Override
            public void onDrawerOpened(View drawerView) {
                super.onDrawerOpened(drawerView);
                if (!isAdded()) {
                    return;
                }

                if (!mUserLearnedDrawer) {
                    mUserLearnedDrawer = true;
                    SharedPreferences sp = PreferenceManager
                            .getDefaultSharedPreferences(getActivity());
                    sp.edit().putBoolean(PREF_USER_LEARNED_DRAWER, true).commit();
                }

                getActivity().supportInvalidateOptionsMenu(); // calls onPrepareOptionsMenu()
            }
        };

        if (!mUserLearnedDrawer && !mFromSavedInstanceState) {
            mDrawerLayout.openDrawer(mFragmentContainerView);
        }

        mDrawerLayout.post(new Runnable() {
            @Override
            public void run() {
                mDrawerToggle.syncState();
            }
        });

        mDrawerLayout.setDrawerListener(mDrawerToggle);
    }

    private void selectItem(int position) {
        mCurrentSelectedPosition = position;
        if (mDrawerListView != null) {
            mDrawerListView.setItemChecked(position, true);
        }
        if (mDrawerLayout != null) {
            mDrawerLayout.closeDrawer(mFragmentContainerView);
        }
        if (mCallbacks != null) {
            mCallbacks.onNavigationDrawerItemSelected(position);
        }
    }

    @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);
        try {
            mCallbacks = (NavigationDrawerCallbacks) activity;
        } catch (ClassCastException e) {
            throw new ClassCastException("Activity must implement NavigationDrawerCallbacks.");
        }
    }

    @Override
    public void onDetach() {
        super.onDetach();
        mCallbacks = null;
    }

    @Override
    public void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        outState.putInt(STATE_SELECTED_POSITION, mCurrentSelectedPosition);
    }

    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        mDrawerToggle.onConfigurationChanged(newConfig);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        if (mDrawerToggle.onOptionsItemSelected(item)) {
            return true;
        }

        if (item.getItemId() == R.id.action_example) {
            Toast.makeText(getActivity(), "Example action.", Toast.LENGTH_SHORT).show();
            return true;
        }

        return super.onOptionsItemSelected(item);
    }

    private void showGlobalContextActionBar() {
        ActionBar actionBar = getActionBar();
        actionBar.setDisplayShowTitleEnabled(true);
        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
        actionBar.setTitle(R.string.app_name);
    }

    private ActionBar getActionBar() {
        return ((ActionBarActivity) getActivity()).getSupportActionBar();
    }

    public static interface NavigationDrawerCallbacks {
        void onNavigationDrawerItemSelected(int position);
    }
}

menu.xml

<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    tools:context="com.test.myapplication4.app.MainActivity" >
    <item android:id="@+id/action_example"
        android:title="@string/action_example"
        app:showAsAction="withText|ifRoom" />
    <item android:id="@+id/action_settings"
        android:title="@string/action_settings"
        app:showAsAction="ifRoom" />
    <item android:id="@+id/action_settings1"
        android:title="@string/action_settings"
        app:showAsAction="ifRoom" />
</menu>

activity_main.xml

<!-- A DrawerLayout is intended to be used as the top-level content view using match_parent for both width and height to consume the full space available. -->
<android.support.v4.widget.DrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.test.myapplication4.app.MainActivity">

    <FrameLayout
        android:id="@+id/container"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <fragment android:id="@+id/navigation_drawer"
        android:layout_width="@dimen/navigation_drawer_width"
        android:layout_height="match_parent"
        android:layout_gravity="left"
        android:name="com.test.myapplication4.app.NavigationDrawerFragment" />

</android.support.v4.widget.DrawerLayout>

fragment_main.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin"
    tools:context="com.test.myapplication4.app.MainActivity$PlaceholderFragment">

    <TextView
        android:id="@+id/section_label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

</RelativeLayout>

fragment_navigation_drawer.xml

<ListView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:choiceMode="singleChoice"
    android:divider="@android:color/transparent"
    android:dividerHeight="0dp"
    android:background="#cccc"
    tools:context="com.test.myapplication4.app.NavigationDrawerFragment" />

Filtered logcat from a real device

03-22 18:01:53.665  21494-21498/com.test.myapplication4.app D/dalvikvm﹕ Debugger has detached; object registry had 1 entries
03-22 18:01:53.745  21494-21494/com.test.myapplication4.app D/dalvikvm﹕ GC_EXTERNAL_ALLOC freed 85K, 49% free 2793K/5379K, external 0K/0K, paused 24ms
03-22 18:01:53.945  21494-21494/com.test.myapplication4.app D/CLIPBOARD﹕ Hide Clipboard dialog at Starting input: finished by someone else... !
03-22 18:01:58.450  21494-21494/com.test.myapplication4.app I/dalvikvm﹕ Could not find method android.widget.LinearLayout$LayoutParams.<init>, referenced from method android.support.v7.internal.view.menu.ActionMenuView$LayoutParams.<init>
03-22 18:01:58.450  21494-21494/com.test.myapplication4.app W/dalvikvm﹕ VFY: unable to resolve direct method 8048: Landroid/widget/LinearLayout$LayoutParams;.<init> (Landroid/widget/LinearLayout$LayoutParams;)V
03-22 18:01:58.450  21494-21494/com.test.myapplication4.app D/dalvikvm﹕ VFY: replacing opcode 0x70 at 0x0000
03-22 18:01:58.450  21494-21494/com.test.myapplication4.app D/dalvikvm﹕ VFY: dead code 0x0003-0007 in Landroid/support/v7/internal/view/menu/ActionMenuView$LayoutParams;.<init> (Landroid/support/v7/internal/view/menu/ActionMenuView$LayoutParams;)V
03-22 18:02:31.810  21494-21494/com.test.myapplication4.app W/KeyCharacterMap﹕ No keyboard for id 0
03-22 18:02:31.810  21494-21494/com.test.myapplication4.app W/KeyCharacterMap﹕ Using default keymap: /system/usr/keychars/qwerty.kcm.bin
03-22 18:02:31.900  21494-21494/com.test.myapplication4.app D/dalvikvm﹕ GC_EXTERNAL_ALLOC freed 116K, 48% free 2920K/5511K, external 500K/513K, paused 65ms

Additional logcat from the real device after pressing the menu button

03-22 18:02:31.930    2801-3147/? D/InputReader﹕ Input event: value=0
03-22 18:02:31.930    2801-3146/? I/InputDispatcher﹕ Delivering key to current input target: action: 1, channel '40b1ef40 com.test.myapplication4.app/com.test.myapplication4.app.MainActivity (server)'
03-22 18:02:32.035  10167-10167/? I/DEBUG﹕ *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
03-22 18:02:32.035  10167-10167/? I/DEBUG﹕ Build fingerprint: 'samsung/GT-I9100/GT-I9100:2.3.6/GINGERBREAD/XWKK5:user/release-keys'
03-22 18:02:32.035  10167-10167/? I/DEBUG﹕ pid: 21494, tid: 21494  >>> com.test.myapplication4.app <<<
03-22 18:02:32.035  10167-10167/? I/DEBUG﹕ signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000001
03-22 18:02:32.035  10167-10167/? I/DEBUG﹕ r0 00000000  r1 00000007  r2 fffffe84  r3 00000070
03-22 18:02:32.035  10167-10167/? I/DEBUG﹕ r4 0000ae28  r5 40537570  r6 ad3d3a00  r7 00000001
03-22 18:02:32.035  10167-10167/? I/DEBUG﹕ r8 001af348  r9 001af398  10 00000001  fp 442f85b8
03-22 18:02:32.035  10167-10167/? I/DEBUG﹕ ip ad3d487c  sp bebe1368  lr ad35e425  pc a8115e10  cpsr 20000030
03-22 18:02:32.035  10167-10167/? I/DEBUG﹕ d0  414000003f800000  d1  0000000043160000
03-22 18:02:32.035  10167-10167/? I/DEBUG﹕ d2  0000000000000000  d3  0000000000000000
03-22 18:02:32.035  10167-10167/? I/DEBUG﹕ d4  bf80000000000000  d5  0000000000000000
03-22 18:02:32.035  10167-10167/? I/DEBUG﹕ d6  3f80000000000000  d7  4080000000000000
03-22 18:02:32.035  10167-10167/? I/DEBUG﹕ d8  0000000000000000  d9  0000000000000000
03-22 18:02:32.035  10167-10167/? I/DEBUG﹕ d10 0000000000000000  d11 0000000000000000
03-22 18:02:32.035  10167-10167/? I/DEBUG﹕ d12 0000000000000000  d13 0000000000000000
03-22 18:02:32.035  10167-10167/? I/DEBUG﹕ d14 0000000000000000  d15 0000000000000000
03-22 18:02:32.035  10167-10167/? I/DEBUG﹕ d16 0000000300000001  d17 bff0000000000000
03-22 18:02:32.035  10167-10167/? I/DEBUG﹕ d18 3ff0000000000000  d19 0000000000000000
03-22 18:02:32.035  10167-10167/? I/DEBUG﹕ d20 0000000000000000  d21 0000000000000000
03-22 18:02:32.035  10167-10167/? I/DEBUG﹕ d22 3ff0000000000000  d23 0000000000000000
03-22 18:02:32.035  10167-10167/? I/DEBUG﹕ d24 3ff0000000000000  d25 0000000000000000
03-22 18:02:32.035  10167-10167/? I/DEBUG﹕ d26 0000000000000000  d27 0000000000000000
03-22 18:02:32.035  10167-10167/? I/DEBUG﹕ d28 010f000001090000  d29 407c300000000000
03-22 18:02:32.035  10167-10167/? I/DEBUG﹕ d30 0000000000000000  d31 3ff0000000000000
03-22 18:02:32.035  10167-10167/? I/DEBUG﹕ scr 60000010
03-22 18:02:32.170  10167-10167/? I/DEBUG﹕ #00  pc 00015e10  /system/lib/libutils.so
03-22 18:02:32.170  10167-10167/? I/DEBUG﹕ #01  lr ad35e425  /system/lib/libandroid_runtime.so
03-22 18:02:32.170  10167-10167/? I/DEBUG﹕ code around pc:
03-22 18:02:32.170  10167-10167/? I/DEBUG﹕ a8115df0 f4026412 ea44457f ea442405 f841221c
03-22 18:02:32.170  10167-10167/? I/DEBUG﹕ a8115e00 33012023 1003f990 dbea428b bf00bd30
03-22 18:02:32.170  10167-10167/? I/DEBUG﹕ a8115e10 2001f990 3002f990 f99018d1 f1113003
03-22 18:02:32.170  10167-10167/? I/DEBUG﹕ a8115e20 18d00208 47700080 47706800 b10b6803
03-22 18:02:32.170  10167-10167/? I/DEBUG﹕ a8115e30 e0012000 68886881 bf004770 33fff04f
03-22 18:02:32.170  10167-10167/? I/DEBUG﹕ code around lr:
03-22 18:02:32.170  10167-10167/? I/DEBUG﹕ ad35e404 f8d24629 465a71a0 46204603 f1ba47b8
03-22 18:02:32.170  10167-10167/? I/DEBUG﹕ ad35e414 d0590f00 7030f89d 980db32f ee4ef7ce
03-22 18:02:32.170  10167-10167/? I/DEBUG﹕ ad35e424 68204601 22c0f8d0 47904620 b9104607
03-22 18:02:32.170  10167-10167/? I/DEBUG﹕ ad35e434 4478484c 6821e7b4 22004620 3378f8d1
03-22 18:02:32.170  10167-10167/? I/DEBUG﹕ ad35e444 47984639 b9104682 44784847 980de7a8
03-22 18:02:32.170  10167-10167/? I/DEBUG﹕ stack:
03-22 18:02:32.170  10167-10167/? I/DEBUG﹕ bebe1328  40556780
03-22 18:02:32.170  10167-10167/? I/DEBUG﹕ bebe132c  00000000
03-22 18:02:32.170  10167-10167/? I/DEBUG﹕ bebe1330  40556780
03-22 18:02:32.170  10167-10167/? I/DEBUG﹕ bebe1334  0000d088
03-22 18:02:32.170  10167-10167/? I/DEBUG﹕ bebe1338  40556780
03-22 18:02:32.170  10167-10167/? I/DEBUG﹕ bebe133c  8034c10b  /system/lib/libdvm.so
03-22 18:02:32.170  10167-10167/? I/DEBUG﹕ bebe1340  40537570
03-22 18:02:32.170  10167-10167/? I/DEBUG﹕ bebe1344  442f85b8
03-22 18:02:32.175  10167-10167/? I/DEBUG﹕ bebe1348  40556780
03-22 18:02:32.175  10167-10167/? I/DEBUG﹕ bebe134c  8034bff1  /system/lib/libdvm.so
03-22 18:02:32.175  10167-10167/? I/DEBUG﹕ bebe1350  0000ae28
03-22 18:02:32.175  10167-10167/? I/DEBUG﹕ bebe1354  40537570
03-22 18:02:32.175  10167-10167/? I/DEBUG﹕ bebe1358  ad3d3a00
03-22 18:02:32.175  10167-10167/? I/DEBUG﹕ bebe135c  8034bfbd  /system/lib/libdvm.so
03-22 18:02:32.175  10167-10167/? I/DEBUG﹕ bebe1360  df002777
03-22 18:02:32.175  10167-10167/? I/DEBUG﹕ bebe1364  e3a070ad
03-22 18:02:32.175  10167-10167/? I/DEBUG﹕ #00 bebe1368  00000001
03-22 18:02:32.175  10167-10167/? I/DEBUG﹕ bebe136c  afd149f9  /system/lib/libc.so
03-22 18:02:32.175  10167-10167/? I/DEBUG﹕ bebe1370  001af2a0
03-22 18:02:32.175  10167-10167/? I/DEBUG﹕ bebe1374  00000000
03-22 18:02:32.175  10167-10167/? I/DEBUG﹕ bebe1378  00000000
03-22 18:02:32.175  10167-10167/? I/DEBUG﹕ bebe137c  00000000
03-22 18:02:32.175  10167-10167/? I/DEBUG﹕ bebe1380  001aed30
03-22 18:02:32.175  10167-10167/? I/DEBUG﹕ bebe1384  40557a90
03-22 18:02:32.175  10167-10167/? I/DEBUG﹕ bebe1388  001af310
03-22 18:02:32.175  10167-10167/? I/DEBUG﹕ bebe138c  ad3d3200
03-22 18:02:32.175  10167-10167/? I/DEBUG﹕ bebe1390  00000002
03-22 18:02:32.175  10167-10167/? I/DEBUG﹕ bebe1394  001af348
03-22 18:02:32.175  10167-10167/? I/DEBUG﹕ bebe1398  001af201
03-22 18:02:32.175  10167-10167/? I/DEBUG﹕ bebe139c  00000000
03-22 18:02:32.175  10167-10167/? I/DEBUG﹕ bebe13a0  00000000
03-22 18:02:32.175  10167-10167/? I/DEBUG﹕ bebe13a4  00000000
03-22 18:02:32.175  10167-10167/? I/DEBUG﹕ bebe13a8  40537570
03-22 18:02:32.175  10167-10167/? I/DEBUG﹕ bebe13ac  001af348
03-22 18:02:32.485  10167-10167/? I/DEBUG﹕ dumpstate /data/log/dumpstate_app_native.txt
03-22 18:02:32.490  21671-21671/? I/dumpstate﹕ begin
03-22 18:02:33.295    2801-3142/? E/lights﹕ write_int: path /sys/devices/virtual/misc/melfas_touchkey/brightness, value 2
03-22 18:02:33.295    2801-3142/? W/PowerManagerService﹕ Timer 0x7->0x3|0x0
03-22 18:02:33.295    2801-3142/? I/PowerManagerService﹕ Ulight 7->3|0
03-22 18:02:33.295    2801-3142/? D/PowerManagerService﹕ setLightBrightness : mButtonLight : 0
03-22 18:02:35.290    2581-2688/? D/VoldCmdListener﹕ asec list
03-22 18:02:36.170  21671-21671/? I/dumpstate﹕ done
03-22 18:02:36.230    2801-2807/? I/ActivityManager﹕ Process com.test.myapplication4.app (pid 21494) has died.
03-22 18:02:36.230    2801-2801/? I/WindowManager﹕ WIN DEATH: Window{40b1ef40 com.test.myapplication4.app/com.test.myapplication4.app.MainActivity paused=false}
03-22 18:02:36.230    2801-2801/? W/WindowManager﹕ Window Window{40b1ef40 com.test.myapplication4.app/com.test.myapplication4.app.MainActivity paused=false} destroyed surface Surface(name=com.test.myapplication4.app/com.test.myapplication4.app.MainActivity, identity=-1, mNativeSurface=0), session Session{40a8af28 uid 10112}
03-22 18:02:36.235    2588-2588/? D/Zygote﹕ Process 21494 terminated by signal (11)
03-22 18:02:36.245    2801-3295/? I/OrientationDebug﹕ [pwm] in updateOrientationListenerLp()
03-22 18:02:36.245    2801-3295/? V/OrientationDebug﹕ in updateOrientationListenerLp(), Screen status=true, current orientation=1, SensorEnabled=true
03-22 18:02:36.245    2801-3295/? I/OrientationDebug﹕ [pwm] needSensorRunningLp(), return true #4
03-22 18:02:36.250    6072-6072/? I/GLThread﹕ onResume tid=10
03-22 18:02:36.250    6072-6072/? I/Main thread﹕ onResume waiting for !mPaused.
03-22 18:02:36.250    6072-6081/? I/GLThread﹕ mPaused is now false tid=10
03-22 18:02:36.250    6072-6072/? I/Launcher﹕ onResume(). mIsNewIntent : false screenOff: true
03-22 18:02:36.255    6072-6072/? D/Launcher﹕ It's image wallpaper. suggestDesiredDimensions(-1,-1)
like image 873
Hanan Avatar asked Oct 01 '22 06:10

Hanan


1 Answers

You don't mention what version of Android Studio or what version of the Android Gradle plugin you're running, but I'm guessing it's 0.5.1 and 0.9.1, respectively. If that's true, you're hitting bug https://code.google.com/p/android/issues/detail?id=67376 , which is that the PNG processing code in 0.9.1 generates PNGs that crash Gingerbread for reasons that are still under investigation. From comment #10 in that bug, you can choose from one of two workarounds:

just add next lines to your build.gradle in order to use 0.9.1 plugin or just downgrade to 0.9.0

// Use old PNG cruncher because of crashes on GB
android.aaptOptions.useAaptPngCruncher = true

If you're not running 0.9.1 of the Android Gradle plugin, then this isn't your bug.

like image 197
Scott Barta Avatar answered Oct 12 '22 11:10

Scott Barta