hello every one : i have an issue ,, i have a proj...
# android
h
hello every one : i have an issue ,, i have a project with 3 modules :app , common , Trip ,,, the module app need common and trip ,, the Trip module need only common , so i wanna run some UI tests in Trip module but i needed to add androidTestImplementation project(path: ':app') so i can import Mainactivity and some other class and it gives me this error : === Task ArbinTripRequestCreationmergeDexStagingAndroidTest FAILED AGPBI: {"kind":"error","text":"Type androidx.activity.compose.R is defined multiple times: /Users/hb/rider-android/app/build/.transforms/c83675c18688c07c808f5074421a02cc/transformed/classes/classes.dex, /Users/hb/rider-android/ArbinTripRequestCreation/build/intermediates/project_dex_archive/stagingAndroidTest/out/7fe88f605e34c71b18befa5a4a52bf7ad8faa212437ca9fb29345a33a8c4165d_0.jar:classes.dex","sources":[{"file":"/Users/hb/rider-android/app/build/.transforms/c83675c18688c07c808f5074421a02cc/transformed/classes/classes.dex"}],"tool":"D8"} com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes. Type androidx.activity.compose.R is defined multiple times: (edited)
r
If the Activity you're testing is in app the tests need to also be in app
You can try updating the tests to only work on Fragments using FragmentScenario but even then it's usually simpler to keep all UI tests in app
h
am using compose btw
so u are saying i should run my ui test in app module only ?
r
Different people will have different opinions but it'll definitely be simpler for getting started and save a lot of headache if you want to do CI and/ or DI
h
i didnt get u ? can u explain please
r
Sounds like you're very early in your learning process so going to change my original answer to yes
h
i got u , but i didnt understand why u mentioned ci cd
r
If you want to run tests on a CI server it's easier to run them all together and you get nicer reports if they're all in app
Not impossible to work around, but a bit more effort