jeudi 27 juillet 2017

Android Flavor Testing .R-file

I have a problem with the .R-files of an app with 2 flavors: "main" and "flavor1"

In "main" there is the common codebase. In "flavor1" there is some flavor-specific implementation.

and I have 2 test directories: androidTest (package org.myapp.test) androidTestFlavor1 (package org.myapp.flavor1.test)

In androidTest there is the common test codebase including resource files. In androidTestFlavor1 there are only tests specific to this flavor.

Now, I have the problem that when I execute the tests in androidTestFlavor1, Android Studio complains that it cannot find the .R-file of the common test codebase (which is imported and used only in the androidTest-directory) - "cannot resolve symbol R".

Obviously, the file org.myapp.test.R was not generated. Only org.myapp.flavor1.test.R was generated. Why is there only one .R-file generated? I thought the .R-file in the common directory should always be generated?

Aucun commentaire:

Enregistrer un commentaire