[android] disable leak canary during instrumentation tests
This commit is contained in:
@@ -9,7 +9,7 @@ android {
|
||||
targetSdkVersion androidVersions.targetSdkVersion
|
||||
versionCode 13
|
||||
versionName "6.0.0"
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
testInstrumentationRunner "com.mapbox.mapboxsdk.InstrumentationRunner"
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.mapbox.mapboxsdk
|
||||
|
||||
import com.mapbox.mapboxsdk.testapp.MapboxApplication
|
||||
|
||||
class InstrumentationApplication : MapboxApplication() {
|
||||
override fun initializeLeakCanary(): Boolean {
|
||||
// do not initialize leak canary during instrumentation tests
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.mapbox.mapboxsdk
|
||||
|
||||
import android.app.Application
|
||||
import android.content.Context
|
||||
import android.support.test.runner.AndroidJUnitRunner
|
||||
|
||||
class InstrumentationRunner : AndroidJUnitRunner() {
|
||||
override fun newApplication(cl: ClassLoader?, className: String?, context: Context?): Application {
|
||||
return super.newApplication(cl, InstrumentationApplication::class.java.name, context)
|
||||
}
|
||||
}
|
||||
@@ -40,7 +40,7 @@ public class MapboxApplication extends Application {
|
||||
initializeMapbox();
|
||||
}
|
||||
|
||||
private boolean initializeLeakCanary() {
|
||||
protected boolean initializeLeakCanary() {
|
||||
if (LeakCanary.isInAnalyzerProcess(this)) {
|
||||
// This process is dedicated to LeakCanary for heap analysis.
|
||||
// You should not init your app in this process.
|
||||
|
||||
Reference in New Issue
Block a user