Reputation: 3029
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?
Upvotes: 4
Views: 1131
Reputation: 130
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
Upvotes: 1