как добавить диалогфрагмент модульного теста android - PullRequest
0 голосов
/ 17 апреля 2020

Я делаю код Android Test. В этом я добавляю правила для Activity для тестирования с использованием этого

@Rule
public ActivityTestRule<MyActivity> mActivityRule = new ActivityTestRule(MyActivity.class);

У меня есть эти зависимости в моем проекте

androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test:rules:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0-alpha05'
debugImplementation 'androidx.fragment:fragment-testing:1.2.4'// this is for fragment

https://developer.android.com/training/basics/fragments/testing

это работает нормально. Но у меня есть проблема с открытием DialogFragment

, когда я добавляю правило для DialogFragment Я получаю ошибку во время компиляции

@Rule
FragmentScenario<MyDialogFragment> scenario = FragmentScenario.launch(MyDialogFragment.class);

Это ошибка

Could not determine the dependencies of task ':app:processDebugAndroidTestManifest'.
> Could not resolve all task dependencies for configuration ':app:debugAndroidTestRuntimeClasspath'.
   > Could not resolve androidx.test:monitor:{strictly 1.2.0}.
     Required by:
         project :app
      > Cannot find a version of 'androidx.test:monitor' that satisfies the version constraints: 
           Dependency path 'appwriter:app:unspecified' --> 'androidx.test:runner:1.3.0-alpha05' --> 'androidx.test:monitor:1.3.0-alpha05'
           Constraint path 'appwriter:app:unspecified' --> 'androidx.test:monitor:{strictly 1.2.0}' because of the following reason: debugRuntimeClasspath uses version 1.2.0
           Dependency path 'appwriter:app:unspecified' --> 'androidx.fragment:fragment-testing:1.2.4' --> 'androidx.test:core:1.2.0' --> 'androidx.test:monitor:1.2.0'
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...