When using android-apt plugin is it possible to generate code for the test build? Specifically I am using Dagger and have some TestModules that are only needed for unit test and want those in the test build only. Seems the plugin does not support testApt 'my-dependency'.
Generate code for unit test build in Android Studio
1.1k views Asked by Patrick Jackson At
3
There are 3 answers
0
On
Add this to your build.gradle
testCompile 'com.google.dagger:dagger:2.0.1'
testCompile 'com.google.dagger:dagger-compiler:2.0.1'
Even though the AndroidStudio will complain about the missing Dagger generated classes, your Unit Tests will compile and run without any problem. For the moment this is the only solution until the 'testApt' feature will be added into the new Gradle release.
It should be possible with gradle plugin 1.3. More information here.
You can try the beta plugin:
If it doesn't work you have to wait for final version of the plugin. More information under the link provided above.