Skip to content
Back to skills

Android Sdk Knowledge Patch

ASecurity

Android SDK

  • 25 stars
  • 0 votes
  • 1 copy
  • 14 views
  • Added September 5, 2026
developmentgojavakotlintestingapisecurity

Works with

  • api

Security analysis

A100/100

Pro scans all 9 files and shows the line behind each finding

Scanned December 1, 2026

npx -y skills add Nevaberry/nevaberry-plugins --skill android-sdk-knowledge-patch --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Android Sdk Knowledge Patch?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Android Sdk Knowledge Patch
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nevaberry-android-sdk-knowledge-patch-nevaberry-plugins/badge)](https://www.skillsdirectory.com/skills/nevaberry-android-sdk-knowledge-patch-nevaberry-plugins)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: android-sdk-knowledge-patch
description: Android SDK
version: null
license: MIT
metadata:
  author: Nevaberry
---


# Android SDK Compatibility Guidance

Load this skill when migrating Android app behavior, build logic, device
integrations, or Google Play target API compliance. Use the topic references
for complete conditions, migration details, and code examples.

## Reference index

| Reference | Topics |
| --- | --- |
| [Build toolchain](references/agp-build-toolchain.md) | AGP requirements, Kotlin, public DSL, Variant API, defaults, R8, keep rules, desugaring, mappings |
| [Background work](references/background-work-and-lifecycle.md) | Job quotas, completion, audio lifecycle, activity launches, memory limits, profiling, alarms |
| [Devices and media](references/devices-bluetooth-camera-and-media.md) | Bluetooth, companion devices, handoff, ranging, camera sessions, codecs, audio routes |
| [Networking and security](references/networking-security-and-native-code.md) | LAN access, TLS, cleartext, intents, native code, GPU/NPU access, Keystore, signing |
| [Platform and UI](references/platform-ui-and-runtime.md) | Large screens, virtual displays, recreation, input, accessibility, reflection, widgets, windows |
| [Play publishing](references/play-publishing-policy.md) | Submission floors, existing-app availability, TV caveat, extension deadline, exceptions |
| [Privacy and data](references/privacy-permissions-and-data.md) | Health and location permissions, selected media, URI grants, SMS OTPs, passwords, contacts |

## Build migration and removed APIs

### Public DSL and Kotlin modules

AGP 9.0 exposes the public DSL by default. Move `applicationVariants`,
`libraryVariants`, `testVariants`, and `unitTestVariants` to
`androidComponents.onVariants`. Move `variantFilter` to
`androidComponents.beforeVariants` with a variant selector.

If a third-party plugin still needs the legacy DSL, use `android.newDsl=false`
in `gradle.properties`. Also disable built-in Kotlin if still applying the
incompatible `org.jetbrains.kotlin.android` plugin.

With the AGP 9 public DSL, migrate Android targets in Kotlin Multiplatform
modules to `com.android.kotlin.multiplatform.library`. Move the Android app to
a separate Gradle module if it shares one with `org.jetbrains.kotlin.multiplatform`.

AGP 9.4 supports per-module migration through `android.newDsl.optOut` in
`gradle.properties`. The AGP 10 roadmap makes the public DSL and built-in Kotlin
mandatory and removes the global switches. To check compatibility on AGP 9.x,
set `android.newDsl=true` and `android.builtInKotlin=true` and clear module-specific
DSL opt-outs.

### Convention plugins and generated sources

In AGP 9.0, remove type arguments from `CommonExtension`. Its block methods move
to `ApplicationExtension`, `LibraryExtension`, `DynamicFeatureExtension`, and
`TestExtension`; use the property getter for shared configuration to retain
binary compatibility with earlier AGP versions.

The `AndroidSourceSet` DSL rejects providers for generated sources by default.
Register task-produced directories with `addGeneratedSourceDirectory` on the
relevant `variant.sources` entry in `androidComponents.onVariants`.

The AGP 10.0 roadmap removes `registerJavaGeneratingTask()` and
`registerResGeneratingTask()`; use the Sources API entry for the source kind.
It also removes legacy variant `buildConfigField()` and `resValue()` methods.
In a module that generates `BuildConfig`, set per-variant fields through
`variant.buildConfigFields`.

### Defaults that affect existing builds

In AGP 9.0, apps and tests with unset `targetSdk` inherit `compileSdk`.
Java source and target compatibility defaults move from Java 8 to Java 11;
pin those values explicitly if the project depends on the earlier defaults.

An Android library defaults its consumers' minimum `compileSdk` to its own
compile SDK. Set `minCompileSdk` under `android.defaultConfig.aarMetadata`
to support consumers still on an older API.

App code compiles against a non-final `R` class by default. Rewrite Java
`switch` cases using resource IDs as `if` comparisons. Modules defining resource
values need `android { buildFeatures { resValues = true } }`.

### R8 rules and shrinking

In AGP 9.0, missing keep files declared in the build DSL fail the build.
Use `getDefaultProguardFile("proguard-android-optimize.txt")` in place of
`proguard-android.txt`; put app-specific overrides in a custom rules file.

Library and feature publishing rejects global consumer-rule options such as
`-dontoptimize` and `-dontobfuscate`. Move required options into application
rules. For prebuilt dependencies, inspect the app variant's `configuration.txt`
for `# REMOVED CONSUMER RULE:` entries.

Strict full-mode keep rules require an explicit constructor member when a rule
keeps a class whose no-argument constructor is accessed indirectly:

```proguard
-keep class com.example.EntryPoint { <init>(); }
```

Optimized resource shrinking is enabled by default when resource shrinking runs.
Remove `android.r8.integratedResourceShrinking` and
`android.enableNewResourceShrinker.preciseShrinking`; both cause a build error.

In AGP 9.2, wildcard `-keepattributes` patterns such as `*Annotation*` no longer
match runtime-invisible annotations. Name each needed attribute explicitly.
The build reference contains the attribute names and examples.

## Platform behavior and permission migrations

### Local networks

On Android 16, local-network protection testing is opt-in. Enable
`RESTRICT_LOCAL_NETWORK` with the command in the networking reference and reboot.
The test applies within the app process, including native sockets, host-app
WebView traffic, and multicast; out-of-process operations through APIs such as
`NsdManager` are exempt during this phase. Declare
`android.permission.NEARBY_WIFI_DEVICES` and grant Nearby devices access in
Settings to restore LAN access while the test is enabled.

Apps targeting API 37 or higher must declare and request
`android.permission.ACCESS_LOCAL_NETWORK` for direct LAN discovery and
connections. It belongs to `NEARBY_DEVICES`, so an existing group grant avoids
another prompt. System-mediated device pickers can provide access without
requesting the permission.

### Large screens and recreation

At target API 36, Android 16 ignores fixed portrait or landscape settings,
resizability, and aspect ratio limits in full-screen and multi-window on displays
at least `sw600dp`. Exceptions apply to games declared via `android:appCategory`
and users choosing the app's default aspect ratio behavior.

`android.window.PROPERTY_COMPAT_ALLOW_RESTRICTED_RESIZABILITY` retains
compatibility mode through target API 36 when applied inside an `<activity>` or
`<application>`. It loses its effect at target API 37.

Android 17 stops recreating activities by default for changes to keyboard,
keyboard visibility, navigation, touchscreen, or color mode, and for `uiMode`
transitions into or out of desk mode. If an activity relies on recreation to
reload resources for these events, opt in with `android:recreateOnConfigChanges`.

After an unhandled configuration change, Android 17 uses default IME visibility.
To show the keyboard after recreation, set
`android:windowSoftInputMode="stateAlwaysVisible"` or request it in `onCreate()`.

### Jobs and background audio

On Android 16, regular and expedited jobs consume runtime quota in the active
standby bucket, while a foreground service runs, and after leaving the top state
if the job started there. Check `JobScheduler.getPendingJobReasonsHistory` for
jobs yet to run, and `JobParameters.getStopReason()` or `WorkInfo.getStopReason()`
for stopped jobs.

Keep a strong reference to `JobParameters` for asynchronous work and pass them
to `jobFinished` on completion. Android 16 reports `STOP_REASON_TIMEOUT_ABANDONED`
when a job times out after its parameters were collected before completion was
signaled; repeated abandonment can reduce how often jobs run.

On Android 17, playback and volume changes outside an eligible lifecycle fail
silently, and audio focus returns `AUDIOFOCUS_REQUEST_FAILED`. At target API 37
or higher, background audio requires a running foreground service plus either
while-in-use capabilities or exact alarm permission for a stream using `USAGE_ALARM`.

### Health, media, and SMS access

At target API 36, APIs that required `BODY_SENSORS` or `BODY_SENSORS_BACKGROUND`,
including heart-rate sensors and health foreground services, require the
corresponding `android.permission.health` permissions. Mobile apps must declare
an activity displaying the privacy policy to retain the granular grants.

On Android 16, limited photo/video access for apps targeting API 36 or higher
preselects app-owned media in the picker. Deselecting it revokes the app's access.

On Android 17, unverified WebOTP recipients face a three-hour delay regardless
of target SDK. At target API 37 or higher, standard SMS OTPs also face the delay
for most apps. The system withholds `SMS_RECEIVED_ACTION` and filters SMS provider
queries during the delay; migrate code extraction to SMS Retriever or SMS User Consent.

### Native code and Bluetooth reads

For apps targeting API 37 or higher, `System.load()` throws `UnsatisfiedLinkError`
if the native library file is writable.

At target API 37 or higher, an RFCOMM `BluetoothSocket` input stream returns `-1`
when the socket closes or drops. Exit the read loop on `-1` even if it already
handles `IOException`.

## Play submission and availability

From August 31, 2026, most new apps and updates must target API 36 or higher;
Wear OS and Android Automotive OS require API 35. Android XR requires API 34
from that date, and Android TV has required API 34 since August 31, 2025.

Existing-app availability has separate floors in the Play reference. Below the
applicable floor, new users can install only on devices running an OS at or below
the app's target API level. Previous installers can still find, reinstall, and
use the app on any supported OS version.

For existing Android TV apps, availability and TV-specific guidance list API 33
as sufficient, while the opening summary includes API 33 TV apps among those
with restricted availability. Check **Policy status** in Play Console before
relying on API 33.

## Frequently used features and diagnostics

### R8 analysis and keep-rule source sets

For AGP 9.3.1, run `./gradlew :app:analyzeReleaseR8Config` to generate the
variant-specific R8 configuration report without completing APK or app bundle
compilation. Place `.keep` files under `src/<variant>/keepRules/`, for example
`src/release/keepRules/app.keep`. App and library modules can use these source
sets with either optimization DSL; Kotlin Multiplatform modules can use them
for consumer keep rules.

### Platform APIs

On Android 17, `AlarmManager.setExactAndAllowWhileIdle` has an overload accepting an
`OnAlarmListener` for direct callbacks during Doze or Battery Saver.

On Android 17, the system-rendered location button can be embedded through Jetpack and grants
precise location for the current session when tapped. It requires `USE_LOCATION_BUTTON`.

Android 17 adds a Handoff API through `CompanionDeviceManager` to resume app state
on another device. `CameraCaptureSession.updateOutputConfigurations()` changes
outputs when switching use cases without closing the session.

On Android 17, `ProfilingManager` adds `COLD_START`, `OOM`, and `KILL_EXCESSIVE_CPU_USAGE` triggers
for cold starts, out-of-memory events, and kills for excessive CPU use.

Files in this skill

  • SKILL.md9.4 KB
  • coverage.json771 B
  • references/agp-build-toolchain.md8 KB
  • references/background-work-and-lifecycle.md3.7 KB
  • references/devices-bluetooth-camera-and-media.md2.7 KB
  • references/networking-security-and-native-code.md3.9 KB
  • references/platform-ui-and-runtime.md3.8 KB
  • references/play-publishing-policy.md1.3 KB
  • references/privacy-permissions-and-data.md2.2 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.