我使用keytool,jarsigner和zipalign实用程序签署了APK。
我使用了以下命令:
keytool -genkey -v -keystore myAppTransporterKey.keystore -alias myTransporter -keyalg RSA -keysize 2048 -validity 10000
cordova插件rm cordova-plugin-console
cordova build --release android
jarsigner -verbose -keystore C:\Users\ali\Documents\transporterApp\myAppKey.keystore C:\Users\ali\Documents\transporterApp\platforms\android\build\outputs\apk\android-release-unsigned.apk myTransporter
jarsigner -verify C:\Users\ali\Documents\transporterApp\platforms\android\build\outputs\apk\android-release-unsigned.apk
运行后:
jarsigner -verify -verbose -certs C:\Users\ali\Documents\transporterApp\platforms\android\build\outputs\apk\android-release-unsigned.apk
收到此消息:jar验证
运行后:
zipalign -v 4 C:\Users\ali\Documents\transporterApp\platforms\android\build\outputs\apk\android-release-unsigned.apk C:\Users\ali\Documents\transporterApp\platforms\android\build\outputs\apk\myTransporter-Final.apk
得到消息:验证成功
在谷歌播放控制台上传到ALPHA后,我收到以下错误消息
上传新的APK到Alpha
上传
您上传了一个带有无效签名的APK(详细了解签名)。来自apksigner的错误:ERROR(Jar签名者D2DTRANS.RSA):JAR签名META-INF / D2DTRANS.RSA使用摘要算法2.16.840.1.101.3.4.2.1和签名算法1.2.840.113549.1.1.1 API不支持等级[[16,17]]
你需要这些步骤:
1)jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore C:\ Users \ ali \ Documents \ transporterApp \ myAppKey.keystore C:\ Users \ ali \ Documents \ transporterApp \ platforms \ _android \ build \ outputs \ apk \ android- release-unsigned.apk myTransporter
2)jarsigner -verify C:\ Users \ ali \ Documents \ transporterApp \ platforms \ android \ build \ outputs \ apk \ android-release-unsigned.apk
3)zipalign -v 4 C:\ Users \ ali \ Documents \ transporterApp \ platforms \ android \ build \ outputs \ apk \ android-release-unsigned.apk C:\ Users \ ali \ Documents \ transporterApp \ platforms \ android \ build \输出\ APK \ myTransporter-Final.apk
希望这会帮助你^^
您需要以下步骤:
zipalign -v 4 C:\Users\ali\Documents\transporterApp\platforms\android\build\outputs\apk\android-release-unsigned.apk C:\Users\ali\Documents\transporterApp\platforms\android\build\outputs\apk\android-release-unsigned-aligned.apk
apksigner sign --ks C:\Users\ali\Documents\transporterApp\myAppKey.keystore --ks-pass pass:[PASSWORD] --key-pass pass:[PASSWORD] --out C:\Users\ali\Documents\transporterApp\platforms\android\build\outputs\apk\android-release-singned.apk C:\Users\ali\Documents\transporterApp\platforms\android\build\outputs\apk\android-release-unsigned-aligned.apk
要签署应用程序,请使用BuildTools 24.0.3
https://developer.android.com/studio/releases/build-tools.html
根据official documentation,您可以执行以下步骤:
.apk
文件zipalign -v -p 4 my-app-unsigned.apk my-app-unsigned-aligned.apk
apksigner sign --ks my-release-key.jks --out my-app-release.apk my-app-unsigned-aligned.apk
您可能需要使用--ks-type
选项定义密钥库的类型:
~/Android/Sdk/build-tools/26.0.2/apksigner sign --ks-type pkcs12 --ks ~/[…].p12 \
--out android-release-signed-aligned.apk android-release-unsigned-aligned.apk
这已在Android SDK Build Tools 26.0.2中发布的apksigner 0.8中修复。
如果任何问题仍然存在,请在Google issue tracker报告,他们将重新开放审查。