When i'm try to rebuild my project i get the error below:
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
When I check the class there're no unresolved references.
I'm using Gradle Version 3.3.1
I almost tried everything such as Invalidate Cache / Restart, Clean and Rebuild, Close and Reopen project, Reimport project, delete idea folder
etc but none of them worked.
Thanks for your help.
It's probably because you have not made a build since adding the field, BuildConfig
and other variables/properties declared in a Gradle file will only be available AFTER a successful build. The following instructions will fix this:
Build -> Clean Project
Build -> Rebuild Project
(comment any lines that cause compiler errors for now!)Alt + Enter (Windows/Linux) or Option + Enter (macOS)
on BuildConfig
in your code and select Import...
from suggested solutions.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With