在为Android ICS创建项目时出现渲染错误

时间:2015-07-13 17:41:51

标签: android android-studio

我正在转向Android工作室。我为android ICS sdk创建了一个空白活动。

配置应用程序的所有启动向导后。我在布局文件视图中遇到构建错误。

查看布局文件我收到错误消息:

Rendering Problems Rendering failed with a known bug. Please try a rebuild.  The following classes could not be instantiated:
- android.support.v7.widget.Toolbar (Open Class, Show Exception, Clear Cache)
 Tip: Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE  Exception Details java.lang.NoSuchFieldError: View_theme   at android.support.v7.internal.widget.ViewUtils.themifyContext(ViewUtils.java:124)   at android.support.v7.widget.Toolbar.<init>(Toolbar.java:198)   at android.support.v7.widget.Toolbar.<init>(Toolbar.java:192)   at java.lang.reflect.Constructor.newInstance(Constructor.java:526)   at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:806)   at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)   at android.view.LayoutInflater.rInflate(LayoutInflater.java:782)   at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:809)   at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)   at android.view.LayoutInflater.rInflate(LayoutInflater.java:782)   at android.view.LayoutInflater.inflate(LayoutInflater.java:504)   at android.view.LayoutInflater.inflate(LayoutInflater.java:414)   at com.android.layoutlib.bridge.bars.BridgeActionBar.<init>(BridgeActionBar.java:84)   at com.android.layoutlib.bridge.bars.AppCompatActionBar.<init>(AppCompatActionBar.java:56) Copy stack to clipboard  Failed to find the style corresponding to the id 2147418120 (3 similar errors not shown) 

以下是build.gradle的内容(模块:应用)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "ec.ys.com.counter"
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.1.1'
}

0 个答案:

没有答案