【问题标题】:The following classes could not be instantiated: - android.support.design.widget.BottomNavigationView无法实例化以下类:- android.support.design.widget.BottomNavigationView
【发布时间】:2019-06-23 15:39:49
【问题描述】:

我正在处理 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>

我的毕业项目:

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

【问题讨论】:

  • 发布完整的错误日志。
  • @KaranMer 你确定我可以在这里发帖吗?因为日志太长了,没有以红色突出显示。
  • 您可以使用日志输出编辑您的问题
  • @KaranMer 非常感谢你们。我刚刚更新了android studio,它工作了!但我不知道为什么这是一个错误。我猜是一个错误?

标签: android xml android-layout bottomnavigationview


【解决方案1】:

尝试转到“文件->使缓存无效/重新启动”并使无效并重新启动,也许这会有所帮助。

【讨论】:

  • 非常感谢。我刚刚更新了android studio,它工作了!但我不知道为什么这是一个错误。我猜是一个错误?
  • 我不确定是什么问题,ide 存储了一些缓存,可能那里出了问题。如果我有任何 ide 无法理解或找不到类的错误(如果我知道这不是我的错误),我总是清理项目,使缓存无效并将项目与 gradle 同步。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2017-03-30
  • 2016-06-13
  • 2017-05-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多