@@ -70,7 +70,7 @@ class RNAndroid extends Platform.Android implements RNPlatform {
70
70
* Returns the path to the binary of the given project on this platform.
71
71
*/
72
72
getBinaryPath ( projectDirectory : string ) : string {
73
- return path . join ( projectDirectory , TestConfig . TestAppName , "android" , "app" , "build" , "outputs" , "apk" , "app-release-unsigned .apk" ) ;
73
+ return path . join ( projectDirectory , TestConfig . TestAppName , "android" , "app" , "build" , "outputs" , "apk" , "release" , " app-release.apk") ;
74
74
}
75
75
76
76
/**
@@ -79,35 +79,27 @@ class RNAndroid extends Platform.Android implements RNPlatform {
79
79
installPlatform ( projectDirectory : string ) : Q . Promise < void > {
80
80
const innerprojectDirectory : string = path . join ( projectDirectory , TestConfig . TestAppName ) ;
81
81
const gradleContent : string = slash ( path . join ( innerprojectDirectory , "node_modules" , "react-native-code-push" , "android" , "codepush.gradle" ) ) ;
82
-
82
+
83
83
//// Set up gradle to build CodePush with the app
84
84
// Add CodePush to android/app/build.gradle
85
85
const buildGradle = path . join ( innerprojectDirectory , "android" , "app" , "build.gradle" ) ;
86
86
TestUtil . replaceString ( buildGradle ,
87
87
"apply from: \"../../node_modules/react-native/react.gradle\"" ,
88
88
"apply from: \"../../node_modules/react-native/react.gradle\"\napply from: \"" + gradleContent + "\"" ) ;
89
- TestUtil . replaceString ( buildGradle ,
90
- "compile \"com.facebook.react:react-native:+\"" ,
91
- "compile \"com.facebook.react:react-native:0.25.+\"" ) ;
92
- TestUtil . replaceString ( buildGradle ,
93
- "// From node_modules" ,
94
- "\n compile project(':react-native-code-push') // From node_modules" ) ;
95
- // Add CodePush to android/settings.gradle
96
- TestUtil . replaceString ( path . join ( innerprojectDirectory , "android" , "settings.gradle" ) ,
97
- "include ':app'" ,
98
- "include ':app', ':react-native-code-push'\nproject(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app')" ) ;
99
-
89
+
100
90
//// Set the app version to 1.0.0 instead of 1.0
101
91
// Set the app version to 1.0.0 in android/app/build.gradle
102
92
TestUtil . replaceString ( buildGradle , "versionName \"1.0\"" , "versionName \"1.0.0\"" ) ;
103
93
// Set the app version to 1.0.0 in AndroidManifest.xml
104
94
TestUtil . replaceString ( path . join ( innerprojectDirectory , "android" , "app" , "src" , "main" , "AndroidManifest.xml" ) , "android:versionName=\"1.0\"" , "android:versionName=\"1.0.0\"" ) ;
105
95
106
- //// Replace the MainActivity.java with the correct server url and deployment key
107
- const mainActivity = path . join ( innerprojectDirectory , "android" , "app" , "src" , "main" , "java" , "com" , "microsoft" , "codepush" , "test" , "MainActivity.java" ) ;
108
- TestUtil . replaceString ( mainActivity , TestUtil . CODE_PUSH_TEST_APP_NAME_PLACEHOLDER , TestConfig . TestAppName ) ;
109
- TestUtil . replaceString ( mainActivity , TestUtil . SERVER_URL_PLACEHOLDER , this . getServerUrl ( ) ) ;
110
- TestUtil . replaceString ( mainActivity , TestUtil . ANDROID_KEY_PLACEHOLDER , this . getDefaultDeploymentKey ( ) ) ;
96
+ //// Replace the MainApplication.java with the correct server url and deployment key
97
+ const string = path . join ( innerprojectDirectory , "android" , "app" , "src" , "main" , "res" , "values" , "strings.xml" ) ;
98
+ const AndroidManifest = path . join ( innerprojectDirectory , "android" , "app" , "src" , "main" , "AndroidManifest.xml" ) ;
99
+ TestUtil . replaceString ( string , TestUtil . SERVER_URL_PLACEHOLDER , this . getServerUrl ( ) ) ;
100
+ TestUtil . replaceString ( string , TestUtil . ANDROID_KEY_PLACEHOLDER , this . getDefaultDeploymentKey ( ) ) ;
101
+ TestUtil . replaceString ( AndroidManifest , "android:allowBackup=\"false\"" , "android:allowBackup=\"false\"" + "\n\t" + "android:usesCleartextTraffic=\"true\"" ) ;
102
+
111
103
112
104
return Q < void > ( null ) ;
113
105
}
@@ -128,7 +120,7 @@ class RNAndroid extends Platform.Android implements RNPlatform {
128
120
const androidDirectory : string = path . join ( projectDirectory , TestConfig . TestAppName , "android" ) ;
129
121
const apkPath = this . getBinaryPath ( projectDirectory ) ;
130
122
return TestUtil . getProcessOutput ( "gradlew assembleRelease --daemon" , { cwd : androidDirectory } )
131
- . then < void > ( TestUtil . getProcessOutput . bind ( undefined , "jarsigner -verbose -keystore ~/.android/debug.keystore -storepass android -keypass android " + apkPath + " androiddebugkey" , { cwd : androidDirectory , noLogStdOut : true } ) ) . then ( ( ) => { return null ; } ) ;
123
+ . then ( ( ) => { return null ; } ) ;
132
124
}
133
125
}
134
126
@@ -306,9 +298,10 @@ class RNProjectManager extends ProjectManager {
306
298
}
307
299
mkdirp . sync ( projectDirectory ) ;
308
300
309
- return TestUtil . getProcessOutput ( "react-native init " + appName + " --package " + appNamespace , { cwd : projectDirectory } )
301
+ return TestUtil . getProcessOutput ( "react-native init " + appName , { cwd : projectDirectory } )
310
302
. then ( this . copyTemplate . bind ( this , templatePath , projectDirectory ) )
311
- . then < void > ( TestUtil . getProcessOutput . bind ( undefined , "npm install " + TestConfig . thisPluginPath , { cwd : path . join ( projectDirectory , TestConfig . TestAppName ) } ) ) . then ( ( ) => { return null ; } ) ;
303
+ . then < void > ( TestUtil . getProcessOutput . bind ( undefined , TestConfig . thisPluginInstallString , { cwd : path . join ( projectDirectory , TestConfig . TestAppName ) } ) )
304
+ . then ( ( ) => { return null ; } ) ;
312
305
}
313
306
314
307
/** JSON mapping project directories to the current scenario
0 commit comments