Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/179.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android Butterknife抛出java.lang.IllegalStateException,因为找不到视图(现在不存在)_Android_Android Studio_Butterknife - Fatal编程技术网

Android Butterknife抛出java.lang.IllegalStateException,因为找不到视图(现在不存在)

Android Butterknife抛出java.lang.IllegalStateException,因为找不到视图(现在不存在),android,android-studio,butterknife,Android,Android Studio,Butterknife,我用的是Butterknife 8.8.1。不幸的是,android studio抛出了一个IllegalStateException,因为找不到具有相应id(我通过重构菜单重命名了该id)的视图 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.aristo.nvn.aristo/com.aristo.nvn.aristo.EditorActivity}: java.lang.Ille

我用的是Butterknife 8.8.1。不幸的是,android studio抛出了一个IllegalStateException,因为找不到具有相应id(我通过重构菜单重命名了该id)的视图

         java.lang.RuntimeException: Unable to start activity ComponentInfo{com.aristo.nvn.aristo/com.aristo.nvn.aristo.EditorActivity}: java.lang.IllegalStateException: Required view 'add_color_rv' with ID 2131361821 for field 'mColorsRecyclerView' was not found. If this view is optional add '@Nullable' (fields) or '@Optional' (methods) annotation.
我重命名了add_color_rv id和变量mColorsRecyclerView以使用以下内容

@BindView(R.id.text_colors_rv) RecyclerView mTextColorsRecyclerView;
然后绑定onCreateView()

依赖关系-

implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'

开发我的第一个应用程序!救命啊。谢谢

这将帮助您防止崩溃:

@Nullable // use annotation from support library.
@BindView(R.id.text_colors_rv) 
RecyclerView mTextColorsRecyclerView;
注意:由于R文件更改,ButterKnife失去对视图id的引用,因此崩溃。然后考虑重建项目 部署apk


忘了在问题中提及。但是我做了。也检查了你的布局,recyclerview有id
text\u colors\u rv
我已经检查了所有的基本错误我不太清楚。请重新考虑例外情况。id&变量甚至不存在于我的代码中。这正是困扰我的问题。请尝试
清理重建项目请再次阅读引发的异常。它没有提到这个观点,但我会试试。谢谢
@Nullable // use annotation from support library.
@BindView(R.id.text_colors_rv) 
RecyclerView mTextColorsRecyclerView;