11import { cache } from "../common/decorators" ;
22import { ValidatePlatformCommandBase } from "./command-base" ;
3+ import { hasValidAndroidSigning } from "../common/helpers" ;
4+ import { ANDROID_RELEASE_BUILD_ERROR_MESSAGE , ANDROID_APP_BUNDLE_SIGNING_ERROR_MESSAGE } from "../constants" ;
35
46export class DebugPlatformCommand extends ValidatePlatformCommandBase implements ICommand {
57 public allowedParameters : ICommandParameter [ ] = [ ] ;
@@ -155,7 +157,8 @@ export class DebugAndroidCommand implements ICommand {
155157 private $devicePlatformsConstants : Mobile . IDevicePlatformsConstants ,
156158 private $injector : IInjector ,
157159 private $projectData : IProjectData ,
158- private $markingModeService : IMarkingModeService ) {
160+ private $markingModeService : IMarkingModeService ,
161+ private $options : IOptions ) {
159162 this . $projectData . initializeProjectData ( ) ;
160163 }
161164
@@ -164,8 +167,18 @@ export class DebugAndroidCommand implements ICommand {
164167 return this . debugPlatformCommand . execute ( args ) ;
165168 }
166169 public async canExecute ( args : string [ ] ) : Promise < boolean > {
167- const result = await this . debugPlatformCommand . canExecute ( args ) ;
168- return result ;
170+ const canExecuteBase = await this . debugPlatformCommand . canExecute ( args ) ;
171+ if ( canExecuteBase ) {
172+ if ( this . $options . aab && ! hasValidAndroidSigning ( this . $options ) ) {
173+ if ( this . $options . release ) {
174+ this . $errors . failWithHelp ( ANDROID_RELEASE_BUILD_ERROR_MESSAGE ) ;
175+ } else {
176+ this . $errors . failWithHelp ( ANDROID_APP_BUNDLE_SIGNING_ERROR_MESSAGE ) ;
177+ }
178+ }
179+ }
180+
181+ return canExecuteBase ;
169182 }
170183
171184 public platform = this . $devicePlatformsConstants . Android ;
0 commit comments