gpt4 book ai didi

android - GridLayout 兼容性 - ClassNotFoundException : Didn't find class "android.support.v7.widget.GridLayout"

转载 作者:太空宇宙 更新时间:2023-11-03 10:48:11 25 4
gpt4 key购买 nike

我正在尝试在我的 Android 2.2 项目中使用 GridLayout,在我的工作区中安装 gridlayout_v7 项目后,将其添加到我的项目 Android 依赖项中,为其自定义属性添加自定义 xmlns,并将其嵌入到我的 xml 中布局如下:

<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]]

我尝试过清理和重建,删除库并再次添加它但无济于事。关于可能导致这种情况的原因有什么想法吗?

最佳答案

我看到了这个错误。对我来说,我必须像这样在我的依赖项中专门包含网格布局:

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

在此处查看有关如何包含支持库的更多信息:https://developer.android.com/tools/support-library/features.html

关于android - GridLayout 兼容性 - ClassNotFoundException : Didn't find class "android.support.v7.widget.GridLayout",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18787160/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com