jeudi 7 décembre 2017

requestLayout() improperly called by android.support.v4.app.NoSaveStateFrameLayout during second layout pass: posting in next frame

Tried testing out my app on Amazon Device Farm

Got this error multiple times on when testing 1) Samsung Galaxy S5 (T-Mobile) and 2) Samsung Galaxy S6 (Verizon)

requestLayout() improperly called by android.support.v4.app.NoSaveStateFrameLayout during second layout pass: posting in next frame

Any tips? During testing, my app would not even open on these devices. It worked on Amazon Kindle Fire HDX 7, LG G Pad 7.0, and Samsung Galaxy Tab 4.

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

    MobileAds.initialize(this, "ca-app-pub-5500324966368595~3405669495");
    bannerAdView = findViewById(R.id.bannerAdView);
    AdRequest bannderAdRequest = new AdRequest.Builder().addTestDevice(AdRequest.DEVICE_ID_EMULATOR).addTestDevice("Empty").build();
    bannerAdView.loadAd(bannderAdRequest);

    String[] moduleNames = { "Module 1", "Module 2", "Module 3", "Module 4", "Module 5",};
    ListView moduleListView;

    moduleListView = (ListView) findViewById(R.id.moduleListView);
    ArrayAdapter<String> listAdapter = new ArrayAdapter<String>(this, R.layout.module_row, moduleNames);
    moduleListView.setAdapter(listAdapter);

    moduleListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            startModule(position);
        }
    });
}

<?xml version="1.0" encoding="utf-8"?>
<android.widget.LinearLayout 
xmlns:android="http://ift.tt/nIICcg"
    xmlns:app="http://ift.tt/GEGVYd"
    xmlns:tools="http://ift.tt/LrGmb4"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context="com.example.tony.satmath.MainActivity">

    <ListView
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:id="@+id/moduleListView"/>

    <com.google.android.gms.ads.AdView
        xmlns:ads="http://ift.tt/GEGVYd"
        android:id="@+id/bannerAdView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_alignParentBottom="true"
        ads:adSize="SMART_BANNER"
        ads:adUnitId="ca-app-pub-5500324966368595/8744011682">
    </com.google.android.gms.ads.AdView>

Aucun commentaire:

Enregistrer un commentaire