Android 升级到gradle 3时出现应用程序build.gradle同步问题;
我正在更新一个项目,所有项目都有许多不同的库和风格。我能够解决项目中的所有LIB,但在更新app build.gradle时我面临一个问题。下面是错误和梯度。我显然误解了文件,无法找到正确的解决方案。如何在app build.gradle级别解决此同步问题 错误Android 升级到gradle 3时出现应用程序build.gradle同步问题;,android,gradle,android-gradle-plugin,Android,Gradle,Android Gradle Plugin,我正在更新一个项目,所有项目都有许多不同的库和风格。我能够解决项目中的所有LIB,但在更新app build.gradle时我面临一个问题。下面是错误和梯度。我显然误解了文件,无法找到正确的解决方案。如何在app build.gradle级别解决此同步问题 错误 Unable to resolve dependency for ':app@magicDebug/compileClasspath': Could not resolve project :vnfmdata. Could not r
Unable to resolve dependency for ':app@magicDebug/compileClasspath': Could not resolve project :vnfmdata.
Could not resolve project :vnfmdata.
Required by:
project :app
> Project :app declares a dependency from configuration 'implementation' to configuration 'regularDebug' which is not declared in the descriptor for project :vnfmdata.
App build.gradle
android {
...
flavorDimensions flavor.default
productFlavors {
...
magic {
...
flavorDimensions flavor.default
// missingDimensionStrategy flavor.regular, flavor.regular
// matchingFallbacks = [flavor.regular]
dependencies {
...
implementation project(':vnfmdata')
// implementation project(path: ':vnfmdata', configuration: 'regularDebug') // pre gradle 3.0
...
}
}
}
}
android {
...
flavorDimensions flavor.no_meridian, flavor.regular
productFlavors {
regular {
dimension flavor.regular
// Forces regular's flavor to point on LocationService meridian's flavor
// because their flavors' name are different
matchingFallbacks = [flavor.meridian]
}
no_meridian {
dimension flavor.no_meridian
// Will automatically point on LocationService no_meridian's flavor
// because they both have the same name
}
}
buildTypes {
release {}
}
...
}
dependencies {
...
implementation project(':vnlocationservice')
...
}
android {
...
/** Flavors **/
flavorDimensions flavor.meridian, flavor.no_meridian
productFlavors {
no_meridian {
dimension flavor.no_meridian
}
meridian {
dimension flavor.meridian
dependencies {
implementation project(':third:Sas-Android')
implementation deps.support.compat_v26
implementation deps.play.ads
implementation deps.play.location
implementation deps.localytics
implementation 'com.arubanetworks.meridian:meridian:+@aar'
}
}
}
buildTypes {
release {}
}
...
}
dependencies {
...
}
...
//With only one dimension, you can omit 'dimension' into your flavors
flavorDimensions flavor.default
productFlavors {
no_meridian {
dimension flavor.default
}
meridian {
dimension flavor.default
dependencies {
...
}
}
}
\uuuuuuuuuuuuuuuuuuuuuuuuu低于gradle的sync fine的两个LIB\uuuuuuuuuuuuuuuuuu
vnfmdatabuild.gradle
android {
...
flavorDimensions flavor.default
productFlavors {
...
magic {
...
flavorDimensions flavor.default
// missingDimensionStrategy flavor.regular, flavor.regular
// matchingFallbacks = [flavor.regular]
dependencies {
...
implementation project(':vnfmdata')
// implementation project(path: ':vnfmdata', configuration: 'regularDebug') // pre gradle 3.0
...
}
}
}
}
android {
...
flavorDimensions flavor.no_meridian, flavor.regular
productFlavors {
regular {
dimension flavor.regular
// Forces regular's flavor to point on LocationService meridian's flavor
// because their flavors' name are different
matchingFallbacks = [flavor.meridian]
}
no_meridian {
dimension flavor.no_meridian
// Will automatically point on LocationService no_meridian's flavor
// because they both have the same name
}
}
buildTypes {
release {}
}
...
}
dependencies {
...
implementation project(':vnlocationservice')
...
}
android {
...
/** Flavors **/
flavorDimensions flavor.meridian, flavor.no_meridian
productFlavors {
no_meridian {
dimension flavor.no_meridian
}
meridian {
dimension flavor.meridian
dependencies {
implementation project(':third:Sas-Android')
implementation deps.support.compat_v26
implementation deps.play.ads
implementation deps.play.location
implementation deps.localytics
implementation 'com.arubanetworks.meridian:meridian:+@aar'
}
}
}
buildTypes {
release {}
}
...
}
dependencies {
...
}
...
//With only one dimension, you can omit 'dimension' into your flavors
flavorDimensions flavor.default
productFlavors {
no_meridian {
dimension flavor.default
}
meridian {
dimension flavor.default
dependencies {
...
}
}
}
vLocationService build.gradle
android {
...
flavorDimensions flavor.default
productFlavors {
...
magic {
...
flavorDimensions flavor.default
// missingDimensionStrategy flavor.regular, flavor.regular
// matchingFallbacks = [flavor.regular]
dependencies {
...
implementation project(':vnfmdata')
// implementation project(path: ':vnfmdata', configuration: 'regularDebug') // pre gradle 3.0
...
}
}
}
}
android {
...
flavorDimensions flavor.no_meridian, flavor.regular
productFlavors {
regular {
dimension flavor.regular
// Forces regular's flavor to point on LocationService meridian's flavor
// because their flavors' name are different
matchingFallbacks = [flavor.meridian]
}
no_meridian {
dimension flavor.no_meridian
// Will automatically point on LocationService no_meridian's flavor
// because they both have the same name
}
}
buildTypes {
release {}
}
...
}
dependencies {
...
implementation project(':vnlocationservice')
...
}
android {
...
/** Flavors **/
flavorDimensions flavor.meridian, flavor.no_meridian
productFlavors {
no_meridian {
dimension flavor.no_meridian
}
meridian {
dimension flavor.meridian
dependencies {
implementation project(':third:Sas-Android')
implementation deps.support.compat_v26
implementation deps.play.ads
implementation deps.play.location
implementation deps.localytics
implementation 'com.arubanetworks.meridian:meridian:+@aar'
}
}
}
buildTypes {
release {}
}
...
}
dependencies {
...
}
...
//With only one dimension, you can omit 'dimension' into your flavors
flavorDimensions flavor.default
productFlavors {
no_meridian {
dimension flavor.default
}
meridian {
dimension flavor.default
dependencies {
...
}
}
}
您的模块当前没有维度,因此您应该只使用一个维度,就像在应用程序的build.gradle
flavorDimensions flavor.default
中一样
(请参阅的这一部分,并查看使用标注时的多个输出。)
vnfmdata
...
//With only one dimension, you can omit 'dimension' into your flavors
flavorDimensions flavor.default
productFlavors {
regular {
dimension flavor.default
...
}
no_meridian {
dimension flavor.default
}
}
vLocationService
android {
...
flavorDimensions flavor.default
productFlavors {
...
magic {
...
flavorDimensions flavor.default
// missingDimensionStrategy flavor.regular, flavor.regular
// matchingFallbacks = [flavor.regular]
dependencies {
...
implementation project(':vnfmdata')
// implementation project(path: ':vnfmdata', configuration: 'regularDebug') // pre gradle 3.0
...
}
}
}
}
android {
...
flavorDimensions flavor.no_meridian, flavor.regular
productFlavors {
regular {
dimension flavor.regular
// Forces regular's flavor to point on LocationService meridian's flavor
// because their flavors' name are different
matchingFallbacks = [flavor.meridian]
}
no_meridian {
dimension flavor.no_meridian
// Will automatically point on LocationService no_meridian's flavor
// because they both have the same name
}
}
buildTypes {
release {}
}
...
}
dependencies {
...
implementation project(':vnlocationservice')
...
}
android {
...
/** Flavors **/
flavorDimensions flavor.meridian, flavor.no_meridian
productFlavors {
no_meridian {
dimension flavor.no_meridian
}
meridian {
dimension flavor.meridian
dependencies {
implementation project(':third:Sas-Android')
implementation deps.support.compat_v26
implementation deps.play.ads
implementation deps.play.location
implementation deps.localytics
implementation 'com.arubanetworks.meridian:meridian:+@aar'
}
}
}
buildTypes {
release {}
}
...
}
dependencies {
...
}
...
//With only one dimension, you can omit 'dimension' into your flavors
flavorDimensions flavor.default
productFlavors {
no_meridian {
dimension flavor.default
}
meridian {
dimension flavor.default
dependencies {
...
}
}
}
再次感谢。我现在明白它是怎么工作的了。我唯一的问题是,某些应用程序风格依赖于一些本地库,但所有的应用程序风格都要求对libs风格进行匹配回退。即使LIB不使用,我是否需要在每个应用程序风格中为LIB设置匹配的后备方案?或者有没有办法强制忽略错误?@EugeneH由本地库定义,您指的是jar文件还是模块?