Android targetSdkVersion Upgrade to 35
Problem Statement
When upgrading your Android app's targetSdkVersion
from 34 to 35 in build.gradle.kts
, Android Studio displays a persistent message:
It looks like you just edited the targetSdkVersion from 34 to 35 in the editor. Be sure to consult the documentation on the behaviors that change as result of this. The Android SDK Upgrade Assistant can help with safely migrating.
Developers often wonder:
- Does this message indicate existing code problems?
- How can they locate potential issues?
- Why does Google reference the "Android SDK Upgrade Assistant" when it appears to be documentation rather than a tool?
Understanding the Upgrade Message
This is a standard informational message from Android Studio, not an error indication. Its purposes are:
Key Points
- Not a build error: Your app builds successfully because the message concerns runtime behavior, not compilation
- Preventative reminder: Alerts you to behavior changes in new Android versions
- Mandatory step: Required even when builds succeed to avoid unexpected runtime crashes
Android enforces new restrictions and behaviors with each API level. What worked in API 34 might break in API 35 due to:
- New permission requirements
- Background restrictions
- Security enhancements
- Deprecated API replacements
Step-by-Step Compatibility Verification
1. Review Official Behavior Changes
Consult Android 14 (API 35) documentation for key changes:
Critical areas for API 35 include:
- Foreground service requirements (new permission)
- Open file permissions (strict path access)
- Job scheduler throttling (background restrictions)
- Default app language preservation (per-app language settings)
2. Audit Code For Impacted Areas
Manually inspect your project for:
- Foreground service declarations
Uri
handling for file access- Jobs scheduled with
JobScheduler
/WorkManager
- Dynamic feature modules
Use Android Studio's Refactor > Migrate to Android 14 to flag code sections needing attention.
3. Test Rigorously
After documentation review and code adjustments, test on:
- Android 14 emulator (
AVD Manager
) - Physical device running Android 14
- Multiple app flow scenarios (background/foreground transitions)
Focus testing on:
- Features using
READ_EXTERNAL_STORAGE
/WRITE_EXTERNAL_STORAGE
- File sharing between apps (Intent.ACTION_OPEN_DOCUMENT)
- Background network operations
- Permission request flows
4. Resolve Build Warnings
After updating targetSdkVersion
, address all new deprecation warnings:
// build.gradle.kts
android {
compileSdk = "android-35"
defaultConfig {
targetSdk = 35 // Changed from 34
}
}
Use Analyze > Run Inspection by Name > Deprecated API Usage to locate outdated methods.
About Android SDK Upgrade Assistant
The Android SDK Upgrade Assistant is primarily documentation-driven guidance (not an automated tool):
Understanding Limitations
- ❌ Not automated code fixes
- ✅ Curated upgrade checklists
- ✅ Behavior change summaries
- ✅ Manual migration steps
Access it through Tools > SDK Manager > SDK Upgrade Assistant in Android Studio, or via the web documentation.
Post-Migration Message Removal
The warning disappears after:
- Completing compatibility verification
- Building the project successfully
- Restarting Android Studio
The message persists during editing to ensure you don't forget potential migration steps.
Best Practices Checklist
- [ ] Test pre-launch reports with API 35 in Play Console
- [ ] Monitor
StrictMode
violations during testing - [ ] Implement feature toggles for API-level-specific behavior
- [ ] Use
ContextCompat
/ActivityCompat
for backward compatibility
Example version-aware permission handling:
// Check for new foreground service permission in API 35
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
if (ContextCompat.checkSelfPermission(this,
Manifest.permission.FOREGROUND_SERVICE) != PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this,
new String[]{Manifest.permission.FOREGROUND_SERVICE}, REQUEST_CODE);
}
}
Conclusion
The targetSdkVersion 35
message is Android Studio's reminder to proactively address runtime behavior changes, not an indication of build errors. While apps may run initially, neglecting documentation review risks post-launch crashes on Android 14 devices. Always:
- Study the official behavior changes
- Audit relevant code sections
- Conduct version-specific testing
- Resolve deprecation warnings
The Android SDK Upgrade Assistant provides essential documentation even though it lacks automated fixes. The message will disappear after completing compatibility steps and restarting the IDE.