After having configured instant run, the run button has a small yellow thunderbolt.But while I run the app, Android Studio still performed a full build & install, full messa
I ran into this problem when running ProcessPhoenix. Instead of disabling it completely, I just disabled it for my debug build.
Instead of compile
I use
releaseCompile 'com.jakewharton:process-phoenix:2.0.0'
And to not break the build I use reflection to trigger the application process restart:
try {
Class clazz = Class.forName("com.jakewharton.processphoenix.ProcessPhoenix");
Method triggerRebirthMethod = clazz.getMethod("triggerRebirth", Context.class);
triggerRebirthMethod.invoke(this, new Object[]{getActivity()});
} catch (Exception e) {
// Exception handling
}
So now I can still use Instant Run and keep the lib included. :)
(Of course, reflection is never ideal, but the app process restart is only used in one rare particular case in the app.)
Instant Run is not enabled for your app because it is using multiple processes.
As stated on the Android Tools Project Site (http://tools.android.com/recent/androidstudio20beta6availableinthecanarychannel):
"Apps that were using multiple processes (via android:process in the manifest) were not being updated properly with Instant Run. For the time being, we have turned off Instant Run in such a scenario."
Hence, to experience instant run, you must ensure your app isn't using multiple processes. Check your AndroidManifest.xml for this.
It may be that the multiple process usage comes from an imported library. LeakCanary, for example, uses multiple processes, defined in its own AndroidManifest.xml. The best way to find where this is defined is to search your entire project (Cmd-Shift-F in Android Studio on OS X) for "android:process".
I tried a lot... and quick solution is to remove android:process=":remote" when developing..
but that's not enough.. try bellow.
build.gradle(app)
buildTypes {
debug {
minifyEnabled false
signingConfig signingConfigs.debug
}
release {
minifyEnabled true
signingConfig signingConfigs.release
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
development {
minSdkVersion 21
}
production {
minSdkVersion 14
}
}
flavorDimensions "default"
Now you have 4 Build Variants
=> developmentDebug, developmentRelease, productionDebug, productionRelease
developmentDebug, developmentRelease
=> no use multi process
productionDebug, productionRelease
=> use multi process
2. copy orginal "AndroidManifest.xml" to YouAppRoot\app\src\production, and then remove all elements except 'service'.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapp"
android:installLocation="auto">
<application
android:name=".App"
android:allowBackup="true"
android:hardwareAccelerated="@bool/gpu_enabled"
android:icon="@drawable/icon"
android:label="@string/app_name"
android:largeHeap="true"
android:theme="@style/MyTheme">
<service
android:name=".xxxx.MyService"
android:exported="false"
android:process=":remote">
<intent-filter>
<action android:name="xxxx.test.aaa" />
</intent-filter>
</service>
</application>