eclipse 无法构建 actionbarsherlock:BuildConfig 无法解析为变量

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16620387/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 20:31:33  来源:igfitidea点击:

Cannot build actionbarsherlock: BuildConfig cannot be resolved to a variable

androideclipseactionbarsherlockadtandroid-build

提问by Ilya Kogan

I imported the actionbarsherlock folder into the workspace using "Import -> Existing Android Code Into Workspace". Then I ensured the following:

我使用“Import -> Existing Android Code Into Workspace”将 actionbarsherlock 文件夹导入到工作区。然后我确保了以下几点:

  • In the manifest:

    <uses-sdk android:minSdkVersion="7" android:targetSdkVersion="16"/>

  • Properties -> Android: Build target is API 16 (Android 4.1.2) and IsLibrary is checked.

  • Properties -> Java Compiler: Compiler compliance level is set to 1.6.

  • 在清单中:

    <uses-sdk android:minSdkVersion="7" android:targetSdkVersion="16"/>

  • 属性 -> Android:构建目标是 API 16 (Android 4.1.2) 并检查 IsLibrary。

  • 属性 -> Java 编译器:编译器合规性级别设置为 1.6。

And yet I'm getting a lot of BuildConfig cannot be resolved to a variableerrors.

然而,我收到了很多BuildConfig cannot be resolved to a variable错误。

I tried to clean all projects many times, and even restarted Eclipse several times. I even tried to add a BuildConfig class manually, but then there were still a lot of R cannot be resolved to a variableerrors that I could not resolve.

我多次尝试清理所有项目,甚至多次重新启动 Eclipse。我什至尝试手动添加一个 BuildConfig 类,但是仍然有很多R cannot be resolved to a variable我无法解决的错误。

I've read dozens of answers (such as this one: R cannot be resolved error when using ActionBarSherlock), but nothing helps. Any help will be much appreciated.

我已经阅读了几十个答案(例如这个:使用 ActionBarSherlock 时无法解决 R 错误),但没有任何帮助。任何帮助都感激不尽。

回答by Ilya Kogan

Strangely enough, the problem was that I skipped MIPS System Image the last time I updated components in the Android SDK Manager. Now I updated MIPS System Image from revision 2 to 4, and everything builds fine.

奇怪的是,问题是我上次更新 Android SDK 管理器中的组件时跳过了 MIPS 系统映像。现在我将 MIPS 系统映像从修订版 2 更新到 4,并且一切正常。

I don't even use MIPS, but maybe there was some strange compatibility issue.

我什至不使用 MIPS,但也许存在一些奇怪的兼容性问题。

回答by Cameron Ketcham

I had the same problem. When I went back to the Android SDK Manager it showed me that I could update Android SDK Platform-tools and Android SDK Build-tools to version 17. That fixed the problem for me.

我有同样的问题。当我回到 Android SDK Manager 时,它显示我可以将 Android SDK Platform-tools 和 Android SDK Build-tools 更新到版本 17。这为我解决了问题。

回答by Name is carl

Strangely enough, this issue gets fixed when I add old flavors of Android SDK build tools: 18.x and 17.x

奇怪的是,当我添加旧版本Android SDK build tools:18.x 和 17.x时,这个问题得到了解决

(For some reason, I uninstalled some of those)

(出于某种原因,我卸载了其中一些)

enter image description here

enter image description here