Как я могу импортировать класс конфигурации по желанию? - PullRequest
0 голосов
/ 19 октября 2019

Когда я пытаюсь использовать Configuration класс android studio говорит: «Не удается разрешить символ« Конфигурация »». Как я могу использовать Configuration класс надлежащим образом?

Вот класс:

package android.example.com;

import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Before;
import org.junit.runner.RunWith;

@RunWith(AndroidJUnit4.class)
public class ActivityInputOutputTest {

    @Before
    public void setup() {
        Configuration config;
    }

}

А вот build.gradle (Модуль: приложение):

apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"
    defaultConfig {
        applicationId "android.example.com"
        minSdkVersion 15
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation "androidx.work:work-testing:2.2.0"

    // Required -- JUnit 4 framework
    testImplementation 'junit:junit:4.12'
    // Optional -- Robolectric environment
    testImplementation 'androidx.test:core:1.0.0'
    // Optional -- Mockito framework
    testImplementation 'org.mockito:mockito-core:1.10.19'

    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

    compileOnly 'com.jakewharton.espresso:espresso:1.1-r2'
    androidTestCompile('com.jakewharton.espresso:espresso:1.1-r2') {
        exclude group: 'com.squareup.dagger'
    }
}

1 Ответ

1 голос
/ 20 октября 2019

Добавьте следующее в свой build.gradle

implementation "androidx.work:work-runtime:2.2.0"
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...