未找到具有 Flavors 的包名称的匹配客户端
No matching client found for package name with Flavors
我使用 flavor 生成了同一个应用程序的多个版本,其中唯一改变的是样式,但我需要将多个 apk 上传到 playstore,但我在尝试构建项目时遇到问题,标记 "No matching client found for package name"错误。
我的 build.gradle 文件是:
starwing {
applicationId "mx.com.locker.starwing"
versionCode 11
versionName "1.11"
}
puntoarq {
applicationId "mx.com.locker.starwing.puntoarq"
versionCode 1
versionName "1"
}
找不到"mx.com.locker.starwing.puntoarq"
尝试使用 applicationIdSuffix
更改每个产品风味的应用程序 ID,例如:
android {
...
defaultConfig {
applicationId "mx.com.locker"
...
}
productFlavors {
starwing {
applicationIdSuffix ".starwing"
versionCode 11
versionName "1.11"
}
puntoarq {
applicationIdSuffix ".puntoarq"
versionCode 1
versionName "1"
}
}
}
并确保每个口味的 res 文件夹都在各自的目录中,如下所示:
# common/default resources here
app/src/main/res/values
\___ /styles.xml
|___ /colors.xml
\__ ...
# starwing resources here
app/src/starwing/res/values
\___ /styles.xml
|___ /colors.xml
\__ ...
# puntoarq resources here
app/src/puntoarq/res/values
\___ /styles.xml
|___ /colors.xml
\__ ...
源代码文件和 google-services.json
如果您使用某些 google 服务,当然也是如此。
# common/default resources here
app/src/main/google-services.json
# starwing resources here
app/src/starwing/google-services.json
# puntoarq resources here
app/src/puntoarq/google-services.json
您可以从 Android Studio 或 运行 ./gradlew assembleStarwingRelease
或 ./gradlew assemblePuntoarqRelease
.
中选择构建变体来构建您的特定风格
您可以查看 here 了解更多信息。
我使用 flavor 生成了同一个应用程序的多个版本,其中唯一改变的是样式,但我需要将多个 apk 上传到 playstore,但我在尝试构建项目时遇到问题,标记 "No matching client found for package name"错误。
我的 build.gradle 文件是:
starwing {
applicationId "mx.com.locker.starwing"
versionCode 11
versionName "1.11"
}
puntoarq {
applicationId "mx.com.locker.starwing.puntoarq"
versionCode 1
versionName "1"
}
找不到"mx.com.locker.starwing.puntoarq"
尝试使用 applicationIdSuffix
更改每个产品风味的应用程序 ID,例如:
android {
...
defaultConfig {
applicationId "mx.com.locker"
...
}
productFlavors {
starwing {
applicationIdSuffix ".starwing"
versionCode 11
versionName "1.11"
}
puntoarq {
applicationIdSuffix ".puntoarq"
versionCode 1
versionName "1"
}
}
}
并确保每个口味的 res 文件夹都在各自的目录中,如下所示:
# common/default resources here
app/src/main/res/values
\___ /styles.xml
|___ /colors.xml
\__ ...
# starwing resources here
app/src/starwing/res/values
\___ /styles.xml
|___ /colors.xml
\__ ...
# puntoarq resources here
app/src/puntoarq/res/values
\___ /styles.xml
|___ /colors.xml
\__ ...
源代码文件和 google-services.json
如果您使用某些 google 服务,当然也是如此。
# common/default resources here
app/src/main/google-services.json
# starwing resources here
app/src/starwing/google-services.json
# puntoarq resources here
app/src/puntoarq/google-services.json
您可以从 Android Studio 或 运行 ./gradlew assembleStarwingRelease
或 ./gradlew assemblePuntoarqRelease
.
您可以查看 here 了解更多信息。