gradlew.bat app:assembleRelease打不出signed apk

本文介绍了解决Android应用打包过程中未自动进行签名的问题。通过在build.gradle中添加signingConfig配置,确保生成的APK文件能正确完成签名过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

问题:

$cd {project}/android/

$gradlew.bat app:assembleRelease

打出的包没有签名,即只生成:

app-release-unsigned.apk


修复:


需要在android/app/build.gradle 加以下一行:


signingConfig  signingConfigs.releaseConfig



D:\Pull\7007>adb install ATSMode.apk adb: failed to install ATSMode.apk: Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES: Failed collecting certifica tes for /data/app/vmdl1847209380.tmp/base.apk: Failed to collect certificates from /data/app/vmdl1847209380.tm p/base.apk: Attempt to get length of null array] plugins { id 'com.android.application' id 'kotlin-android' } android { def version = rootProject.ext.android compileSdkVersion version.compileSdkVersion namespace "com.adayo.service.atsmode" defaultConfig { applicationId "com.adayo.service.atsmode" minSdkVersion version.minSdkVersion targetSdkVersion version.compileSdkVersion versionCode version.versionCode versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } signingConfigs { release { File strFile = new File("./keystore/platform.keystore") storeFile file(strFile) keyAlias 'platform' keyPassword 'android' storePassword 'android' } debug { File strFile = new File("./keystore/platform.keystore") storeFile file(strFile) keyAlias 'platform' keyPassword 'android' storePassword 'android' } } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } buildFeatures { aidl true } // applicationVariants.all { // variant -> // variant.assemble.finalizedBy "signAndInstall" // } } //task signAndInstall(type: Exec) { // workingDir "../" // commandLine = ["cmd", "/c", "installSystemApk.bat"] //} dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) def dependency = rootProject.ext.dependencies //============================== project config ============================== implementation dependency.rxjava3 implementation dependency.livedata implementation dependency.lottie implementation dependency.rxbinding implementation dependency.liveEventBus implementation dependency.autoDisposeAAC //============================== default config ============================== implementation dependency.appcompat implementation dependency.material implementation dependency.constraintlayout testImplementation 'junit:junit:4.+' androidTestImplementation 'androidx.test.ext:junit:1.1.4' androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0' // implementation project(':aidl-module') }明明我签名文件是OK的,为什么还这样
最新发布
08-06
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值