Android-Studio ( or IDEA in general ) refactor over multiple source sets
Asked Answered
A

1

26

What is a good way to handle the problem of refactoring over multiple source sets? E.g. in different flavors - or now unit-tests and integration-tests. You can only have one active source-set that is considered for renaming - so the other source-set might end up broken. What are your strategies to tackle this? Perhaps there is a helping plugin that I am missing - or some other trick that might help here.

Abadan answered 16/2, 2015 at 9:54 Comment(4)
I also find it irritating that Android Studio is so strict about the build variant being activated. Not even previews for res/values/colors.xml are shown for a disabled build variant.Perspicuous
This has been bugging me for some time. I am now considering creating multiple 'modules' instead of build variants but that seems overkill (I'll need to duplicate some gradle logic, etc...)Someday
I can't remember from which version this was introduced -I think 2.0, but currently you don't need to switch between source sets using Android Studio to run unit or instrumentation test. The same goes for refactoring the code.Outface
My rule of thumb - no flavors. No build types for modules. However, there is still chance to trap into. Add on CI also at least compile of the other variant. This will burn machine and will rarely catch the problem. I'm not sure if it would be easy to write some lint check since these files are not in the active source set.Obscurity
S
0

From the latest version onward you don't need to maintain multiple source sets for unit and integration test. Update the Android Studio https://developer.android.com/studio/index.html Hope this solves the problem.

Selenography answered 20/7, 2016 at 7:29 Comment(1)
It's not just about tests vs main code, in my case I have a 'dogfood' build variant that never gets refactored at the same time as the rest of the codeSomeday

© 2022 - 2024 — McMap. All rights reserved.