-
Notifications
You must be signed in to change notification settings - Fork 0
Cannot resolve symbol 'ProductFlavor'
Snoy-Kuo edited this page Mar 17, 2022
·
2 revisions
Cannot resolve symbol 'ProductFlavor'
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.
- 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
-
Android Studio 出现“Cannot resolve symbol” 解决办法
- Invalidate caches / restart
- sync proj with gradle files.
- modify dependencies libs version -> sync
- delete /username/.gradle folder
=> none of the above approaches works for me. - comment out dependencies libs -> sync -> uncomment -> sync
=> It works!
-
Cannot resolve symbol 'File' in settings.gradle
- modify jdk version
=> not work for me.
- modify jdk version
- Update Gradle version
- update from 4.10.1 to 4.10.3
=> not work for me.
- update from 4.10.1 to 4.10.3
- Update Android Gradle Plugin version
- update from 3.2.1 to 3.3.3
=> not work for me.
- update from 3.2.1 to 3.3.3
- Remove the type casting to ProductFlavor.
- When def productFlavor variables, it does not need type casting, still work fine.
=> It works!
- When def productFlavor variables, it does not need type casting, still work fine.
- comment out dependencies libs -> sync -> uncomment -> sync
- Comment out
import com.android.build.gradle.internal.dsl.ProductFlavorand sync, then uncomment code and sync again. Ta-da! the error just disappear.
- Comment out
- Remove the type casting to ProductFlavor.
- When def productFlavor variables, it does not need type casting, still work fine.