@@ -70,7 +70,7 @@ class RNAndroid extends Platform.Android implements RNPlatform {
7070 * Returns the path to the binary of the given project on this platform.
7171 */
7272 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") ;
7474 }
7575
7676 /**
@@ -79,35 +79,27 @@ class RNAndroid extends Platform.Android implements RNPlatform {
7979 installPlatform ( projectDirectory : string ) : Q . Promise < void > {
8080 const innerprojectDirectory : string = path . join ( projectDirectory , TestConfig . TestAppName ) ;
8181 const gradleContent : string = slash ( path . join ( innerprojectDirectory , "node_modules" , "react-native-code-push" , "android" , "codepush.gradle" ) ) ;
82-
82+
8383 //// Set up gradle to build CodePush with the app
8484 // Add CodePush to android/app/build.gradle
8585 const buildGradle = path . join ( innerprojectDirectory , "android" , "app" , "build.gradle" ) ;
8686 TestUtil . replaceString ( buildGradle ,
8787 "apply from: \"../../node_modules/react-native/react.gradle\"" ,
8888 "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+
10090 //// Set the app version to 1.0.0 instead of 1.0
10191 // Set the app version to 1.0.0 in android/app/build.gradle
10292 TestUtil . replaceString ( buildGradle , "versionName \"1.0\"" , "versionName \"1.0.0\"" ) ;
10393 // Set the app version to 1.0.0 in AndroidManifest.xml
10494 TestUtil . replaceString ( path . join ( innerprojectDirectory , "android" , "app" , "src" , "main" , "AndroidManifest.xml" ) , "android:versionName=\"1.0\"" , "android:versionName=\"1.0.0\"" ) ;
10595
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+
111103
112104 return Q < void > ( null ) ;
113105 }
@@ -128,7 +120,7 @@ class RNAndroid extends Platform.Android implements RNPlatform {
128120 const androidDirectory : string = path . join ( projectDirectory , TestConfig . TestAppName , "android" ) ;
129121 const apkPath = this . getBinaryPath ( projectDirectory ) ;
130122 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 ; } ) ;
132124 }
133125}
134126
@@ -306,9 +298,10 @@ class RNProjectManager extends ProjectManager {
306298 }
307299 mkdirp . sync ( projectDirectory ) ;
308300
309- return TestUtil . getProcessOutput ( "react-native init " + appName + " --package " + appNamespace , { cwd : projectDirectory } )
301+ return TestUtil . getProcessOutput ( "react-native init " + appName , { cwd : projectDirectory } )
310302 . 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 ; } ) ;
312305 }
313306
314307 /** JSON mapping project directories to the current scenario
0 commit comments