Last active
August 29, 2015 14:26
-
-
Save nyamwaya/5e94822457d9f767b2e5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//After creating your class extend, RobolectricTestRunner | |
//Create a cunstructor | |
//then inside your constructer, put this code inside it | |
super(testClass); | |
String buildVariant = (BuildConfig.FLAVOR.isEmpty() | |
? "" : BuildConfig.FLAVOR+ "/") + BuildConfig.BUILD_TYPE; | |
String intermediatesPath = BuildConfig.class.getResource("") | |
.toString().replace("file:", ""); | |
intermediatesPath = intermediatesPath | |
.substring(0, intermediatesPath.indexOf("/classes")); | |
System.setProperty("android.package", | |
BuildConfig.APPLICATION_ID); | |
System.setProperty("android.manifest", | |
intermediatesPath + "/manifests/full/" | |
+ buildVariant + "/AndroidManifest.xml"); | |
System.setProperty("android.resources", | |
intermediatesPath + "/res/" + buildVariant); | |
System.setProperty("android.assets", | |
intermediatesPath + "/assets/" + buildVariant); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment