Android Studio在运行期间显示此错误.错误:程序类型已存在:androidx.concurrent.futures.DirectExecutor [英] Android studio show this error during run. Error: Program type already present: androidx.concurrent.futures.DirectExecutor

查看:348
本文介绍了Android Studio在运行期间显示此错误.错误:程序类型已存在:androidx.concurrent.futures.DirectExecutor的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

im尝试通过/使用android studio 3.1.4版运行我的android应用程序,我不知道当im运行我的程序时会发生什么情况

im tried to run my android app program through / using android studio version 3.1.4 and i have no idea what is happen while im run my program its keep showing this error

Error: Program type already present: androidx.concurrent.futures.DirectExecutor

我尝试快速搜索其答案,但仍未找到与我的问题相关的答案.

I'd tried quick googling its answer but yet still not found answer related to my issues.

根据我发现与类名冲突有关的那些问题?如果我错了,请纠正我.

As per I'd found those issues related to class name conflict? Correct me if I'm wrong.

下面是我的build.gradle

Below this is my build.gradle

            apply plugin: 'com.android.application'
            apply plugin: 'com.google.protobuf'

            android {
            compileSdkVersion 28
            defaultConfig {
                applicationId "com.ikan.elogbook"
                minSdkVersion 24
                targetSdkVersion 28
                versionCode 1
                versionName "1.0"

            testInstrumentationRunner"androidx.test.runner.AndroidJUnitRunner"


            }


            buildTypes {
                release {
                    minifyEnabled false
                    proguardFiles getDefaultProguardFile('proguard- android.txt'), 'proguard-rules.pro'
                }
            }

            lintOptions {

            disable'GoogleAppIndexingWarning','HardcodedText','InvalidPackage'
                textReport true
                textOutput "stdout"
            }

            allprojects {
                repositories {
                    maven { url 'https://jitpack.io' }

                    //this line added to resolve issue some grpc package / 
            library are not found
                    //reference bug url https://github.com/grpc/grpc- 
            java/issues/4460
                    mavenCentral()
                }
            }
}

    ext {
        supportLibraryVersion = "25.3.1"
    }


        protobuf {
            protoc { artifact = 'com.google.protobuf:protoc:3.5.1-1' }
            plugins {
            javalite { artifact = "com.google.protobuf:protoc-gen-javalite:3.0.0" }
            grpc { artifact = 'io.grpc:protoc-gen-grpc-java:1.17.1' // CURRENT_GRPC_VERSION
            }
        }
        generateProtoTasks {
            all().each { task ->
                task.plugins {
                    javalite {}
                    grpc { // Options added to --grpc_out
                        option 'lite' }
                }
            }
        }
}

dependencies {

    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'androidx.appcompat:appcompat:1.1.0-alpha01'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.recyclerview:recyclerview:1.1.0-alpha01'
    implementation 'com.github.jkwiecien:EasyImage:1.3.1'
    implementation 'com.mikepenz:materialdrawer:6.1.1'
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.recyclerview:recyclerview:1.0.0'
    implementation 'androidx.annotation:annotation:1.0.0'
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'de.codecrafters.tableview:tableview:2.8.0'
    implementation 'com.pixplicity.easyprefs:library:1.9.0'
    // You need to build grpc-java to obtain these libraries below.
    implementation 'io.grpc:grpc-okhttp:1.17.1'
    // CURRENT_GRPC_VERSION
    implementation 'io.grpc:grpc-protobuf-lite:1.17.1'
    // CURRENT_GRPC_VERSION
    implementation 'io.grpc:grpc-stub:1.17.1'
    // CURRENT_GRPC_VERSION
    implementation 'javax.annotation:javax.annotation-api:1.2'
    protobuf 'com.google.protobuf:protobuf-java:3.5.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.1-alpha01'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1-alpha01'
}

推荐答案

当build.gradle文件中存在不同类型的依赖项时 喜欢

When different types of dependency present in build.gradle file like

implementation 'com.android.support:appcompat-v7:27.1.0'

implementation 'com.android.support:design:28.0.0'

或版本冲突.

为避免这种情况,您需要维护依赖项的版本 像这样

to avoid this you need to maintain the version of your dependency like this

  implementation 'com.android.support:appcompat-v7:27.1.0'
  implementation 'com.android.support:design:28.0.0'

您也可以参考此链接以了解为什么会发生此错误

you can also refer this link to know why this error occurs

什么是程序类型已存在"?

这篇关于Android Studio在运行期间显示此错误.错误:程序类型已存在:androidx.concurrent.futures.DirectExecutor的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆