@@ -83,18 +83,19 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
8383 platformProjectService : this ,
8484 emulatorServices : this . $androidEmulatorServices ,
8585 projectRoot : projectRoot ,
86- getDeviceBuildOutputPath : ( options : IRelease ) : string => {
87- return this . getDeviceBuildOutputPath ( path . join ( ...deviceBuildOutputArr ) , projectData , options ) ;
88- } ,
89- getValidPackageNames : ( buildOptions : { isReleaseBuild ?: boolean , isForDevice ?: boolean } ) : string [ ] => {
86+ deviceBuildOutputPath : path . join ( ...deviceBuildOutputArr ) ,
87+ getValidBuildOutputData : ( buildOptions : IBuildOutputOptions ) : IValidBuildOutputData => {
9088 const buildMode = buildOptions . isReleaseBuild ? Configurations . Release . toLowerCase ( ) : Configurations . Debug . toLowerCase ( ) ;
9189
92- return [
93- `${ packageName } -${ buildMode } .apk` ,
94- `${ projectData . projectName } -${ buildMode } .apk` ,
95- `${ projectData . projectName } .apk` ,
96- `app-${ buildMode } .apk`
97- ] ;
90+ return {
91+ packageNames : [
92+ `${ packageName } -${ buildMode } ${ constants . APK_EXTENSION_NAME } ` ,
93+ `${ projectData . projectName } -${ buildMode } ${ constants . APK_EXTENSION_NAME } ` ,
94+ `${ projectData . projectName } ${ constants . APK_EXTENSION_NAME } ` ,
95+ `${ constants . APP_FOLDER_NAME } -${ buildMode } ${ constants . APK_EXTENSION_NAME } `
96+ ] ,
97+ regexes : [ new RegExp ( `${ constants . APP_FOLDER_NAME } -.*-(${ Configurations . Debug } |${ Configurations . Release } )${ constants . APK_EXTENSION_NAME } ` , "i" ) , new RegExp ( `${ packageName } -.*-(${ Configurations . Debug } |${ Configurations . Release } )${ constants . APK_EXTENSION_NAME } ` , "i" ) ]
98+ } ;
9899 } ,
99100 frameworkFilesExtensions : [ ".jar" , ".dat" , ".so" ] ,
100101 configurationFileName : constants . MANIFEST_FILE_NAME ,
@@ -108,23 +109,6 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
108109 return this . _platformData ;
109110 }
110111
111- private getDeviceBuildOutputPath ( currentPath : string , projectData : IProjectData , options : IRelease ) : string {
112- const currentPlatformData : IDictionary < any > = this . $projectDataService . getNSValue ( projectData . projectDir , constants . TNS_ANDROID_RUNTIME_NAME ) ;
113- const platformVersion = currentPlatformData && currentPlatformData [ constants . VERSION_STRING ] ;
114- const buildType = options . release === true ? "release" : "debug" ;
115- const normalizedPath = path . join ( currentPath , buildType ) ;
116-
117- if ( semver . valid ( platformVersion ) ) {
118- const gradleAndroidPluginVersion3xx = "4.0.0" ;
119- const normalizedPlatformVersion = `${ semver . major ( platformVersion ) } .${ semver . minor ( platformVersion ) } .0` ;
120- if ( semver . lt ( normalizedPlatformVersion , gradleAndroidPluginVersion3xx ) ) {
121- return currentPath ;
122- }
123- }
124-
125- return normalizedPath ;
126- }
127-
128112 // TODO: Remove prior to the 4.0 CLI release @Pip3r4o @PanayotCankov
129113 // Similar to the private method of the same name in platform-service.
130114 private getCurrentPlatformVersion ( platformData : IPlatformData , projectData : IProjectData ) : string {
@@ -272,11 +256,9 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
272256 const gradleSettingsFilePath = path . join ( this . getPlatformData ( projectData ) . projectRoot , "settings.gradle" ) ;
273257 shell . sed ( '-i' , / _ _ P R O J E C T _ N A M E _ _ / , this . getProjectNameFromId ( projectData ) , gradleSettingsFilePath ) ;
274258
275- // will replace applicationId in app/App_Resources/Android/app.gradle if it has not been edited by the user
276- const userAppGradleFilePath = path . join ( projectData . appResourcesDirectoryPath , this . $devicePlatformsConstants . Android , "app.gradle" ) ;
277-
278259 try {
279- shell . sed ( '-i' , / _ _ P A C K A G E _ _ / , projectData . projectId , userAppGradleFilePath ) ;
260+ // will replace applicationId in app/App_Resources/Android/app.gradle if it has not been edited by the user
261+ shell . sed ( '-i' , / _ _ P A C K A G E _ _ / , projectData . projectId , projectData . appGradlePath ) ;
280262 } catch ( e ) {
281263 this . $logger . warn ( `\n${ e } .\nCheck if you're using an outdated template and update it.` ) ;
282264 }
@@ -536,7 +518,7 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
536518 }
537519
538520 // Copy include.gradle file
539- const includeGradleFilePath = path . join ( pluginPlatformsFolderPath , "include.gradle" ) ;
521+ const includeGradleFilePath = path . join ( pluginPlatformsFolderPath , constants . INCLUDE_GRADLE_NAME ) ;
540522 if ( this . $fs . exists ( includeGradleFilePath ) ) {
541523 shell . cp ( "-f" , includeGradleFilePath , pluginConfigurationDirectoryPath ) ;
542524 }
0 commit comments