【发布时间】:2019-01-25 20:22:23
【问题描述】:
我知道它可能看起来像 This Question,但我无法使用建议的解决方案修复它,我也无法对此发表评论。 错误是:
Program type already present:
android.support.v4.app.INotificationSideChannel$Stub$Proxy
Message{kind=ERROR, text=Program type already present:
android.support.v4.app.INotificationSideChannel$Stub$Proxy, sources=[Unknown
source file], tool name=Optional.of(D8)}
我正在尝试使用 firebase 创建一个应用程序,这是我的 gradle 文件
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 27
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
aaptOptions {
noCompress "tflite"
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.0.0-rc01'
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'
implementation 'com.google.android.material:material:1.0.0-rc01'
implementation 'androidx.cardview:cardview:1.0.0-rc01'
// ML Kit dependencies
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-ml-vision:17.0.0'
}
apply plugin: 'com.google.gms.google-services'
我传递每个文件以确保导入是好的,我还添加了
android.useAndroidX = true
android.enableJetifier = false
这是我的项目 Gradle 文件:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.google.gms:google-services:4.1.0'
// 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
}
我使用 Android Studio 3.1.4
【问题讨论】:
-
现在,我只是停止使用androidx,它工作得尽可能好,我仍然希望能够找到问题并合并到androidx
-
我回答了here。希望它对你有用。
-
感谢@AshuTyagi,我能够迁移。我使用您的solution + Refractor > Migrate to AndroidX。之后,我查看我的导入以手动将它们迁移到 androidx(例如 Nullable)。它编译并运行,但我的应用程序无法再在我的设备上启动,我必须找出原因,但仍然比以前更接近解决方案。
-
libGDX 项目检查这个:stackoverflow.com/a/61377080/5733853
标签: android android-studio gradle androidx