Skip to content
Back to skills

Android Sdk Knowledge Patch

ASecurity

Android SDK

  • 25 stars
  • 0 votes
  • 0 copies
  • 12 views
  • Added September 5, 2026
developmentgojavakotlintestingdebuggingapisecurity

Works with

  • api

Security analysis

A100/100

Pro scans all 8 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/badge)](https://www.skillsdirectory.com/skills/nevaberry-android-sdk-knowledge-patch)

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 adapting Android apps, build plugins, or publishing workflows
for changes to platform behavior, Android Gradle Plugin APIs, R8, or Play policy.
Use the topic references for complete conditions, exceptions, and code examples.

## Reference index

| Reference | Topics |
| --- | --- |
| [AGP toolchain and APIs](references/agp-toolchain-and-apis.md) | Toolchain requirements, Kotlin, public DSL, variant APIs, generated sources, module configuration |
| [R8, packaging, and testing](references/r8-packaging-and-testing.md) | Keep rules, optimization, retracing, packaging, runners, test components, aggregate reports |
| [Runtime, UI, and scheduling](references/runtime-ui-and-scheduling.md) | Job quotas, memory limits, large screens, configuration changes, input, widgets |
| [Security, networking, and data](references/security-networking-and-data.md) | LAN permissions, intent matching, URI grants, health, OTP, contacts, TLS, native access |
| [Bluetooth, media, and devices](references/bluetooth-media-and-devices.md) | Bond recovery, companion devices, audio lifecycle, camera, encoding, ranging |
| [Play target API policy](references/play-target-api-policy.md) | Submission and availability floors, exceptions, policy discrepancy, extension deadline |

## Breaking changes and deprecations

### Public DSL and variant hooks

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.

For a third-party plugin that still needs the legacy DSL, use `android.newDsl=false`.
Also disable built-in Kotlin if still applying `org.jetbrains.kotlin.android`.
AGP 9.4 supports a module-specific `android.newDsl.optOut` in `gradle.properties`.
The AGP 10 roadmap makes the public DSL and built-in Kotlin mandatory and removes
the global switches; compatibility checks on AGP 9.x also clear module DSL opt-outs.

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.

### Kotlin and generated sources

With the AGP 9 public DSL, migrate KMP Android targets to
`com.android.kotlin.multiplatform.library`. Move the Android application to a
separate module if it shares a module with `org.jetbrains.kotlin.multiplatform`.

With built-in Kotlin enabled globally, a module without Kotlin sources can set
`android { enableKotlin = false }` to omit the Kotlin compile task and standard-library
dependency. An AGP 9.x module still using `kotlin-android` during migration can also use this setting.

In AGP 9.0, `AndroidSourceSet` 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.

### Build defaults and module configuration

In AGP 9.0, an unset app or test `targetSdk` inherits `compileSdk`; Java source and
target compatibility default to Java 11. Pin these values if earlier defaults matter.
Libraries default their consumers' minimum `compileSdk` to their own compile SDK;
set `minCompileSdk` under `android.defaultConfig.aarMetadata` explicitly for consumers on an older API.

`android.uniquePackageNames` defaults to `true`. Give each library a distinct
package name, or use `android.uniquePackageNames=false` during migration.
App resource IDs are non-final by default; replace Java resource-ID `switch`
cases with `if` comparisons.

Enable `resValues = true` for modules defining resource values. Shader modules
require `shaders = true` and a compiler directory in `local.properties`.
Remove `android.defaults.buildfeatures.aidl` and
`android.defaults.buildfeatures.renderscript`; enable the corresponding feature
in each module's `android.buildFeatures` block.

### R8 rules and resource shrinking

In AGP 9.0, missing keep files declared in the build DSL fail the build.
Use `getDefaultProguardFile("proguard-android-optimize.txt")` instead of
`proguard-android.txt`; put app-specific overrides in a custom rules file.
Library and feature publishing reject consumer-rule global options such as
`-dontoptimize` and `-dontobfuscate`; move required options into application rules.

Strict full-mode keep rules require an explicit constructor member when keeping
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.
Remove `-addconfigurationdebugging`, which warns and no longer has an effect.

In AGP 9.2, wildcard `-keepattributes` patterns such as `*Annotation*` no longer
match runtime-invisible annotations. Name each required attribute explicitly.

### LAN access and cross-app permissions

On Android 16, local-network protection testing is opt-in and applies inside the
app process. 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.

At target API 37 or higher, declare and request `android.permission.ACCESS_LOCAL_NETWORK`
for direct LAN discovery and connections. An existing grant in `NEARBY_DEVICES`
avoids another prompt; system-mediated device pickers can provide access without
requesting the permission.

Android 17 can flag implicit URI grants ahead of their removal in Android 18.
Add `FLAG_GRANT_READ_URI_PERMISSION` to `ACTION_SEND` and `ACTION_SEND_MULTIPLE`,
and both read and write grant flags to `ACTION_IMAGE_CAPTURE`.
At target API 37 or higher, `IntentSender` is subject to background activity
launch restrictions; use a scoped opt-in when the launch should depend on caller visibility.

### Layout, activity recreation, and input

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`, with exceptions for games declared via `android:appCategory`
and users choosing the app's default aspect ratio behavior. The compatibility property
`android.window.PROPERTY_COMPAT_ALLOW_RESTRICTED_RESIZABILITY` loses effect at target API 37.

Android 17 stops recreating activities by default for keyboard, keyboard visibility,
navigation, touchscreen, color mode, and transitions into or out of desk mode.
Use `android:recreateOnConfigChanges` if resource reloading relies on recreation.
After an unhandled configuration change, IME visibility uses the default;
use `android:windowSoftInputMode="stateAlwaysVisible"` or request it in `onCreate()`
to show the keyboard after recreation.

### 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
pending work and `JobParameters.getStopReason()` or `WorkInfo.getStopReason()` for stopped work.

Keep a strong `JobParameters` reference for asynchronous work and pass it 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 job frequency.

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 needs a running foreground service plus either
while-in-use capabilities or exact alarm permission for a stream using `USAGE_ALARM`.

### Data and native-code compatibility

At target API 37 or higher, `System.load()` throws `UnsatisfiedLinkError` for a
writable native library file. On Android 17, attempts to write `static final`
fields at that target throw `IllegalAccessException` via reflection and crash
through JNI setters such as `SetStaticLongField()`.

On Android 17, unverified recipients of WebOTP messages face a three-hour delay
regardless of target SDK. At target API 37 or higher, the delay also applies to
standard SMS OTPs for most apps. Migrate code extraction to SMS Retriever or SMS User Consent.

### Play submissions and availability

From August 31, 2026, most new apps and updates must target API 36 or higher;
minimums are API 35 for Wear OS and Android Automotive OS, and API 34 for Android XR.
Android TV has required API 34 or higher for submissions since August 31, 2025.

Existing-app availability has separate floors and exceptions in the Play reference.
For Android TV, the availability and TV-specific sections list API 33 as sufficient,
but the opening summary includes API 33 TV apps among restricted apps. Check
**Policy status** in Play Console before relying on API 33.

## Features and diagnostics

### Optimization and reporting

In AGP 9.3.1, place an app module's `optimization` block inside a build type such as
`release`. Library module tests also support this DSL; enabling optimization
turns on code optimization and optimized resource shrinking together without
requiring an explicit default Android keep rules file.

Place `.keep` files under `src/<variant>/keepRules/`. KMP modules pick up consumer
keep rules from these source sets without explicit `consumerKeepRules.publish = true`.
Generate the R8 configuration report without completing APK or app bundle compilation:

```sh
./gradlew :app:analyzeReleaseR8Config
```

AGP 9.2 can generate experimental HTML reports aggregating unit and instrumentation
results and coverage across modules and build variants. Enable reporting tasks
with `android.experimental.reportAggregationSupport=true` in `gradle.properties`.

### Memory and companion diagnostics

Android 17 can enforce RAM-dependent app limits on supported devices. An affected
exit reports `ApplicationExitInfo.REASON_OTHER` and `MemoryLimiter:AnonSwap` in
`getDescription()`; profiling with `TRIGGER_TYPE_ANOMALY` can collect a heap dump.

On Android 17, `ACTION_PAIRING_REQUEST` includes `EXTRA_PAIRING_CONTEXT` for a
system-initiated re-pairing attempt; `ACTION_KEY_MISSING` is sent only if automatic
re-pairing fails. At target API 37 or higher, exit an RFCOMM input read loop on `-1`,
even if it already handles `IOException`.

### Session UI and camera APIs

The Android 17 system-rendered location button can be embedded through Jetpack;
it grants precise location for the current session when tapped and requires `USE_LOCATION_BUTTON`.
Interactive picture-in-picture supports interactive, always-on-top pinned windows
for desktop apps, requiring `USE_PINNED_WINDOWING_LAYER` and PiP permissions.

Use `CameraCaptureSession.updateOutputConfigurations()` to change camera outputs
between use cases without closing the session. `ImageFormat.RAW14` supports
14-bit RAW capture on compatible sensors; query vendor-defined extension modes
with `isExtensionSupported(int)` before using them.

Files in this skill

  • SKILL.md10.2 KB
  • coverage.json772 B
  • references/agp-toolchain-and-apis.md6.2 KB
  • references/bluetooth-media-and-devices.md4 KB
  • references/play-target-api-policy.md1.4 KB
  • references/r8-packaging-and-testing.md4.9 KB
  • references/runtime-ui-and-scheduling.md8 KB
  • references/security-networking-and-data.md5.6 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.