4

I'm trying to use GridLayout in my Android 2.2 project, and after having installed the gridlayout_v7 project in my workspace, adding it to my projects Android Dependencies, adding a custom xmlns for its custom attributes, and embedding it in my xml layout as such:

<android.support.v7.widget.GridLayout
    android:layout_width="match_parent"
    android:layout_height="300dp"
    grid:columnCount="2"
    grid:rowCount="3" >

    <include
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        layout="@layout/quick_contact" />
    <include
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        layout="@layout/quick_contact" />
    <include
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        layout="@layout/quick_contact" />
    <include
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        layout="@layout/quick_contact" />
    <include
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        layout="@layout/quick_contact" />
    <include
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        layout="@layout/quick_contact" />
</android.support.v7.widget.GridLayout>

I started getting the following exception at runtime:

java.lang.ClassNotFoundException: Didn't find class 
"android.support.v7.widget.GridLayout" on path: DexPathList[[zip file 
"system/framework/android.test.runner.jar", zip file "data/app/<app package>.apk"], 
nativeLibraryDirectories=[data/app-lib/<app package>, /vendor/lib, /system/lib]]

I have tried cleaning and rebuilding, removing the library and adding it again but to no avail. Any ideas as to what may be causing this?

1 Answer 1

1

I saw this error. For me, I had to include grid layout specifically in my dependencies like so:

dependencies {
   ...
   compile 'com.android.support:gridlayout-v7:18.0.+'
}

See more here about how to include support libraries: https://developer.android.com/tools/support-library/features.html

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.