Eclipse giving an error of android.support.v7.widget.GridLayout failed to instantiate

后端 未结 4 1529
野趣味
野趣味 2020-12-19 03:38

I have tried to incorporate the GridLayout from the support library, but it is not working. My target build is for API version 10. The XML code I am using is shown below:

相关标签:
4条回答
  • 2020-12-19 03:50
    1. update eclipse, adt (even to version 20 preview 2) , sdk manager and the support library .

    2. try to restart eclipse and see if that helps.

    3. try to create a totally new project (with low sdk being used for the min and target sdk , but not for the one specified on the project.properties file ) and drag the gridLayout in the visual editor. this will automatically add the needed library.

    4. if nothing helps , try this example : http://code.google.com/p/android-playground/source/checkout

    0 讨论(0)
  • 2020-12-19 03:51

    I try a number of solution provided by different contributor (eg restart Eclipse, removing and adding libary etc)

    After looking at this site, I did the following:

    1. Replace all the library android-support-v4.jar with the android-sdk (hoping that it will be the latest copy)
    2. I commented the Gridlayout in xml and use the layout editor just drag gridlayout.

    After that everything works for me. I am not sure which step is the one that fix it but there is no harm trying.

    0 讨论(0)
  • 2020-12-19 03:54

    It seems you are doing for Android L but anyway include this line inside your styles.xml.

    <item name="windowActionBar">false</item> 
    
    0 讨论(0)
  • 2020-12-19 03:57

    Update your Compatibility Library to revision 8, then follow the instruction in README.txt file in "extras\android\compatibility\v7\gridlayout" folder.

    Hope this help you.

    Notes: You must use grid:columnCount="6" instead of android.support.v7.widget.columnCount="6" because you declare the prefix "grid" in xmlns:grid="http://schemas.android.com/apk/res-auto".

    0 讨论(0)
提交回复
热议问题