程序类型已存在:android.support.v4.media.MediaBrowserCompat $ ConnectionCallback $ StubApi21

时间:2018-05-11 23:34:43

标签: android material-design

更新android以预览p并添加材料设计库后收到此错误。重构为建议的androidx名称空间。

这是我的app.gradle文件

申请插件:'kotlin-android' 申请插件:'io.fabric' apply plugin:'com.android.application'

android {
lintOptions {
    checkReleaseBuilds false;
    abortOnError false
}

compileSdkVersion 'android-P'
useLibrary 'org.apache.http.legacy'

defaultConfig {
    applicationId "datazeo.android.dzreader"
    minSdkVersion 21

    targetSdkVersion 27

}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
    }
}

}

repositories {
mavenCentral()

maven {
    url 'https://maven.fabric.io/public'
}

}

dependencies {
implementation 'com.google.firebase:firebase-crash:15.0.2'
implementation 'com.google.firebase:firebase-core:15.0.2'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'org.jetbrains.anko:anko-common:0.9'
implementation 'com.commit451:PhotoView:1.2.4'
implementation('com.crashlytics.sdk.android:crashlytics:2.9.1') {
    transitive = true;

}
implementation 'com.google.android.material:material:1.0.0-alpha1'
implementation 'androidx.appcompat:appcompat:1.0.0-alpha1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0-alpha1'
implementation 'androidx.legacy:legacy-support-core-utils:1.0.0-alpha1'

}

apply plugin: 'com.google.gms.google-services'

}

{"Source":"10.30.110.45:42757","Telemetry":{"node_id_str":"ASR9006","subscription_id_str":"qos","encoding_path":"Cisco-IOS-XR-infra-statsd-oper:infra-statistics/interfaces/interface/latest/data-rate","collection_id":30905218,"collection_start_time":1524503864744,"msg_timestamp":1524503864744,"collection_end_time":1524503864746},"Rows":[{"Timestamp":1524503864746,"Keys":{"interface-name":"Bundle-Ether56"},"Content":{"bandwidth":40000000,"input-data-rate":4300587,"input-load":27,"input-packet-rate":5375721,"load-interval":0,"output-data-rate":12,"output-load":0,"output-packet-rate":5,"peak-input-data-rate":0,"peak-input-packet-rate":0,"peak-output-data-rate":0,"peak-output-packet-rate":0,"reliability":255}}]}

2 个答案:

答案 0 :(得分:10)

具体地说,我通过遵循this post中描述的内容解决了该问题。尽管该帖子没有告诉我们如何解决该问题,但实际上在使用新的AndroidX library时,一切正常运转是必要的。

只需将以下两行添加到 gradle.properties file

android.useAndroidX=true
android.enableJetifier=true

就我而言,仅将IDE更新到Android Studio Canary甚至Android Studio Beta 1并不能解决问题。

答案 1 :(得分:1)

更新到android canary预览为我解决了这个问题。