无法实例化以下类:-android.support.design.widget.BottomNavigationView

时间:2019-01-30 11:09:31

标签: android xml android-layout bottomnavigationview

我正在处理Android版本28,Firebase 16。

实现bottomNavView会返回以下错误:

The following classes could not be instantiated: 
- android.support.design.widget.BottomNavigationView

我尝试将AppTheme样式更改为Base.Theme,但没有解决。

我的gradle应用程序:

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.android.support:animated-vector-drawable:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'

//add library
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.google.firebase:firebase-database:16.0.6'
implementation 'com.rengwuxian.materialedittext:library:2.1.4'



}

apply plugin: 'com.google.gms.google-services'

我的style.xml文件

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

我的gradle项目:

classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.2.0'

1 个答案:

答案 0 :(得分:0)

尝试转到“文件->使高速缓存无效/重新启动”,然后使无效并重新启动,这可能会有帮助。