0

Android11においてToastのgetViewがNullを返すようになってしまったのでSnackbarに変更しようとしています。
build.gradleにライブラリの追加をしたが以下のエラーが出ており、依存関係で問題があることまではわかるのですが、どこに問題があるかが不明です。
ご教授いただければ幸いです。

エラーメッセージ:

Program type already present: android.support.v4.os.ResultReceiver$1
Message{kind=ERROR, text=Program type already present: android.support.v4.os.ResultReceiver$1, sources=[Unknown source file], tool name=Optional.of(D8)}

ソースコード:

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.4'
    }
}
apply plugin: 'com.android.application'

dependencies {
    implementation fileTree(include: '*.jar', dir: 'libs')
    implementation 'com.google.android.gms:play-services-location:15.0.1'
    implementation 'com.squareup.okhttp3:okhttp:3.11.0'
    implementation 'com.android.support.constraint:constraint-layout:2.0.0-alpha2'
    implementation "com.google.android.material:material:1.1.0-alpha06"
}
allprojects {
    gradle.projectsEvaluated {
        tasks.withType(JavaCompile) {
            options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
        }
    }
}
android {
    compileSdkVersion 30
    buildToolsVersion "27.0.3"
    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }

        // Move the tests to tests/java, tests/res, etc...
        androidTest.setRoot('tests')

        // Move the build types to build-types/<type>
        // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
        // This moves them out of them default location under src/<type>/... which would
        // conflict with src/ being used by the main source set.
        // Adding new build types or product flavors should be accompanied
        // by a similar customization.
        debug.setRoot('build-types/debug')
        release.setRoot('build-types/release')
    }
    defaultConfig {
        minSdkVersion 23
        targetSdkVersion 30

    }
    productFlavors {
    }
    repositories {
        google()
        jcenter()
    }
}

0

この質問に回答するには、ログインする必要があります。

のタグが付いた他の質問を参照する。