每当我implemntation 'com.google.android.material:material:1.0.0-alpha1'尝试构建项目时添加时,Android Studio都会说:
implemntation 'com.google.android.material:material:1.0.0-alpha1'
程序类型已存在:android.support.v4.app.INotificationSideChannel $ Stub $ Proxy消息{种类=错误,文本=程序已存在:android.support.v4.app.INotificationSideChannel $ Stub $ Proxy,来源= [未知来源文件],工具名称= Optional.of(D8)}
这是我的gradle脚本:
apply plugin: 'com.android.application' android { compileSdkVersion 'android-P' defaultConfig { applicationId "it.smart.bab3" minSdkVersion 21 targetSdkVersion 'p' versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'com.android.support:appcompat-v7:28.0.0-alpha1' implementation 'com.google.android.material:material:1.0.0-alpha1' implementation 'com.android.support.constraint:constraint-layout:1.1.0' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' implementation 'com.android.support:design:28.0.0-alpha1' implementation 'com.android.support:support-v4:28.0.0-alpha1' }
我是这种类型的错误的新手,但我没有发现与此错误有关的任何一种。谢谢
我也整天都在努力解决这个问题。最终,我成功地编译并运行了该项目。
首先,摆脱这一点:
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1' implementation 'com.android.support:design:28.0.0-alpha1' implementation 'com.android.support:support-v4:28.0.0-alpha1'
在gradle.properties文件中添加以下内容:
android.useAndroidX = true android.enableJetifier = false
最后,同步项目,然后进行编译。
如果不起作用,请清理项目,然后重新生成。
PS:我无法使targetSdkVersion’p’正常工作。我的build.gradle文件最终如下:
apply plugin: 'com.android.application' android { compileSdkVersion 'android-P' defaultConfig { applicationId "com.github.alvarosct02.demo" minSdkVersion 19 targetSdkVersion 27 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'com.google.android.material:material:1.0.0-alpha1' implementation 'com.android.support.constraint:constraint-layout:1.1.0' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' }
希望它也对你有用。