Experience Upgrading Flutter Project to Target API 35: Following Latest Play Store Requirements

Complete guide to upgrade Flutter project to target API 35 to meet the latest Google Play Store requirements starting August 2025.

Tags:
  • #Flutter
  • #Android
  • #API 35
  • #Google Play Store
  • #Mobile Development
  • #Upgrade Guide
Learning Path: Not Found | Category: Mobile Development

Starting August 2025, Google Play requires all new apps & updates to target API level 35 (Android 15). Here’s my experience upgrading Flutter projects to meet the latest Play Store requirements.

🔧 Main Changes

1. Update compileSdkVersion & targetSdkVersion

In file android/app/build.gradle:

android {
    compileSdkVersion 35  // Previously: 34 or older
    
    defaultConfig {
        targetSdkVersion 35  // Previously: 34 or older
        // ... other configs
    }
}

2. Configuration for Flutter Local Notifications (If Used)

⚠️ Important Note: This step is only required if your project uses the flutter_local_notifications plugin. If you don’t use this plugin, skip to step 3.

A. Add Core Library Desugaring

In file android/app/build.gradle:

android {
    compileSdkVersion 35
    
    compileOptions {
        coreLibraryDesugaringEnabled true
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    
    defaultConfig {
        targetSdkVersion 35
        minSdkVersion 21  // Ensure minimum SDK 21 or higher
        // ... other configs
    }
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:2.0.4"
}

B. Update Permissions for Notifications

In file android/app/src/main/AndroidManifest.xml:

<!-- Existing notifications permissions -->
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.VIBRATE" />

<!-- Required for API 35+ -->
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />

And update service configuration:

<application>
    <!-- ... existing config ... -->
    
    <receiver android:exported="false" android:name="com.dexterous.flutterlocalnotifications.ActionBroadcastReceiver" />
    <receiver android:exported="false" android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver" />
</application>

3. Update Android Gradle Plugin

In file android/build.gradle:

dependencies {
    classpath 'com.android.tools.build:gradle:8.3.2'  // Update to latest version
    // ... other dependencies
}

4. Update Gradle Wrapper

In file android/gradle/wrapper/gradle-wrapper.properties:

distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip

5. Add Build Logger (Optional)

If you want to log Flutter/Dart version details during build to help new developers setup local environment, add this to android/build.gradle:

// BUILD LOGGER - For tracking environment versions
def buildId = UUID.randomUUID().toString().substring(0, 8)
def buildStartTime = new Date()
def buildStatus = "SUCCESS"
def hasLoggedThisBuild = false

gradle.taskGraph.afterTask { task, state ->
    if (state.failure) {
        buildStatus = "FAILED"
    }
    
    def mainTasks = ['assembleRelease', 'assembleDebug', 'bundleRelease', 'bundleDebug']
    
    if (task.name in mainTasks && !hasLoggedThisBuild) {
        def endTime = new Date()
        def duration = (endTime.time - buildStartTime.time) / 1000
        
        def pubspec = new File("${rootDir.parent}/pubspec.yaml")
        def versionLine = pubspec.readLines().find { it.startsWith("version:") }
        def appVersion = versionLine?.replace("version:", "")?.trim() ?: "unknown"
        def flutterVersion = "flutter --version".execute().text.trim()
        def logFile = new File("${rootDir.parent}/build_history.md")
        
        if (!logFile.exists()) {
            logFile.text = "# Build History\n\n"
        }
        
        def buildLog = """
## Build ${buildId}
- **App Version:** ${appVersion}
- **Date:** ${endTime.format("dd/MM/yyyy HH:mm:ss")}
- **Build Type:** ${task.name}
- **Duration:** ${duration}s
- **Status:** ${buildStatus}
- **Flutter Version:** ${flutterVersion.split('\n')[0]}

---
"""
        
        logFile.text = buildLog + logFile.text
        hasLoggedThisBuild = true
    }
}

🚨 Things to Note

  1. Backup your project before upgrading
  2. Test on various Android devices after upgrade
  3. Watch for breaking changes in dependencies you use
  4. Update all plugins to latest versions that support API 35
  5. Core library desugaring is only needed if using certain plugins like flutter_local_notifications

💡 Troubleshooting Tips

🎯 Conclusion

Upgrading to API 35 is very straightforward for most Flutter projects - just update compileSdkVersion and targetSdkVersion to 35. Additional configurations like core library desugaring are only needed if using certain plugins that require Java 8+ features.

The most important thing is thorough testing after upgrade to ensure all features still work properly.

📚 References


This article is based on experience upgrading production Flutter projects to target API 35. If you have questions or other issues, feel free to discuss!

Logo Adib

© 2025 Adib

GitHub