@@ -16,8 +16,6 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
1616 private static MIN_RUNTIME_VERSION_WITH_GRADLE = "1.5.0" ;
1717 private static MIN_RUNTIME_VERSION_WITHOUT_DEPS = "4.2.0-2018-06-29-02" ;
1818
19- private isAndroidStudioTemplate : boolean ;
20-
2119 constructor ( private $androidToolsInfo : IAndroidToolsInfo ,
2220 private $childProcess : IChildProcess ,
2321 private $errors : IErrors ,
@@ -34,7 +32,6 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
3432 private $androidResourcesMigrationService : IAndroidResourcesMigrationService ,
3533 private $filesHashService : IFilesHashService ) {
3634 super ( $fs , $projectDataService ) ;
37- this . isAndroidStudioTemplate = false ;
3835 }
3936
4037 private _platformData : IPlatformData = null ;
@@ -44,27 +41,10 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
4441 }
4542 if ( projectData && projectData . platformsDir ) {
4643 const projectRoot = path . join ( projectData . platformsDir , AndroidProjectService . ANDROID_PLATFORM_NAME ) ;
47- if ( this . isAndroidStudioCompatibleTemplate ( projectData ) ) {
48- this . isAndroidStudioTemplate = true ;
49- }
50-
51- const appDestinationDirectoryArr = [ projectRoot ] ;
52- if ( this . isAndroidStudioTemplate ) {
53- appDestinationDirectoryArr . push ( constants . APP_FOLDER_NAME ) ;
54- }
55- appDestinationDirectoryArr . push ( constants . SRC_DIR , constants . MAIN_DIR , constants . ASSETS_DIR ) ;
5644
57- const configurationsDirectoryArr = [ projectRoot ] ;
58- if ( this . isAndroidStudioTemplate ) {
59- configurationsDirectoryArr . push ( constants . APP_FOLDER_NAME ) ;
60- }
61- configurationsDirectoryArr . push ( constants . SRC_DIR , constants . MAIN_DIR , constants . MANIFEST_FILE_NAME ) ;
62-
63- const deviceBuildOutputArr = [ projectRoot ] ;
64- if ( this . isAndroidStudioTemplate ) {
65- deviceBuildOutputArr . push ( constants . APP_FOLDER_NAME ) ;
66- }
67- deviceBuildOutputArr . push ( constants . BUILD_DIR , constants . OUTPUTS_DIR , constants . APK_DIR ) ;
45+ const appDestinationDirectoryArr = [ projectRoot , constants . APP_FOLDER_NAME , constants . SRC_DIR , constants . MAIN_DIR , constants . ASSETS_DIR ] ;
46+ const configurationsDirectoryArr = [ projectRoot , constants . APP_FOLDER_NAME , constants . SRC_DIR , constants . MAIN_DIR , constants . MANIFEST_FILE_NAME ] ;
47+ const deviceBuildOutputArr = [ projectRoot , constants . APP_FOLDER_NAME , constants . BUILD_DIR , constants . OUTPUTS_DIR , constants . APK_DIR ] ;
6848
6949 const packageName = this . getProjectNameFromId ( projectData ) ;
7050
@@ -160,30 +140,7 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
160140 const targetSdkVersion = androidToolsInfo && androidToolsInfo . targetSdkVersion ;
161141 this . $logger . trace ( `Using Android SDK '${ targetSdkVersion } '.` ) ;
162142
163- this . isAndroidStudioTemplate = this . isAndroidStudioCompatibleTemplate ( projectData , frameworkVersion ) ;
164- if ( this . isAndroidStudioTemplate ) {
165- this . copy ( this . getPlatformData ( projectData ) . projectRoot , frameworkDir , "*" , "-R" ) ;
166- } else {
167- this . copy ( this . getPlatformData ( projectData ) . projectRoot , frameworkDir , "libs" , "-R" ) ;
168-
169- if ( config . pathToTemplate ) {
170- const mainPath = path . join ( this . getPlatformData ( projectData ) . projectRoot , constants . SRC_DIR , constants . MAIN_DIR ) ;
171- this . $fs . createDirectory ( mainPath ) ;
172- shell . cp ( "-R" , path . join ( path . resolve ( config . pathToTemplate ) , "*" ) , mainPath ) ;
173- } else {
174- this . copy ( this . getPlatformData ( projectData ) . projectRoot , frameworkDir , constants . SRC_DIR , "-R" ) ;
175- }
176- this . copy ( this . getPlatformData ( projectData ) . projectRoot , frameworkDir , "build.gradle settings.gradle build-tools" , "-Rf" ) ;
177-
178- try {
179- this . copy ( this . getPlatformData ( projectData ) . projectRoot , frameworkDir , "gradle.properties" , "-Rf" ) ;
180- } catch ( e ) {
181- this . $logger . warn ( `\n${ e } \nIt's possible, the final .apk file will contain all architectures instead of the ones described in the abiFilters!\nYou can fix this by using the latest android platform.` ) ;
182- }
183-
184- this . copy ( this . getPlatformData ( projectData ) . projectRoot , frameworkDir , "gradle" , "-R" ) ;
185- this . copy ( this . getPlatformData ( projectData ) . projectRoot , frameworkDir , "gradlew gradlew.bat" , "-f" ) ;
186- }
143+ this . copy ( this . getPlatformData ( projectData ) . projectRoot , frameworkDir , "*" , "-R" ) ;
187144
188145 this . cleanResValues ( targetSdkVersion , projectData ) ;
189146
@@ -745,24 +702,6 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
745702 }
746703 }
747704
748- private isAndroidStudioCompatibleTemplate ( projectData : IProjectData , frameworkVersion ?: string ) : boolean {
749- const currentPlatformData : IDictionary < any > = this . $projectDataService . getNSValue ( projectData . projectDir , constants . TNS_ANDROID_RUNTIME_NAME ) ;
750- const platformVersion = ( currentPlatformData && currentPlatformData [ constants . VERSION_STRING ] ) || frameworkVersion ;
751-
752- if ( ! platformVersion ) {
753- return true ;
754- }
755-
756- if ( platformVersion === constants . PackageVersion . NEXT || platformVersion === constants . PackageVersion . LATEST || platformVersion === constants . PackageVersion . RC ) {
757- return true ;
758- }
759-
760- const androidStudioCompatibleTemplate = "3.4.0" ;
761- const normalizedPlatformVersion = `${ semver . major ( platformVersion ) } .${ semver . minor ( platformVersion ) } .0` ;
762-
763- return semver . gte ( normalizedPlatformVersion , androidStudioCompatibleTemplate ) ;
764- }
765-
766705 private runtimeVersionIsGreaterThanOrEquals ( projectData : IProjectData , versionString : string ) : boolean {
767706 const platformVersion = this . getCurrentPlatformVersion ( this . getPlatformData ( projectData ) , projectData ) ;
768707
@@ -775,20 +714,12 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
775714 }
776715
777716 private getLegacyAppResourcesDestinationDirPath ( projectData : IProjectData ) : string {
778- const resourcePath : string [ ] = [ constants . SRC_DIR , constants . MAIN_DIR , constants . RESOURCES_DIR ] ;
779- if ( this . isAndroidStudioTemplate ) {
780- resourcePath . unshift ( constants . APP_FOLDER_NAME ) ;
781- }
782-
717+ const resourcePath : string [ ] = [ constants . APP_FOLDER_NAME , constants . SRC_DIR , constants . MAIN_DIR , constants . RESOURCES_DIR ] ;
783718 return path . join ( this . getPlatformData ( projectData ) . projectRoot , ...resourcePath ) ;
784719 }
785720
786721 private getUpdatedAppResourcesDestinationDirPath ( projectData : IProjectData ) : string {
787- const resourcePath : string [ ] = [ constants . SRC_DIR ] ;
788- if ( this . isAndroidStudioTemplate ) {
789- resourcePath . unshift ( constants . APP_FOLDER_NAME ) ;
790- }
791-
722+ const resourcePath : string [ ] = [ constants . APP_FOLDER_NAME , constants . SRC_DIR ] ;
792723 return path . join ( this . getPlatformData ( projectData ) . projectRoot , ...resourcePath ) ;
793724 }
794725
0 commit comments