unable to resolve class Project
@ line 29, column 1.
"resource": "/bg_geo/android/app/build.gradle",
"owner": "_generated_diagnostic_collection_name_#2",
"severity": 8,
"message": "unable to resolve class Project\n @ line 29, column 1.",
"source": "Gradle",
"startLineNumber": 29,
"startColumn": 1,
"endLineNumber": 29,
"endColumn": 2
Your Environment
Plugin version: flutter_background_geolocation: ^4.11.0
Platform: iOS or Android : Windows. Android changes
OS version: Windows 10
Device manufacturer / model:
Flutter info (flutter doctor
):
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.7.6, on Microsoft Windows [Version 10.0.19041.1415], locale en-US)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.8.6)
[√] Android Studio (version 2021.3)
[√] VS Code
[√] Connected device (4 available)
[√] HTTP Host Availability
• No issues found!
Plugin config:
// flutter_background_geolocation (must be placed after the lines above)
Project background_geolocation = project(':flutter_background_geolocation')
apply from: "${background_geolocation.projectDir}/background_geolocation.gradle"
Expected Behavior
Compile
Actual Behavior
Compilation error
Steps to Reproduce
Make changes to android/app/build.gradle suggested in the documentation
android/app/build.gradle.
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new Exception("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
// flutter_background_geolocation (must be placed after the lines above)
Project background_geolocation = project(':flutter_background_geolocation')
apply from: "${background_geolocation.projectDir}/background_geolocation.gradle"
android {
compileSdkVersion rootProject.ext.compileSdkVersion
// compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
kotlinOptions {
jvmTarget = '1.8'
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.bg_geo"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
targetSdkVersion rootProject.ext.targetSdkVersion
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
shrinkResources false
proguardFiles "${background_geolocation.projectDir}/proguard-rules.pro"
flutter {
source '../..'
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
android/build.gradle
buildscript {
ext.kotlin_version = '1.7.10'
ext {
compileSdkVersion = 33 // or higher
targetSdkVersion = 33 // or higher
appCompatVersion = "1.4.2" // or higher
playServicesLocationVersion = "20.0.0" // or higher
repositories {
google()
mavenCentral()
dependencies {
classpath 'com.android.tools.build:gradle:7.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
allprojects {
repositories {
google()
mavenCentral()
maven {
// [required] flutter_background_geolocation
url "${project(':flutter_background_geolocation').projectDir}/libs"
maven {
// [required] background_fetch
url "${project(':background_fetch').projectDir}/libs"
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
subprojects {
project.evaluationDependsOn(':app')
task clean(type: Delete) {
delete rootProject.buildDir
I have no idea what's wrong with your Gradle.
Open your your /android
folder with Android Studio and look for warnings.
in android/build.gradle
, change this line to 7.2.2
and follow any instructions (eg: [Sync now]
).
+ classpath 'com.android.tools.build:gradle:7.2.2'
Thanks a lot Greg! I appreciate your help!!