已经定义了所需的存储库变量。

这是管道中的Gradle包装命令
- step:
name: Create Keystores and Google Play API key file
script:
- mkdir keys # create new directory
- echo $DEBUG_KEYSTORE_FILE_BASE64 | base64 -d > keys/$DEBUG_KEYSTORE_FILE # decode base64 then use DEBUG_KEYSTORE_FILE as file name defined in repository variable
- echo $KEYSTORE_FILE_BASE64 | base64 -d > keys/$KEYSTORE_FILE # decode base64 then use KEYSTORE_FILE as file name defined in repository variable
- echo $GOOGLE_PLAY_API_KEY_BASE64 | base64 -d > keys/$GOOGLE_PLAY_API_KEY_FILE # decode base64 then use GOOGLE_PLAY_API_KEY_FILE as file name defined in repository variable
artifacts:
- keys/** # keep these artifacts for subsequent pipeline steps
- step:
name: Build & Deploy (Internal)
caches: # caching speed up subsequent execution https://support.atlassian.com/bitbucket-cloud/docs/cache-dependencies/
- gradle
script:
# publish the aab file to the internal testing channel
# the plugin publishes to the internal testing track by default
- chmod +x gradlew
- "./gradlew
-PANDROID_BUILD_COMPILED_SDK_VERSION=$ANDROID_BUILD_COMPILED_SDK_VERSION
-PANDROID_BUILD_MIN_SDK_VERSION=$ANDROID_BUILD_MIN_SDK_VERSION
-PANDROID_BUILD_TARGET_SDK_VERSION=$ANDROID_BUILD_TARGET_SDK_VERSION
-PDEBUG_KEYSTORE_FILE=../keys/$DEBUG_KEYSTORE_FILE
-PDEBUG_KEYSTORE_PASSWORD=$DEBUG_PASSWORD
-PDEBUG_KEYSTORE_KEY_ALIAS=$DEBUG_KEY_ALIAS
-PDEBUG_KEYSTORE_KEY_PASSWORD=$DEBUG_KEY_PASSWORD
-PAPPNAME_KEYSTORE_FILE=../keys/$KEYSTORE_FILE
-PAPPNAME_KEYSTORE_PASSWORD=$KEYSTORE_PASSWORD
-PAPPNAME_KEY_ALIAS=$KEYSTORE_KEY_ALIAS
-PAPPNAME_KEY_PASSWORD=$KEY_PASSWORD
-PGOOGLE_PLAY_API_KEY=../keys/$GOOGLE_PLAY_API_KEY
-PBUILD_NUMBER=$BITBUCKET_BUILD_NUMBER
clean :app:publishReleaseBundle"
artifacts:
- app/build/outputs/ # artifacts are files that are produced by a step https://support.atlassian.com/bitbucket-cloud/docs/use-artifacts-in-steps/问题是-PDEBUG_KEYSTORE_FILE=../keys/$DEBUG_KEYSTORE_FILE在构建过程中被忽略了,而且无法工作。
Build setup5s
chmod +x gradlew<1s
./gradlew -PANDROID_BUILD_COMPILED_SDK_VERSION=$ANDROID_BUILD_COMPILED_SDK_VERSION -PANDROID_BUILD_MIN_SDK_VERSION=$ANDROID_BUILD_MIN_SDK_VERSION -PANDROID_BUILD_TARGET_SDK_VERSION=$ANDROID_BUILD_TARGET_SDK_VERSION -PDEBUG_KEYSTORE_FILE=../keys/$DEBUG_KEYSTORE_FILE -PDEBUG_KEYSTORE_PASSWORD=$DEBUG_PASSWORD -PDEBUG_KEYSTORE_KEY_ALIAS=$DEBUG_KEY_ALIAS -PDEBUG_KEYSTORE_KEY_PASSWORD=$DEBUG_KEY_PASSWORD -PAPPNAME_KEYSTORE_FILE=../keys/$KEYSTORE_FILE -PAPPNAME_KEYSTORE_PASSWORD=$KEYSTORE_PASSWORD -PAPPNAME_KEY_ALIAS=$KEYSTORE_KEY_ALIAS -PAPPNAME_KEY_PASSWORD=$KEY_PASSWORD -PGOOGLE_PLAY_API_KEY=../keys/$GOOGLE_PLAY_API_KEY -PBUILD_NUMBER=$BITBUCKET_BUILD_NUMBER clean :app:publishFreeReleaseBundle39s
+ ./gradlew -PANDROID_BUILD_COMPILED_SDK_VERSION=$ANDROID_BUILD_COMPILED_SDK_VERSION -PANDROID_BUILD_MIN_SDK_VERSION=$ANDROID_BUILD_MIN_SDK_VERSION -PANDROID_BUILD_TARGET_SDK_VERSION=$ANDROID_BUILD_TARGET_SDK_VERSION
-PDEBUG_KEYSTORE_FILE=../keys/$DEBUG_KEYSTORE_FILE -PDEBUG_KEYSTORE_PASSWORD=$DEBUG_PASSWORD -PDEBUG_KEYSTORE_KEY_ALIAS=$DEBUG_KEY_ALIAS -PDEBUG_KEYSTORE_KEY_PASSWORD=$DEBUG_KEY_PASSWORD
-PAPPNAME_KEYSTORE_FILE=../keys/$KEYSTORE_FILE -PAPPNAME_KEYSTORE_PASSWORD=$KEYSTORE_PASSWORD -PAPPNAME_KEY_ALIAS=$KEYSTORE_KEY_ALIAS -PAPPNAME_KEY_PASSWORD=$KEY_PASSWORD
-PGOOGLE_PLAY_API_KEY=../keys/$GOOGLE_PLAY_API_KEY
-PBUILD_NUMBER=$BITBUCKET_BUILD_NUMBER
clean :app:publishFreeReleaseBundle
Downloading https://services.gradle.org/distributions/gradle-7.0-bin.zip
...........................................................................................................
Unzipping /root/.gradle/wrapper/dists/gradle-7.0-bin/2p9ebqfz6ilrfozi676ogco7n/gradle-7.0-bin.zip to /root/.gradle/wrapper/dists/gradle-7.0-bin/2p9ebqfz6ilrfozi676ogco7n
Set executable permissions for: /root/.gradle/wrapper/dists/gradle-7.0-bin/2p9ebqfz6ilrfozi676ogco7n/gradle-7.0/bin/gradle
Welcome to Gradle 7.0!
Here are the highlights of this release:
- File system watching enabled by default
- Support for running with and building Java 16 projects
- Native support for Apple Silicon processors
- Dependency catalog feature preview
For more details see https://docs.gradle.org/7.0/release-notes.html
Starting a Gradle Daemon (subsequent builds will be faster)
FAILURE: Build failed with an exception.
* Where:
Build file '/opt/atlassian/pipelines/agent/build/app/build.gradle' line: 27
* What went wrong:
A problem occurred evaluating project ':app'.
> Could not get unknown property 'DEBUG_KEYSTORE_FILE' for SigningConfig_Decorated{name=debug, storeFile=/opt/android-sdk-linux/.android/debug.keystore, storePassword=android, keyAlias=AndroidDebugKey, keyPassword=android, storeType=pkcs12, v1SigningEnabled=true, v2SigningEnabled=true, enableV1Signing=null, enableV2Signing=null, enableV3Signing=null, enableV4Signing=null} of type com.android.build.gradle.internal.dsl.SigningConfig.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 39s然而,为了进一步测试它,我尝试删除-PANDROID_BUILD_COMPILED_SDK_VERSION=$ANDROID_BUILD_COMPILED_SDK_VERSION参数,错误现在在compileSdk上。
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* Where:
Build file '/opt/atlassian/pipelines/agent/build/app/build.gradle' line: 13
* What went wrong:
A problem occurred evaluating project ':app'.
> Could not get unknown property 'ANDROID_BUILD_COMPILED_SDK_VERSION' for extension 'android' of type com.android.build.gradle.internal.dsl.BaseAppModuleExtension.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':app'.
> compileSdkVersion is not specified. Please add it to build.gradle
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/7.0/userguide/command_line_interface.html#sec:command_line_warnings
* Get more help at https://help.gradle.org
BUILD FAILED in 39s使用此方法,我假设参数运行良好,但在签名方面,我自己的签名配置似乎被忽略了。
这是应用程序Gradle文件的样子。
android {
compileSdk Integer.parseInt(ANDROID_BUILD_COMPILED_SDK_VERSION)
defaultConfig {
applicationId "com.app.name"
minSdk Integer.parseInt(ANDROID_BUILD_MIN_SDK_VERSION)
targetSdk Integer.parseInt(ANDROID_BUILD_TARGET_SDK_VERSION)
versionCode project.hasProperty('BUILD_NUMBER') ? project['BUILD_NUMBER'].toInteger() : 14
versionName "1.3.3"
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
signingConfigs {
debug {
storeFile file(DEBUG_KEYSTORE_FILE)
storePassword DEBUG_KEYSTORE_PASSWORD
keyAlias DEBUG_KEYSTORE_KEY_ALIAS
keyPassword DEBUG_KEYSTORE_KEY_PASSWORD
}
release {
storeFile file(APPNAME_KEYSTORE_FILE)
storePassword APPNAME_KEYSTORE_PASSWORD
keyAlias APPNAME_KEYSTORE_KEY_ALIAS
keyPassword APPNAME_KEYSTORE_KEY_PASSWORD
}
}
buildTypes {
debug {
debuggable true
minifyEnabled true
shrinkResources true
multiDexEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.debug
}
release {
debuggable false
minifyEnabled true
shrinkResources true
multiDexEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
compileOptions {
// Flag to enable support for the new language APIs
coreLibraryDesugaringEnabled true
// Sets Java compatibility to Java 8
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
lintOptions {
disable "MissingClass"
}
buildFeatures {
viewBinding true
}
}
play {
serviceAccountCredentials.set(file(GOOGLE_PLAY_API_KEY_FILE))
}更新:,它似乎并不是特定于调试签名,而是使用发行版I get Could not get unknown property 'APPNAME_KEYSTORE_FILE'
在Android终端上本地运行它,但在管道中它不工作。
如果文件路径或位置是问题所在,则错误消息不应该是Could not get unknown property。
发布于 2021-07-09 08:18:12
首先消除之间的间隔
-PANDROID_BUILD_TARGET_SDK_VERSION=$ANDROID_BUILD_TARGET_SDK_VERSION
-PDEBUG_KEYSTORE_FILE=../keys/$DEBUG_KEYSTORE_FILE下至
-PBUILD_NUMBER=$BITBUCKET_BUILD_NUMBER
clean :app:publishReleaseBundle不应该有任何空间,正如您指出的,-PANDROID_BUILD_COMPILED_SDK_VERSION正在工作。放置新的行空间会使命令不完整。
它将修复您当前的问题,,但您将遇到另一个问题,因为您的环境变量与命令任务和Bitbucket存储库变量页不匹配。在命令或网站上更改您的变量名。
在BB页面中,没有名为DEBUG_KEY_PASSWORD的变量。
重复检查命令任务和Bitbucket存储库变量中的其他变量和属性,您可能还遗漏了另一个变量和属性。
发布于 2021-07-09 07:46:25
在规范中的竹类变量前缀为bamboo_,如https://confluence.atlassian.com/bamboo/bamboo-variables-289277087.html所示。例如,$DEBUG_KEYSTORE_FILE变成了$bamboo_DEBUG_KEYSTORE_FILE。
https://stackoverflow.com/questions/68218878
复制相似问题