[英]Resource in layout xml but compiler error with “not found”
I have had some success with trying to get a sound synthesizer app to work. 我在尝试使声音合成器应用程序运行方面取得了一些成功。 It worked fine on simulator, but always crash on the 8th time on my mobile phone ( OS 7.0 , simulator OS 6.0 , API level 21 , or OS 5.0 ). 它在模拟器上工作正常,但总是在我的手机( OS 7.0 ,模拟器OS 6.0 , API级别21或OS 5.0 )上第八次崩溃。 The error message was convoluted. 错误消息被弄乱了。 I only remember the red-highlighted lines with "AudioFlinger"
, and an error code with "AudioTrack"
and "-20"
. 我只记得带有"AudioFlinger"
的红色突出显示行,以及带有"AudioTrack"
和"-20"
的错误代码。
I saw some advices here about changing the API level of the app to 21, but Android Studio only did 22, so that was what I changed. 在这里,我看到了一些有关将应用程序的API级别更改为21的建议,但是Android Studio仅将22更改了,这就是我所做的更改。 And that corrupted the whole thing. 这破坏了整个事情。 I am getting AAPT
error on compile. 我在编译时遇到AAPT
错误。 The thing will not even start the emulator for try-run. 事情甚至不会启动模拟器进行试运行。
So I scrapped the whole thing, copy out the source codes (and layouts and other resources) and started a new project fresh, and copied back these files. 因此,我废弃了整个内容,复制了源代码(以及布局和其他资源),并重新启动了一个新项目,然后将这些文件复制回去。
Now again, there is a compile error. 现在再次出现编译错误。 There are multiple objects on XML that the Java source code reference to. Java源代码引用XML上有多个对象。 All those lines with R.id.textview
. 所有这些行都带有R.id.textview
。 All the "R"
are now red with error, with the error message, 现在,所有"R"
都为红色,并带有错误消息和错误消息,
error: resource style/Base.V26.Widget.AppCompat.Toolbar not found. 错误: 找不到资源样式/Base.V26.Widget.AppCompat.Toolbar。
This seems to be something completely "background" issue that I have no idea how to resolve, nor can I find solutions here. 这似乎是完全“背景”的问题,我不知道如何解决,也无法在这里找到解决方案。 Any help is greatly appreciated. 任何帮助是极大的赞赏。
This can cause trouble when there is a need to make new files, so clearing 'caches will clear the oldcache` and make Android Studio faster. 当需要制作新文件时,这可能会引起麻烦,因此清除“缓存将清除oldcache”,并使Android Studio更快。 Going to Build > Clean Project 进行构建>清理项目
清理您的项目或重建并重新启动android studio
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.