因此,正如告诉我的那样,“com.hoho.android.usbserial.BuildConfig类型是多次定义的:
...\usb-serial-for-android\usbSerialForAndroid\build.transforms\53759cf0d63e199b707a7ba0cbe9c081\classes\classes.dex
...\usb-serial-for-android\usbSerialExamples\build\intermediates\external_libs_dex\debug\mergeExtDexDebug\classes.dex
build.gradle:
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.2'
implementation 'com.github.mik3y:usb-serial-for-android:3.3.0'
}
}
allprojects {
repositories {
jcenter()
google()
maven { url 'https://jitpack.io' }
}
}library.gradle:
apply plugin: 'com.android.library'
android {
compileSdkVersion 29
buildToolsVersion '29.0.3'
defaultConfig {
minSdkVersion 17
targetSdkVersion 29
consumerProguardFiles 'proguard-rules.pro'
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunnerArguments = [ // Raspi Windows LinuxVM ...
'rfc2217_server_host': '192.168.0.100',
'rfc2217_server_nonstandard_baudrates': 'true', // true false false
]
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation "androidx.annotation:annotation:1.1.0"
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'commons-net:commons-net:3.6'
androidTestImplementation 'org.apache.commons:commons-lang3:3.11'
implementation 'com.github.mik3y:usb-serial-for-android:3.3.0'
}app.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion '29.0.3'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
minSdkVersion 17
targetSdkVersion 29
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "android.test.InstrumentationTestRunner"
missingDimensionStrategy 'device', 'anyDevice'
}
buildTypes {
release {
minifyEnabled true
}
}
}
dependencies {
implementation project(':usbSerialForAndroid')
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
}等级-包装。属性:
#Tue Oct 13 21:20:09 CEST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip不知道怎么解决这个问题。
发布于 2021-03-08 11:37:40
因此,看起来您要引用同一个库两次,使用
dependencies {
implementation project(':usbSerialForAndroid')
}
dependencies {
implementation 'com.github.mik3y:usb-serial-for-android:3.3.0
}这意味着,品位是找到两个库的相同的包名,这显然会造成冲突。
因此,您应该只在应用程序: build.grade文件中声明您的依赖项。
我假设您已经在本地克隆了存储库,如果有特定的原因(您已经做了更改),那么保留project实现,否则只需使用另一个,但将其移到app:build.gradle文件中。
https://stackoverflow.com/questions/66522840
复制相似问题