设计模式获得异常

时间:2018-04-09 15:54:30

标签: android android-studio

我已更新到Android-Studio 3.0.1但是当我尝试在设计模式下工作时出现此错误

 The following classes could not be instantiated:
- android.support.v7.widget.AppCompatImageView (Open Class, Show Exception, Clear Cache)
- android.support.design.widget.CoordinatorLayout (Open Class, Show Exception, Clear Cache)
- android.support.design.widget.AppBarLayout (Open Class, Show Exception, Clear Cache)
- android.support.design.widget.CollapsingToolbarLayout (Open Class, Show Exception, Clear Cache)
- android.support.design.widget.FloatingActionButton (Open Class, Show Exception, Clear Cache)
- android.support.v7.widget.Toolbar (Open Class, Show Exception, Clear Cache)
- android.support.v7.widget.AppCompatImageButton (Open Class, Show Exception, Clear Cache)
- android.support.v4.widget.NestedScrollView (Open Class, Show Exception, Clear Cache)
- android.support.v7.widget.AppCompatEditText (Open Class, Show Exception, Clear Cache)
- android.support.v7.widget.AppCompatTextView (Open Class, Show Exception, Clear Cache)
- android.support.v7.widget.AppCompatSpinner (Open Class, Show Exception, Clear Cache)
- android.support.v4.widget.SwipeRefreshLayout (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.
  If this is an unexpected error you can also try to build the project, then manually refresh the layout.
  Exception Details java.lang.ClassNotFoundException: android.support.v4.view.TintableBackgroundView

我已经尝试过重新加载,重新同步,重建。使用不同的sdk版本来推动视图

这是一个屏幕保护程序

enter image description here

修改 main.xml的源代码

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.SwipeRefreshLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:context=".Activities.Acty_Main"
    tools:showIn="@layout/main_acty"
    android:id="@+id/swiperefresh">
    <android.support.v4.widget.NestedScrollView
        app:layout_behavior="@string/appbar_scrolling_view_behavior"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/nest"
        android:background="@color/mailReadBack">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"
            android:id="@+id/mainView">
                 <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:id="@+id/lay_ContactList"
                    android:orientation="vertical"/>
            <LinearLayout
                android:orientation="horizontal"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:padding="5dp"
                android:id="@+id/loading">
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:id="@+id/prgBar"
                    android:text="@string/loding" />
            </LinearLayout>
        </LinearLayout>
    </android.support.v4.widget.NestedScrollView>
</android.support.v4.widget.SwipeRefreshLayout>

这是我的build.gradle

apply plugin: 'com.android.application'
android {
    compileSdkVersion 27
    buildToolsVersion '27.0.1'
    defaultConfig {
        applicationId "com.casa.myapp"
        minSdkVersion 14
//        targetSdkVersion 23
        targetSdkVersion 27
        versionCode 1
        versionName "1"
    }
    buildTypes {
        release {
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            debuggable false
            minifyEnabled true
            shrinkResources true
        }
        debug {
            applicationIdSuffix 'devs'
            versionNameSuffix '.devs'
            debuggable true
//            minifyEnabled true
//            shrinkResources true
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    productFlavors {
    }
}
dependencies {
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    compile fileTree(include: ['*.jar'], dir: 'libs')
    //    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:24.0.0-alpha2'
    compile 'com.google.android.gms:play-services-appindexing:8.4.0'
    compile 'com.android.support:design:24.0.0-alpha2'
    compile 'com.android.support:support-v4:24.0.0-alpha2'
}

我正在下载构建工具27.0.3,但我的网络连接很差,也许我的问题在于支持库

0 个答案:

没有答案