GridLayout兼容性-ClassNotFoundException:没有';“找不到类”;android.support.v7.widget.GridLayout“;
我试图在我的Android 2.2项目中使用GridLayout,在我的工作区中安装了GridLayout_v7项目后,将其添加到我的项目Android依赖项中,为其自定义属性添加自定义xmlns,并将其嵌入我的xml布局中,如下所示:GridLayout兼容性-ClassNotFoundException:没有';“找不到类”;android.support.v7.widget.GridLayout“;,android,grid-layout,android-support-library,android-gridlayout,Android,Grid Layout,Android Support Library,Android Gridlayout,我试图在我的Android 2.2项目中使用GridLayout,在我的工作区中安装了GridLayout_v7项目后,将其添加到我的项目Android依赖项中,为其自定义属性添加自定义xmlns,并将其嵌入我的xml布局中,如下所示: <android.support.v7.widget.GridLayout android:layout_width="match_parent" android:layout_height="300dp" grid:columnC
<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>
我在运行时开始出现以下异常:
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]]
java.lang.ClassNotFoundException:未找到类
路径:DexPathList[[zip文件]上的“android.support.v7.widget.GridLayout”
“system/framework/android.test.runner.jar”,zip文件“data/app/.apk”],
NativeLibraryDirectory=[data/app lib/,/vendor/lib,/system/lib]]
我尝试过清理和重建,移除库并再次添加,但没有效果。
你知道是什么导致了这个错误吗?我看到了这个错误。对我来说,我必须在依赖项中特别包括网格布局,如下所示:
dependencies {
...
compile 'com.android.support:gridlayout-v7:18.0.+'
}
有关如何包含支持库的更多信息,请参见此处: