gpt4 book ai didi

android - Unresolved reference BuildConfig

转载 作者:行者123 更新时间:2023-12-04 23:38:51 24 4
gpt4 key购买 nike

当我尝试重建我的项目时,出现以下错误:

warning: flag is not supported by this version of the compiler: -Xallow-no-source-files
warning: flag is not supported by this version of the compiler: -Xjava-source-roots=/Users/tyln/AndroidStudioProjects/PhoneBox/base/navigation/build/generated/source/buildConfig/dev/debug
base/navigation/src/main/java/com/raqun/phonebox/navigation/IntentLoader.kt:7:9: error: unresolved reference: BuildConfig
BuildConfig.PACKAGE_NAME,
^

> Task :base:navigation:compileDevDebugKotlin FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':base:navigation:compileDevDebugKotlin'.
> Compilation error. See log for more details

当我检查类(class)时,没有 Unresolved 引用。

我正在使用 Gradle 版本 3.3.1

我几乎尝试了一切,例如 Invalidate Cache / Restart, Clean and Rebuild, Close and Reopen project, Reimport project, delete idea folder等,但他们都没有工作。

谢谢你的帮助。

最佳答案

这可能是因为您在添加字段 后尚未构建。 BuildConfig以及 Gradle 文件中声明的其他变量/属性仅在成功构建后可用 .以下说明将解决此问题:

  • Build -> Clean Project
  • Build -> Rebuild Project (现在评论任何导致编译器错误的行!)
  • Alt + Enter (Windows/Linux) or Option + Enter (macOS)BuildConfig在您的代码中并选择 Import...从建议的解决方案。
  • 关于android - Unresolved reference BuildConfig,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59120296/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com