Instant Run is an extended behavior for the run và debug commands that enables faster debugging by not requiring a full build & reinstall for eevry change done in your app"s code.
Bạn đang xem: How to disable instant run in android studio
Introduced in apk Studio 2.0, Instant Run is a behavior for theRun và Debug commands that significantly reduces the time betweenupdates khổng lồ your app. Although your first build may take longer tocomplete, Instant Run pushes subsequent updates lớn your tiện ích withoutbuilding a new APK, so changes are visible much more quickly.
Instant Run is supported only when you deploy the debug build variant,use android Plugin for Gradle version 2.0.0 or higher, & setminSdkVersion lớn 15 or higher in your app"s module-level build.gradlefile. For the best performance, set minSdkVersion lớn 21 or higher.
After deploying an app, a small, yellow thunderbolt icon appearswithin the Run button (or Debug button), indicating that InstantRun is ready lớn push updates the next time you click the button.Instead of building a new APK, it pushes just those new changes and,in some cases, the tiện ích doesn"t even need to lớn restart but immediatelyshows the effect of those code changes.
Instant Run pushes updated code và resources lớn your connected deviceor emulator by performing a hot swap, warm swap, or cold swap. Itautomatically determines the type of swap to lớn perform based on the typeof change you made. The video above provides interesting detail abouthow this all works under the hood. For a quick summary of how InstantRun behaves when you push certain code changes lớn a target device,however, see the following table.
Documentation
Enabling or disabling Instant Run
Open the Settings or Preferences dialog:On Windows or Linux, select file > Settings from the main menu.On Mac OSX, select game android Studio > Preferences from the main menu.Navigate lớn Build, Execution, Deployment > Compiler.In the text field next to lớn Command-line Options, enter your command-line options.Click OK to lớn save and exit.Xem thêm: Pha Lê Không Dễ Vỡ Tập 1
The đứng đầu option is Instant run. Check/uncheck that box.
Documentation
Types of code Swaps in Instant Run
There are three types of code swaps that Instant run enables to support faster debugging và running phầm mềm from your code in app android Studio.
Hot SwapWarm SwapCold SwapWhen are each of these swaps triggered?
HOT SWAP is triggered when an existing method"s implementation is changed.
WARM SWAP is triggered when an existing resource is changed or removed (anything in the res folder)
COLD SWAP whenever there is a structural code change in your app"s code e.g.
Add, remove, or change:an annotationan instance fielda static fielda static method signaturean instance method signatureChange which parent class the current class inherits fromChange the danh sách of implemented interfacesChange a class"s static initializerReorder layout elements that use dynamic resource IDsWhat happens when a code swap happens?
HOT SWAP changes are visible instantly - as soon as the next gọi to the method whose implementation is changed is made.
WARM SWAP restarts the current activity
COLD SWAP restarts the entire app (without reinstall)
Unsupported code changes when using Instant Run
There are a few changes where instant won"t bởi vì its trick and a full build và reinstall fo your ứng dụng will happen just like it used khổng lồ happen before Instant Run was born.
Change the ứng dụng manifestChange resources referenced by the tiện ích manifestChange an app android widget UI element (requires a Clean và Rerun)Documentation