From a22b727a4f42e42791121a70532e131f410bb9ef Mon Sep 17 00:00:00 2001 From: Nabil Hachicha Date: Thu, 17 Nov 2016 18:11:28 +0000 Subject: [PATCH] Fixing CI for Android --- .../io/realm/react/example/MainActivity.java | 1 - .../app/src/main/java/MainActivity.java | 15 ------- .../io/realm/react/testapp/MainActivity.java | 44 +++++++++++++++++++ .../realm/react/testapp}/MainApplication.java | 0 tests/react-test-app/run-android.sh | 8 +++- 5 files changed, 50 insertions(+), 18 deletions(-) delete mode 100644 tests/react-test-app/android/app/src/main/java/MainActivity.java create mode 100644 tests/react-test-app/android/app/src/main/java/io/realm/react/testapp/MainActivity.java rename tests/react-test-app/android/app/src/main/java/{ => io/realm/react/testapp}/MainApplication.java (100%) diff --git a/examples/ReactExample/android/app/src/main/java/io/realm/react/example/MainActivity.java b/examples/ReactExample/android/app/src/main/java/io/realm/react/example/MainActivity.java index 66927027..bc47e9fc 100644 --- a/examples/ReactExample/android/app/src/main/java/io/realm/react/example/MainActivity.java +++ b/examples/ReactExample/android/app/src/main/java/io/realm/react/example/MainActivity.java @@ -3,7 +3,6 @@ package io.realm.react.example; import com.facebook.react.ReactActivity; public class MainActivity extends ReactActivity { - /** * Returns the name of the main component registered from JavaScript. * This is used to schedule rendering of the component. diff --git a/tests/react-test-app/android/app/src/main/java/MainActivity.java b/tests/react-test-app/android/app/src/main/java/MainActivity.java deleted file mode 100644 index 801b2a43..00000000 --- a/tests/react-test-app/android/app/src/main/java/MainActivity.java +++ /dev/null @@ -1,15 +0,0 @@ -package io.realm.react.testapp; - -import com.facebook.react.ReactActivity; - -public class MainActivity extends ReactActivity { - - /** - * Returns the name of the main component registered from JavaScript. - * This is used to schedule rendering of the component. - */ - @Override - protected String getMainComponentName() { - return "ReactTests"; - } -} diff --git a/tests/react-test-app/android/app/src/main/java/io/realm/react/testapp/MainActivity.java b/tests/react-test-app/android/app/src/main/java/io/realm/react/testapp/MainActivity.java new file mode 100644 index 00000000..50539ed8 --- /dev/null +++ b/tests/react-test-app/android/app/src/main/java/io/realm/react/testapp/MainActivity.java @@ -0,0 +1,44 @@ +package io.realm.react.testapp; + +import com.facebook.react.ReactActivity; + +public class MainActivity extends ReactActivity { + + + @Override + protected void onCreate(android.os.Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> onCreate"); + System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + } + + @Override + protected void onResume() { + super.onResume(); + System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> onResume"); + System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); + } + + /** + * Returns the name of the main component registered from JavaScript. + * This is used to schedule rendering of the component. + */ + @Override + protected String getMainComponentName() { + return "ReactTests"; + } +} diff --git a/tests/react-test-app/android/app/src/main/java/MainApplication.java b/tests/react-test-app/android/app/src/main/java/io/realm/react/testapp/MainApplication.java similarity index 100% rename from tests/react-test-app/android/app/src/main/java/MainApplication.java rename to tests/react-test-app/android/app/src/main/java/io/realm/react/testapp/MainApplication.java diff --git a/tests/react-test-app/run-android.sh b/tests/react-test-app/run-android.sh index a5f8e416..d4e03d37 100755 --- a/tests/react-test-app/run-android.sh +++ b/tests/react-test-app/run-android.sh @@ -3,7 +3,7 @@ set -o pipefail set -e -PATH="/opt/android-sdk-linux/platform-tools:$PATH" +PATH="/home/jenkins/.nvm/versions/node/v6.9.1/bin:/opt/android-sdk-linux/platform-tools:$PATH" # Inform the prepublish script to build Android modules. REALM_BUILD_ANDROID=1 npm install realm realm-tests @@ -16,4 +16,8 @@ adb reverse tcp:8081 tcp:8081 react-native run-android echo "Unlocking device" -adb shell input keyevent 82 +adb shell input text 1234 && adb shell input keyevent 66 + +# sometimes on CI the application is not on the foreground +echo "Starting the Main Activity" +adb shell am start -n io.realm.react.testapp/.MainActivity