但是当我构建它时,最近我为kotlin更新了android
和我的android gradle vesion是3.1.2和kotlin版本是1.2.41 android studio 3.1.2我是针对android p这是最新版本所以我找不到更多关于这个问题的文档和
请帮我找出这个问题 android issues
Program type already present: android.support.v4.media.MediaBrowserCompat$ConnectionCallback$StubApi21
build.gradle(app)
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 'android-P'
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.xxxxxxx.xx"
minSdkVersion 18
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
debuggable false
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'org.jetbrains.anko:anko-commons:0.10.4'
implementation 'androidx.core:core-ktx:1.0.0-alpha1'
implementation "androidx.appcompat:appcompat:1.0.0-alpha1"
implementation "androidx.legacy:legacy-support-v4:1.0.0-alpha1"
implementation 'androidx.constraintlayout:constraintlayout:1.1.0'
implementation "com.google.android.material:material:1.0.0-alpha1"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha1'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
//firebase massaging
implementation 'com.google.firebase:firebase-messaging:15.0.2'
implementation 'com.google.firebase:firebase-core:15.0.2'
def lifecycle_version = "2.0.0-alpha1"
def room_version = "2.0.0-alpha1"
// ViewModel and LiveData
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
// room database persistent
implementation "androidx.room:room-runtime:$room_version"
kapt "androidx.room:room-compiler:$room_version"
// optional - Test helpers for LiveData
testImplementation "androidx.arch.core:core-testing:$lifecycle_version"
//data binding
//kapt 'com.android.databinding:compiler:3.1.2'
}
apply plugin: 'com.google.gms.google-services'
请帮帮我什么是我无法找到的问题
3 回答
我从我的整个项目中删除了Androidx,但仍然是解析员然后我找到了解决方案并替换
implementation 'androidx.core:core-ktx:1.0.0-alpha1'
至
implementation 'androidx.core:core-ktx:0.3'
我的问题解决了 . 无论如何,谢谢所有第二次我将使用androidx(Android Kotlin)我正在等待jetpack稳定版 .
实际上这是金丝雀14的一个错误 . 你应该等待金丝雀15 ;-)
查看this session .
你试过下载android studio 3.2 canary 14吗?有一个新的选项可以将您的文件转换为androidX,并可以预览它将要执行的操作 . 备份您的文件或至少使用git以确保它是安全的 .
感谢编辑保罗