Skip to content

Cannot resolve symbol 'ProductFlavor'

Snoy-Kuo edited this page Mar 17, 2022 · 2 revisions

Messages

Cannot resolve symbol 'ProductFlavor'

Description

The Android Studio project can build and run, but got error of 'ProductFlavor'.
This happened when using com.android.build.gradle.internal.dsl.ProductFlavor in gradle files.

Dev env

  • macOS 11.6 (Big Sur) x64
  • Android Studio Bumblebee Patch 1
  • Android SDK version 27
  • buildTool: 28.0.3
  • Android Gradle Plugin: 3.3.3
  • Gradle: 4.10.3
  • Gradle JDK: corretto-1.8
  • Kotlin: 1.3.72

Tried approaches

Solution

  • comment out dependencies libs -> sync -> uncomment -> sync
    • Comment out import com.android.build.gradle.internal.dsl.ProductFlavor and sync, then uncomment code and sync again. Ta-da! the error just disappear.