以下类无法实例化android.support.v7.widget.AppCompatTextView

Eco*_*dly 10 android android-appcompat android-xml build.gradle android-gradle-plugin

以下是build.gradle(app)的依赖项

compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', 
{
    exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.firebaseui:firebase-ui-auth:2.3.0'
compile 'com.android.support:appcompat-v7:26.0.1'
compile 'com.android.support:design:26.0.1'
compile 'com.android.support:support-vector-drawable:26.0.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
Run Code Online (Sandbox Code Playgroud)

这是build.gradle(Project)的一部分

allprojects {
    repositories {
        jcenter()
        maven { url "https://maven.google.com" }
    }
}
Run Code Online (Sandbox Code Playgroud)

当我要访问任何xml文件时,它显示错误**以下类无法实例化:

 android.support.v7.widget.AppCompatTextView(Open Class,Show Exception,Clear Cache)**

我已将Android Studio更新到最新版仍显示错误.

我无法弄清楚问题.谢谢

Lal*_*dar 24

编辑

每当您添加maven存储库时,都会出现此问题.
看到同样的错误我正面对我朋友在这里提出的一个问题,因为我不能问.

这可以通过在res - > values中更改AppTheme来解决 - > Styles.xml从中更改主题

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
Run Code Online (Sandbox Code Playgroud)

<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
Run Code Online (Sandbox Code Playgroud)

它解决了我的问题,不要忘记实际的答案.


Nam*_*ita 3

styles.xml

将主题从 更改为Theme.AppCompat.Light.DarkActionBarBase.Theme.AppCompat.Light.DarkActionBar我有用。

信用转到:/sf/answers/3177935631/