Tuesday, 14 July 2015

Android have duplicate classes in different variants

This is the suggested structure:


However you will copy B.java to all folders(build variants)

So, below structure is the idea one:

Main folder has a basic B.java and is any folder (build variant) want to change it, they can have a different copy!

However, with above structure, when you compile "stag" you will get "duplicate class" error. Which  means you have to use the suggested structure which showed at the beginning.

 However, androidTest folder for (instrument testing) is totally different,  you can have duplicate class in it and it will override the default one (from main folder).

But that only supports Non Activities related classes.

So my suggestions are:

if B.java is a activity, and you use (1) with (3) you will get this error:

junit.framework.AssertionFailedError: Exception in constructor


No comments:

Post a comment