第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

java.lang.IllegalStateException:未注冊(cè)檢測(cè)!必須在注冊(cè)儀器下運(yùn)行

java.lang.IllegalStateException:未注冊(cè)檢測(cè)!必須在注冊(cè)儀器下運(yùn)行

慕村225694 2021-12-10 15:38:52
我一直在嘗試使用 Espresso 執(zhí)行一個(gè)簡(jiǎn)單的 UI 測(cè)試,但我所有的測(cè)試都失敗了,但出現(xiàn)了相同的異常:java.lang.IllegalStateException:未注冊(cè)檢測(cè)!必須在注冊(cè)儀器下運(yùn)行這是在使用一個(gè)esspresso新手引導(dǎo)在這里。我已經(jīng)找到了類(lèi)似的問(wèn)題,但與我最相關(guān)的問(wèn)題在這里沒(méi)有得到解答- 我認(rèn)為這是因?yàn)樗麄儧](méi)有描繪出整個(gè)畫(huà)面,所以這是我的代碼。我將只展示一個(gè)測(cè)試,因?yàn)樗鼈兌家酝耆嗤腻e(cuò)誤失敗:build.gradle(模塊:app)apply plugin: 'com.android.application'android {    compileSdkVersion 27    defaultConfig {        applicationId "io.github.vinge1718.myrestaurants"        minSdkVersion 15        targetSdkVersion 27        versionCode 1        versionName "1.0"        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"        //testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"    }    buildTypes {        release {            minifyEnabled false            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'        }    }    testOptions {        unitTests {            includeAndroidResources = true        }    }}dependencies {    testImplementation "org.robolectric:robolectric:3.8"    implementation fileTree(dir: 'libs', include: ['*.jar'])    implementation 'com.android.support:appcompat-v7:27.1.1'    implementation 'com.android.support.constraint:constraint-layout:1.1.3'    testImplementation 'junit:junit:4.12'    androidTestImplementation 'com.android.support.test:runner:1.0.2'    androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.2', {        exclude group: 'com.android.support', module: 'support-annotations'    })    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'    androidTestImplementation 'androidx.test:runner:1.1.0'    androidTestImplementation 'androidx.test:rules:1.1.0'    androidTestImplementation 'org.hamcrest:hamcrest-library:1.3'}build.gradle(項(xiàng)目:MyRestaurant)更正這里是兩個(gè)測(cè)試。我不認(rèn)為錯(cuò)誤與測(cè)試本身有任何關(guān)系,而是與配置有關(guān) - 不過(guò)我已經(jīng)糾正了
查看完整描述

3 回答

?
白豬掌柜的

TA貢獻(xiàn)1893條經(jīng)驗(yàn) 獲得超10個(gè)贊

我認(rèn)為這是因?yàn)閹?kù)androidxcom.android.support.test. 如果你想使用 jetpack,你必須將所有的測(cè)試庫(kù)轉(zhuǎn)換為 androidx,如果你不想那樣,只需刪除你的androidx庫(kù)并使用所有com.android.support.test. 查看我在A(yíng)ndroid Instrumentation Testing 中的最新答案: No instrumentation Registration Error。希望這對(duì)你有幫助。


查看完整回答
反對(duì) 回復(fù) 2021-12-10
?
慕村9548890

TA貢獻(xiàn)1884條經(jīng)驗(yàn) 獲得超4個(gè)贊

我有同樣的問(wèn)題,并測(cè)試其在類(lèi)的健身方法,這些標(biāo)準(zhǔn)單元之間存在差異的測(cè)試中去app/src/test/java/<package>。與按鈕交互、編輯文本等的UI測(cè)試需要 expresso 并進(jìn)入app/src/androidTest/java/<package>。我花了好幾遍閱讀文檔,浪費(fèi)了一天時(shí)間才弄明白其中的區(qū)別。


|____app

  |

  | ____src 

  |   |____androidTest

  |   |  |____java

  |   |     |____<package>

  |   |        |____ MainActivityInstrumentationTest.java  # expresso here 

  |   |____test

  |      |____java

  |         |____<package>

  |            |____ MainActivityInstrumentationTest.java  # not here


查看完整回答
反對(duì) 回復(fù) 2021-12-10
?
波斯汪

TA貢獻(xiàn)1811條經(jīng)驗(yàn) 獲得超4個(gè)贊

對(duì)我有用的是完全變回


安卓X



com.android.support


build.gradle 中的庫(kù)


請(qǐng)注意:您可能需要重新導(dǎo)入類(lèi)中的庫(kù),例如


import androidx.test.runner.AndroidJUnitRunner;


import android.support.test.runner.AndroidJUnitRunner;

還要確保在每次從 build.gradle 添加或刪除庫(kù)后始終清理和重建項(xiàng)目。


查看完整回答
反對(duì) 回復(fù) 2021-12-10
  • 3 回答
  • 0 關(guān)注
  • 299 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)