После включения «espresso-contrib: 3.1.0»: выполнение задачи не выполнено: app: processDebugAndroidTestResources - PullRequest
0 голосов
/ 28 октября 2018

После включения строки (чтобы использовать RecyclerViewActions для тестирования с Espresso):

androidTestImplementation 'androidx.test.espresso: espresso-contrib: 3.1.0'

Я получаю сообщение об ошибке:

AAPT2 error: check logs for details

Более конкретно

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:processDebugAndroidTestResources'.

И далее в журналы:

error: resource android:attr/dialogCornerRadius not found.
Message{kind=ERROR, text=error: resource android:attr/dialogCornerRadius not found., sources=[/Users/****/.gradle/caches/transforms-1/files-1.1/appcompat-1.0.0.aar/8cc334eb6bfbd0d390b8b779993d2020/res/values-v28/values-v28.xml:9:5-12:13], original message=, tool name=Optional.of(AAPT)}

...

error: resource android:attr/dialogCornerRadius not found.
Message{kind=ERROR, text=error: resource android:attr/dialogCornerRadius not found., sources=[/Users/****/Documents/Code/AndroidStudioProjects/MyProject/app/build/intermediates/incremental/mergeDebugAndroidTestResources/merged.dir/values-v28/values-v28.xml:11], original message=, tool name=Optional.of(AAPT)}

...

error: resource android:attr/fontVariationSettings not found.
Message{kind=ERROR, text=error: resource android:attr/fontVariationSettings not found., sources=[/Users/****/.gradle/caches/transforms-1/files-1.1/appcompat-1.0.0.aar/8cc334eb6bfbd0d390b8b779993d2020/res/values/values.xml:1304:5-69], original message=, tool name=Optional.of(AAPT)}

...

error: resource android:attr/ttcIndex not found.
Message{kind=ERROR, text=error: resource android:attr/ttcIndex not found., sources=[/Users/****/.gradle/caches/transforms-1/files-1.1/appcompat-1.0.0.aar/8cc334eb6bfbd0d390b8b779993d2020/res/values/values.xml:1304:5-69], original message=, tool name=Optional.of(AAPT)}

...

error: failed linking references.

build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    dataBinding.enabled = true
    defaultConfig {
        applicationId "com.****.****"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    sourceSets { main { java.srcDirs = ['src/main/java', 'src/dbhelpers/java/'] } }
    testOptions {
        unitTests {
            includeAndroidResources = true
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:design:26.1.0'
    implementation 'com.android.support:cardview-v7:26.1.0'
    implementation 'com.android.support:recyclerview-v7:26.1.0'


    implementation 'com.android.support:support-annotations:27.1.1'
    androidTestImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:rules:1.1.0'
    androidTestImplementation 'androidx.test:runner:1.1.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
    androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.1.0'

    androidTestImplementation "com.google.truth.extensions:truth-java8-extension:0.42"
    testImplementation "com.google.truth:truth:0.42"
}

1 Ответ

0 голосов
/ 02 ноября 2018

Обновите ваши compileSdkVersion и targetSdkVersion до 28. Эти ресурсы отсутствуют в SDK 26.

...