@@ -16,8 +16,6 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
16
16
private static MIN_RUNTIME_VERSION_WITH_GRADLE = "1.5.0" ;
17
17
private static MIN_RUNTIME_VERSION_WITHOUT_DEPS = "4.2.0-2018-06-29-02" ;
18
18
19
- private isAndroidStudioTemplate : boolean ;
20
-
21
19
constructor ( private $androidToolsInfo : IAndroidToolsInfo ,
22
20
private $childProcess : IChildProcess ,
23
21
private $errors : IErrors ,
@@ -34,7 +32,6 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
34
32
private $androidResourcesMigrationService : IAndroidResourcesMigrationService ,
35
33
private $filesHashService : IFilesHashService ) {
36
34
super ( $fs , $projectDataService ) ;
37
- this . isAndroidStudioTemplate = false ;
38
35
}
39
36
40
37
private _platformData : IPlatformData = null ;
@@ -44,27 +41,10 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
44
41
}
45
42
if ( projectData && projectData . platformsDir ) {
46
43
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 ) ;
56
44
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 ] ;
68
48
69
49
const packageName = this . getProjectNameFromId ( projectData ) ;
70
50
@@ -160,30 +140,7 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
160
140
const targetSdkVersion = androidToolsInfo && androidToolsInfo . targetSdkVersion ;
161
141
this . $logger . trace ( `Using Android SDK '${ targetSdkVersion } '.` ) ;
162
142
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" ) ;
187
144
188
145
this . cleanResValues ( targetSdkVersion , projectData ) ;
189
146
@@ -745,24 +702,6 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
745
702
}
746
703
}
747
704
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
-
766
705
private runtimeVersionIsGreaterThanOrEquals ( projectData : IProjectData , versionString : string ) : boolean {
767
706
const platformVersion = this . getCurrentPlatformVersion ( this . getPlatformData ( projectData ) , projectData ) ;
768
707
@@ -775,20 +714,12 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
775
714
}
776
715
777
716
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 ] ;
783
718
return path . join ( this . getPlatformData ( projectData ) . projectRoot , ...resourcePath ) ;
784
719
}
785
720
786
721
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 ] ;
792
723
return path . join ( this . getPlatformData ( projectData ) . projectRoot , ...resourcePath ) ;
793
724
}
794
725
0 commit comments