Java Android studio在运行期间显示此错误。错误:程序类型已存在:androidx.concurrent.futures.DirectExecutor
我试图通过/使用android studio 3.1.4版运行我的android应用程序,但我不知道在我运行程序时会发生什么,因为它一直显示此错误Java Android studio在运行期间显示此错误。错误:程序类型已存在:androidx.concurrent.futures.DirectExecutor,java,android,android-studio-3.0,grpc-java,Java,Android,Android Studio 3.0,Grpc Java,我试图通过/使用android studio 3.1.4版运行我的android应用程序,但我不知道在我运行程序时会发生什么,因为它一直显示此错误 Error: Program type already present: androidx.concurrent.futures.DirectExecutor 我试着用谷歌快速搜索它的答案,但仍然没有找到和我的问题相关的答案 根据我发现的与类名冲突相关的问题?如果我错了,请纠正我 下面是我的身材,格雷德尔 apply plu
Error: Program type already present: androidx.concurrent.futures.DirectExecutor
我试着用谷歌快速搜索它的答案,但仍然没有找到和我的问题相关的答案
根据我发现的与类名冲突相关的问题?如果我错了,请纠正我
下面是我的身材,格雷德尔
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'
您也可以参考此链接了解发生此错误的原因
请添加
build.gradle
;否则这个问题就不可能回答了。@MartinZeitler我把build.gradle
放在了我的帖子里。感谢我的过错,没有透露更多关于我所做事情的细节。我把build.gradle
放在上面编辑了我的文章,谢谢你的解释。
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'