安卓工作室在运行过程中显示此错误.错误:程序类型已存在:androidx.concurrent.futures.Dire



我试图通过/使用android studio 3.1.4版运行我的android应用程序,但我不知道在我运行程序时发生了什么,它一直显示这个错误

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

我试着在谷歌上快速搜索它的答案,但仍然没有找到和我的问题相关的答案。

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

下面是我的建筑.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文件中存在不同类型的依赖项时像

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

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

或版本冲突。

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

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

你也可以参考这个链接来了解这个错误发生的原因

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

相关内容

最新更新