【问题标题】:GridLayout compatibility - ClassNotFoundException: Didn't find class "android.support.v7.widget.GridLayout"GridLayout 兼容性 - ClassNotFoundException:找不到类“android.support.v7.widget.GridLayout”
【发布时间】:2014-08-06 03:52:50
【问题描述】:

我正在尝试在我的 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]]

我尝试清理和重建,删除库并再次添加,但无济于事。 关于可能导致这种情况的任何想法?

【问题讨论】:

    标签: android grid-layout android-support-library android-gridlayout


    【解决方案1】:

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

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

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

    【讨论】:

      猜你喜欢
      • 2018-07-23
      • 2012-09-10
      • 1970-01-01
      • 2013-03-26
      • 1970-01-01
      • 1970-01-01
      • 2016-06-22
      • 2013-09-01
      • 1970-01-01
      相关资源
      最近更新 更多