Android Studio - 使用支持库呈现 XML 文件的问题

标签 android android-layout android-support-library

对于使用支持库的 XML 文件,我遇到了呈现问题,而对于普通 XML 文件,我却没有同样的问题。这些是我为单独的 XML 文件得到的错误

错误

*The following classes cannot be found:
android.support.v7.widget.RecyclerView
android.support.v4.widget.DrawerLayout
android.support.v7.widget.Toolbar*

a) Android Studio 版本:1.2.1.1

b) 构建.gradle

apply plugin: 'com.android.application'

android {
compileSdkVersion 22
buildToolsVersion '22.0.1'

defaultConfig {
    applicationId "com.piserve.geejo.mskv4"
    minSdkVersion 15
    targetSdkVersion 22
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
   compile fileTree(include: ['*.jar'], dir: 'libs')
   compile 'org.lucasr.dspec:dspec:0.1.1'
   compile 'com.mcxiaoke.volley:library:1.0.+'
   compile 'com.android.support:appcompat-v7:22.1.1'
   compile 'com.android.support:recyclerview-v7:22.1.1'
}

c) Layout XML文件(其中之一)

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar 
   xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:app="http://schemas.android.com/apk/res-auto"
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   android:background="@color/color_primary"
   app:popupTheme="@style/ThemeOverlay.AppCompat.Dark"
   app:theme="@style/MyCustomToolbarTheme"
>

d) SDK 管理器截图

1

这是我尝试过的:

a) 将编辑器窗口中的主题更改为 Material 和 Holo 主题

b) 在 Android v21 和 v22 之间切换

c) 尝试了 Nexus 4-10 的不同模拟器

最佳答案

我遇到了完全相同的问题。没有一个解决方案对我有用,所以我不得不恢复到 Android Studio 1.1.0:http://tools.android.com/download/studio/canary/1-1-0

关于Android Studio - 使用支持库呈现 XML 文件的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30401050/

相关文章:

android - ADB 设备列表为空

android - 写入数据库时​​,注册后数据库仍然是空的。如何正确地将数据存储到我的数据库中?

android - 必须在主题中为 PreferenceFragmentCompat 指定 preferenceTheme

android - AdMob AdView 和 ViewPager?

android - Android 中的 onMeasure 返回大小包括填充和边距吗?

android - 而不是预览,Android Studio 只显示黑屏,上面写着 'android...ActionBarOverlayLayout'

java - 在 Android 的 GridView 中放置图像(从 URL 加载)和编辑文本框

android - 如何在 Android Dialog 中居中布局?

android - 空对象引用上的 Intent.migrateExtraStreamToClipData()

android - 如何使用 androidx/support Fragment 获取带有 level int 的 onTrimMemory 回调