@@ -82,14 +82,15 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
82
82
platformProjectService : this ,
83
83
emulatorServices : this . $androidEmulatorServices ,
84
84
projectRoot : projectRoot ,
85
- deviceBuildOutputPath : path . join ( ...deviceBuildOutputArr ) ,
85
+ deviceBuildOutputPath : this . getDeviceBuildOutputPath ( path . join ( ...deviceBuildOutputArr ) , projectData ) ,
86
86
getValidPackageNames : ( buildOptions : { isReleaseBuild ?: boolean , isForDevice ?: boolean } ) : string [ ] => {
87
87
const buildMode = buildOptions . isReleaseBuild ? Configurations . Release . toLowerCase ( ) : Configurations . Debug . toLowerCase ( ) ;
88
88
89
89
return [
90
90
`${ packageName } -${ buildMode } .apk` ,
91
91
`${ projectData . projectName } -${ buildMode } .apk` ,
92
- `${ projectData . projectName } .apk`
92
+ `${ projectData . projectName } .apk` ,
93
+ `app-${ buildMode } .apk`
93
94
] ;
94
95
} ,
95
96
frameworkFilesExtensions : [ ".jar" , ".dat" , ".so" ] ,
@@ -104,6 +105,22 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
104
105
return this . _platformData ;
105
106
}
106
107
108
+ private getDeviceBuildOutputPath ( currentPath : string , projectData : IProjectData ) : string {
109
+ const currentPlatformData : IDictionary < any > = this . $projectDataService . getNSValue ( projectData . projectDir , constants . TNS_ANDROID_RUNTIME_NAME ) ;
110
+ const platformVersion = currentPlatformData && currentPlatformData [ constants . VERSION_STRING ] ;
111
+ const normalizedPath = path . join ( currentPath , "debug" ) ;
112
+
113
+ if ( semver . valid ( platformVersion ) ) {
114
+ const gradleAndroidPluginVersion3xx = "4.0.0" ;
115
+ const normalizedPlatformVersion = `${ semver . major ( platformVersion ) } .${ semver . minor ( platformVersion ) } .0` ;
116
+ if ( semver . lt ( normalizedPlatformVersion , gradleAndroidPluginVersion3xx ) ) {
117
+ return currentPath ;
118
+ }
119
+ }
120
+
121
+ return normalizedPath ;
122
+ }
123
+
107
124
// TODO: Remove prior to the 4.0 CLI release @Pip3r4o @PanayotCankov
108
125
// Similar to the private method of the same name in platform-service.
109
126
private getCurrentPlatformVersion ( platformData : IPlatformData , projectData : IProjectData ) : string {
0 commit comments