In Android Studio, when do you use Apply Code Changes, Apply Changes and Restart Activity, Live Edit, or a full Run?
answer
- how much of the app restarts
- a debug build on API 26 or later
- method bodies versus structure
- Compose function bodies only
basics
~20 sApply Code Changes swaps edited method bodies with no restart; Apply Changes and Restart Activity adds resource edits by restarting the activity; Live Edit pushes Compose function-body edits live; structural changes such as new fields or manifest edits need a full Run.
solid answer
~50 sThe choice is about how much running state you keep. **Apply Code Changes** (`Control+F10`) pushes edited method bodies into the running app without restarting anything. **Apply Changes and Restart Activity** (`Control+Alt+F10`) also takes edits to existing resources, at the cost of restarting the activity but not the app. Both need a debug build variant on Android 8.0 (API 26) or higher. **Live Edit** is for Jetpack Compose: it pushes changes to composable function bodies as you type or save, on API 30 or higher, and cannot be mixed with the Apply Changes actions without restarting the app. A full **Run** is needed for structural changes: adding or removing a field, removing a method, changing a signature, modifiers, inheritance or enum values, adding or removing a resource, or changing the manifest or native libraries. In Android Studio Rabbit 1 a failed apply prompts you to Run, or reruns automatically if you turn on the fallback.
go deeper
Recall the four actions and what each restarts: nothing, the activity, nothing for Compose bodies, or the whole app. Know that structural changes need Run.
Explain why Apply Changes needs a debug variant on API 26 or higher, which changes force a restart, and Live Edit's limits: function bodies only and a state reset on the first edit in a file.
Diagnose why the fast path keeps failing: plugins that rewrite resources or the manifest, onCreate edits that never run again, and not trusting performance numbers from a Live Edited build.
Weigh whether a team's build setup keeps incremental deploys working, for example by keeping per-build resource stamping out of debug variants, against what those plugins give release builds.
## Four ways to get a change onto the device Every time you change code, Android Studio can deliver it with a different amount of disruption. The less it restarts, the more of the app's state (the screen you navigated to, the data you typed) survives. | Action | What restarts | Takes | Main requirements | |---|---|---|---| | **Apply Code Changes** (`Control+F10`) | nothing | edited method bodies, no resource changes | debug variant, device on API 26+ | | **Apply Changes and Restart Activity** (`Control+Alt+F10`) | the current activity | method bodies plus edits to existing resources | debug variant, device on API 26+ | | **Live Edit** | nothing (state resets once per file, see below) | edits to Compose function bodies | Compose project, device on API 30+, debuggable process | | **Run** | the whole app | anything | none beyond building | ## How Apply Changes works Apply Changes uses capabilities of the Android **JVMTI** implementation supported on Android 8.0 (API level 26) and higher, which is why that is its floor. Only a **debug build variant** qualifies. When you click either action, Android Studio builds a new APK and decides whether the change can be applied. If it cannot, Studio prompts you to **Run** instead. You can make that fallback automatic in Settings > Build, Execution, Deployment > Deployment. Some features depend on the platform version: **adding a method requires Android 11 or higher** on the device. ## What forces a full Run These changes cannot be applied until the app restarts: - adding or removing a **field** - **removing** a method - changing a **method signature** - changing **modifiers** of methods or classes - changing **class inheritance** - changing values in **enums** - **adding or removing** a resource - changing the **app manifest** - changing **native libraries** (SO files) Some changes apply without an error but still do not show. An edit to an activity's `onCreate()` only runs when the activity is created again, so you must restart to see it. ## When a library gets in the way - A library or plugin that **edits the manifest** during the build rules out Apply Changes for every build. - One that **edits resources on every build** rules out Apply Code Changes. Firebase Crashlytics stamps a unique build ID into resources each build, for example, which forces at least an activity restart. Turning those automatic updates off for debug variants restores the fast path. - Code that reads **content from the installed APK** can misbehave after Apply Code Changes, because the APK on the device is replaced. Use Apply Changes and Restart Activity or Run instead. ## Live Edit, for Compose **Live Edit** updates composables on an emulator or a physical device in real time. The documentation still describes it as in active development. It has three modes: **Manual** (push with `Control+'`), **Manual on Save** (`Control+S`) and **Automatic** (applies as you edit). Its requirements are Android Studio Giraffe or later, Compose Runtime 1.3.0 or higher, AGP 8.1.0-alpha05 or higher, a device on API 30 or higher, and a debuggable process. Its limits matter when you choose it: 1. It supports **function body edits only**: no renaming, no signature changes, no adding or removing functions, no non-function fields. 2. The **first** change to a Compose function in a file **resets the app's state**. Later changes in that file do not. 3. Live Edit-modified classes may run slower, so **never measure performance** on that build. Use a clean release build. 4. The debugger needs a full Run before it works on classes you changed with Live Edit. 5. It does **not resume after an app restart**. Click Run again. 6. Apply Changes and Apply Code Changes are **not compatible** with Live Edit and need the app restarted. 7. Edits to non-composable functions trigger a full recomposition that might not call the edited function. When the indicator in the Running Devices window says **Out Of Date**, the edit did not compile. Click it for the error. ## A working rhythm 1. Run once. 2. For Compose UI work, Live Edit until you need an unsupported change. For other code, use Apply Code Changes, or Apply Changes and Restart Activity when resources changed. 3. Click Run after a structural change and carry on.
- Why shouldn't you judge scroll smoothness on a build you have been Live Editing?Classes modified by Live Edit may carry a performance penalty, and Live Edit only works on debuggable processes, which have their own overhead. Timing taken there says little about what users see. Run a clean release build, profileable for the Profiler, before judging performance.
- Edits stop reaching the device and the Live Edit indicator says Out Of Date; what does that mean and what do you do?Out Of Date means Live Edit could not update the app, usually because of a compilation error; click the indicator for the error and suggestions. If the edit is one Live Edit does not support, such as adding a function or changing a signature, click Run to restart and Live Edit resumes.
- In a debug build, Apply Code Changes always ends in an activity restart; what is a likely cause?A library or plugin is changing resources on every build. Firebase Crashlytics writing a unique build ID is the documented example, and it rules out Apply Code Changes. Turn those automatic updates off for debug variants so code-only edits can apply without a restart.
- Apply Code Changes can add a new field to a class without restarting.
- Live Edit works on any build, including a non-debuggable release build.
- Live Edit and Apply Changes can be mixed freely without restarting the app.
- A build you Live Edited is fine for measuring frame timing.
- An edit to onCreate() shows at once through Apply Code Changes without relaunching the activity.
Assumes Android Studio Rabbit 1 (2026.2); Live Edit needs Giraffe or later, and Koala Feature Drop moved its manual-push shortcut from Control+\ to Control+'.