我使用Android Studio 3.3 Canary 8.我创建了默认项目,然后我尝试运行该项目.但我见过以下stacktrace:
AGPBI:{"kind":"error","text":"程序类型已存在:androidx.core.graphics.PathSegment","sources":[{}],"tool":"D8"}任务:app :buildInfoGeneratorDebug FAILURE:构建失败并出现异常.*出了什么问题:任务执行失败':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.com.android.builder.dexing.DexArchiveMergerException:合并dex存档时出错:了解如何在https://developer.android.com/studio/build/dependencies#duplicate_classes中解决问题.程序类型已存在:androidx.core.graphics.PathSegment
的build.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "my.app"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.0-rc02'
implementation 'android.arch.navigation:navigation-fragment:1.0.0-alpha05'
implementation 'android.arch.navigation:navigation-ui:1.0.0-alpha05'
implementation 'android.arch.navigation:navigation-fragment-ktx:1.0.0-alpha05'
implementation 'android.arch.navigation:navigation-ui-ktx:1.0.0-alpha05'
implementation 'androidx.core:core-ktx:0.3'
implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
}
Run Code Online (Sandbox Code Playgroud)