Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions lib/services/android-project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,15 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
platformProjectService: this,
emulatorServices: this.$androidEmulatorServices,
projectRoot: projectRoot,
deviceBuildOutputPath: path.join(...deviceBuildOutputArr),
deviceBuildOutputPath: this.getDeviceBuildOutputPath(path.join(...deviceBuildOutputArr), projectData),
getValidPackageNames: (buildOptions: { isReleaseBuild?: boolean, isForDevice?: boolean }): string[] => {
const buildMode = buildOptions.isReleaseBuild ? Configurations.Release.toLowerCase() : Configurations.Debug.toLowerCase();

return [
`${packageName}-${buildMode}.apk`,
`${projectData.projectName}-${buildMode}.apk`,
`${projectData.projectName}.apk`
`${projectData.projectName}.apk`,
`app-${buildMode}.apk`
];
},
frameworkFilesExtensions: [".jar", ".dat", ".so"],
Expand All @@ -104,6 +105,22 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
return this._platformData;
}

private getDeviceBuildOutputPath(currentPath: string, projectData: IProjectData): string {
const currentPlatformData: IDictionary<any> = this.$projectDataService.getNSValue(projectData.projectDir, constants.TNS_ANDROID_RUNTIME_NAME);
const platformVersion = currentPlatformData && currentPlatformData[constants.VERSION_STRING];
const normalizedPath = path.join(currentPath, "debug");

if (semver.valid(platformVersion)) {
const gradleAndroidPluginVersion3xx = "4.0.0";
const normalizedPlatformVersion = `${semver.major(platformVersion)}.${semver.minor(platformVersion)}.0`;
if (semver.lt(normalizedPlatformVersion, gradleAndroidPluginVersion3xx)) {
return currentPath;
}
}

return normalizedPath;
}

// TODO: Remove prior to the 4.0 CLI release @Pip3r4o @PanayotCankov
// Similar to the private method of the same name in platform-service.
private getCurrentPlatformVersion(platformData: IPlatformData, projectData: IProjectData): string {
Expand Down