1, local gradle version to match android studio in gradle plug-in, otherwise it will prompt an error when packaging items outside the android studio.
The local version 4.5.1 to 5.5.1 modified by, and modify the path gradle_name the .bash_profile file.
lishuaikangdeMacBook-Pro:waiter lishuaikang$ gradle assembleDebug
Starting a Gradle Daemon, 1 busy and 1 incompatible Daemons could not be reused, use --status for details
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/lishuaikang/AndroidStudioProjects/waiter/app/build.gradle' line: 1
* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin [id 'com.android.application']
> Minimum supported Gradle version is 5.1.1. Current version is 4.5.1. If using the gradle wrapper, try editing the distributionUrl in /Users/lishuaikang/AndroidStudioProjects/waiter/gradle/wrapper/gradle-wrapper.properties to gradle-5.1.1-all.zip
* 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 4s
android project gradle packaged compilation error, suggesting android gradle tool support a minimum of gradle version 5.1.1. But I locally installed version is 4.5.1.
2, the command can play develop, produce two different versions. Build.gradle modify the project file:
signingConfigs {
debug {
storeFile file('/Users/lishuaikang/.android/debug.keystore')
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
// v1SigningEnabled true
// v2SigningEnabled true
}
release {
storeFile file('/Users/lishuaikang/Documents/release.keystore')
storePassword 'android'
keyAlias 'androidreleasekey'
keyPassword 'android'
// v1SigningEnabled true
// v2SigningEnabled true
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.debug
}
}
Are arranged on the path to the certificate and password, and alias.
Packaging execute the command:
gradle assembleDebug
gradle assembleRelease
They are the development version and a production version.
But it is given:
Failed to generate v1 signature
I do not know what out why.
Delete the old certificate and re-generate the certificate. All right.
3, certificate generation.
lishuaikangdeMacBook-Pro:Documents lishuaikang$ keytool -genkey -alias androidreleasekey -keyalg RSA -validity 10000 -keystore release.keystore
输入密钥库口令:
再次输入新口令:
您的名字与姓氏是什么?
[Unknown]: shuaikangli
您的组织单位名称是什么?
[Unknown]: hq
您的组织名称是什么?
[Unknown]: hq
您所在的城市或区域名称是什么?
[Unknown]: hangzhou
您所在的省/市/自治区名称是什么?
[Unknown]: zhejiang
该单位的双字母国家/地区代码是什么?
[Unknown]: zh
CN=shuaikangli, OU=hq, O=hq, L=hangzhou, ST=zhejiang, C=zh是否正确?
[否]: 是
输入 <androidreleasekey> 的密钥口令
(如果和密钥库口令相同, 按回车):
Warning:
JKS 密钥库使用专用格式。建议使用 "keytool -importkeystore -srckeystore release.keystore -destkeystore release.keystore -deststoretype pkcs12" 迁移到行业标准格式 PKCS12。
lishuaikangdeMacBook-Pro:Documents lishuaikang$ ls
apache-maven-3.6.0 gradle-4.5.1 gradle-5.5.1 rabbitmq_server-3.6.15 release.keystore zookeeper-3.4.12
lishuaikangdeMacBook-Pro:Documents lishuaikang$
Specific not explain, follow the prompts on the line.
keytool -genkey -alias androidreleasekey -keyalg RSA -validity 10000 -keystore release.keystore
command