android - Android Material Design Library 错误 - 程序类型已存在:android.support.v4.app.INotificationSideChannel$Stub
问题描述
我在尝试使用新的 Material Design 库运行我的应用程序时遇到了这个问题,请有解决方案的人吗?
日志:
执行任务:[:app:assembleProdDebug]
:app:preBuild 最新 :app:preProdDebugBuild 最新 :app:compileProdDebugAidl 最新 :app:compileProdDebugRenderscript 最新 :app:checkProdDebugManifest 最新 :app:generateProdDebugBuildConfig UP -TO-DATE :app:prepareLintJar UP-TO-DATE :app:mainApkListPersistenceProdDebug UP-TO-DATE :app:generateProdDebugResValues UP-TO-DATE :app:generateProdDebugResources UP-TO-DATE :app:mergeProdDebugResources UP-TO-DATE : app:createProdDebugCompatibleScreenManifests UP-TO-DATE :app:processProdDebugManifest UP-TO-DATE :app:splitsDiscoveryTaskProdDebug UP-TO-DATE :app:processProdDebugResources :app:generateProdDebugSources :app:javaPreCompileProdDebug 注意:一些输入文件使用未经检查或不安全的操作。注意:使用 -Xlint:unchecked 重新编译以获取详细信息。:app:compileProdDebugJavaWithJavac :app:
FAILURE:构建失败并出现异常。
我正在使用 Android Studio 3.1.3
最高等级:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
// Define versions in a single place
ext {
// Sdk and tools
minSdkVersion = 15
targetSdkVersion = 27
compileSdkVersion = 'android-P'
buildToolsVersion = '28.0.0-rc2'
// App dependencies
supportLibraryVersion = '28.0.0-alpha1'
constraintLayout = '1.1.0'
volley = '1.0.0'
gson = '2.7'
butterKnife = '8.8.1'
analytics = '16.0.0'
guavaVersion = '18.0'
picassoVersion = '2.5.2'
junitVersion = '4.12'
mockitoVersion = '1.10.19'
powerMockito = '1.6.2'
hamcrestVersion = '1.3'
runnerVersion = '1.1.0-alpha1'
rulesVersion = '1.1.0-alpha1'
espressoVersion = '3.1.0-alpha3'
}
应用 Gradle 文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
applicationId "com.test.bnl"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
debug {
// Run code coverage reports by default on debug builds.
// testCoverageEnabled = true
applicationIdSuffix ".debug"
debuggable true
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
// Specifies flavor dimensions.
flavorDimensions "default"
// If you need to add more flavors, consider using flavor dimensions.
productFlavors {
mock {
applicationIdSuffix ".mock"
versionNameSuffix "-mock"
}
prod {
applicationIdSuffix ".prod"
versionNameSuffix "-prod"
}
}
// Remove mockRelease as it's not needed.
android.variantFilter { variant ->
if (variant.buildType.name == 'release' && variant.getFlavors().get(0).name == 'mock') {
variant.setIgnore(true)
}
}
// Always show the result of every unit test, even if it passes.
testOptions.unitTests.all {
testLogging {
events 'passed', 'skipped', 'failed', 'standardOut', 'standardError'
}
}
}
/*
Dependency versions are defined in the top level build.gradle file. This helps keeping track of
all versions in a single place. This improves readability and helps managing project complexity.
*/
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
// App's dependencies, including test
implementation 'com.google.android.material:material:1.0.0-alpha3'
implementation "com.google.guava:guava:$rootProject.guavaVersion"
implementation "com.squareup.picasso:picasso:$rootProject.picassoVersion"
implementation "androidx.test.espresso:espresso-idling-resource:$rootProject.ext.espressoVersion"
implementation "com.android.volley:volley:$rootProject.ext.volley"
implementation "com.google.code.gson:gson:$rootProject.ext.gson"
implementation "com.google.android.gms:play-services-analytics:$rootProject.ext.analytics"
// Dependencies for local unit tests
testImplementation "junit:junit:$rootProject.ext.junitVersion"
testImplementation "org.mockito:mockito-all:$rootProject.ext.mockitoVersion"
testImplementation "org.hamcrest:hamcrest-all:$rootProject.ext.hamcrestVersion"
testImplementation "org.powermock:powermock-module-junit4:$rootProject.ext.powerMockito"
testImplementation "org.powermock:powermock-api-mockito:$rootProject.ext.powerMockito"
// Android Testing Library's runner and rules
androidTestImplementation "androidx.test:runner:$rootProject.ext.runnerVersion"
androidTestImplementation "androidx.test:rules:$rootProject.ext.rulesVersion"
// Espresso UI Testing dependencies.
androidTestImplementation "androidx.test.espresso:espresso-core:$rootProject.ext.espressoVersion"
androidTestImplementation "androidx.test.espresso:espresso-contrib:$rootProject.ext.espressoVersion"
androidTestImplementation "androidx.test.espresso:espresso-intents:$rootProject.ext.espressoVersion"
implementation 'junit:junit:4.12'
}
Gradle.properties:
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
android.useAndroidX=true
android.enableJetifier=false
如果需要更多信息,请告诉我!
解决方案
迁移到 androidx 或升级你的 build.gradle 版本
推荐阅读
- android - Volley - API 调用数据未显示在回收站视图中
- javascript - 查找具有连续差 = k 的数组中的子序列总数
- python - 如果数据框中的列名相同,则连接列
- laravel - 尝试在 Laravel 中上传文件时显示 XAMPP 目录
- google-chrome - 关于 Web 浏览器中的 gRPC 支持以及它们如何利用 HTTP2 的问题
- python - serializer.save 在 Django 中没有更新
- c++ - QT C++如何从QThread返回QImage并将其显示在QMainWindow的QLabel上?
- ansible - 使用 ansible playbook 在多个服务器中顺序部署
- android - Android中xy位置动态添加视图| 办公桌预订
- javascript - HTML SVG 响应大小