在flutter依赖项中添加 flutter_local_notifications 0.5.2 后,Android依赖项显示错误“编译和运行时版本不同”
我提到了这个答案Similar problem
之后,我将其添加到build.gradle
subprojects {
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'androidx.slidingpanelayout'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "1.0.0"
}
if (details.requested.group == 'androidx.fragment'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "1.0.0"
}
if (details.requested.group == 'androidx.cursoradapter'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "1.0.0"
}
if (details.requested.group == 'androidx.lifecycle'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "1.0.0"
}
if (details.requested.group == 'androidx.swipefreshlayout'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "1.0.0"
}
if (details.requested.group == 'androidx.loader'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "1.0.0"
}
if (details.requested.group == 'androidx.lifecycle'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "1.0.0"
}
if (details.requested.group == 'androidx.coordinatorlayout'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "1.0.0"
}
if (details.requested.group == 'androidx.drawerLayout'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "1.0.0"
}
if (details.requested.group == 'androidx.legacy'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "1.0.0"
}
if (details.requested.group == 'androidx.customview'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "1.0.0"
}
if (details.requested.group == 'androidx.arch.core'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "2.0.0"
}
}
}
}
如您所见,许多人都面临着依赖问题。
在我再次添加另一个之后,我得到依赖错误。
我已经筋疲力尽,添加了许多if
语句。
任何帮助将不胜感激。