From abdca047b0d3a1f9627a485c15fad0b99c5c241e Mon Sep 17 00:00:00 2001 From: Martin Konicek Date: Mon, 8 Feb 2016 15:24:23 -0800 Subject: [PATCH] Add a note about Android Studio to docs, fix formatting Summary: We should use 4 spaces of indentation in the MainActivity template as this is the most common setting outside fb. public Reviewed By: bestander Differential Revision: D2911952 fb-gh-sync-id: 3b5285945f0033d7342348b7a7cbafa32809f7dc shipit-source-id: 3b5285945f0033d7342348b7a7cbafa32809f7dc --- docs/DevelopmentSetupAndroid.md | 8 ++++++-- .../templates/package/MainActivity.java | 14 +++++++------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/docs/DevelopmentSetupAndroid.md b/docs/DevelopmentSetupAndroid.md index 4b0b8fe93..eab90e85a 100644 --- a/docs/DevelopmentSetupAndroid.md +++ b/docs/DevelopmentSetupAndroid.md @@ -7,7 +7,7 @@ permalink: docs/android-setup.html next: linux-windows-support --- -This guide describes basic steps of the Android development environment setup that are required to run React Native android apps on an android emulator. We don't discuss developer tool configuration such as IDEs here. +This guide describes basic steps of the Android development environment setup that are required to run React Native android apps on an android emulator. ### Install Git @@ -19,7 +19,7 @@ This guide describes basic steps of the Android development environment setup th - **On Windows**, download and install [Git for Windows](https://git-for-windows.github.io/). During the setup process, choose "Run Git from Windows Command Prompt", which will add Git to your `PATH` environment variable. -### Install the Android SDK (unless you have it) +### Install the Android SDK (unless you already have it) 1. [Install the latest JDK](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) 2. Install the Android SDK: @@ -95,3 +95,7 @@ To use it with react-native you just have to add a key and value to your registr You will also need to run the command `adb reverse tcp:8081 tcp:8081` with this emulator. Then restart the emulator and when it runs you can just do `react-native run-android` as usual. + +### Editing your app's Java code in Android Studio + +You can use any editor to edit JavaScript. If you want to use Android Studio to work on native code, from the Welcome screen of Android Studio choose "Import project" and select the `android` folder of your app. diff --git a/local-cli/generator-android/templates/package/MainActivity.java b/local-cli/generator-android/templates/package/MainActivity.java index 6d5cb73f3..552a4d2a5 100644 --- a/local-cli/generator-android/templates/package/MainActivity.java +++ b/local-cli/generator-android/templates/package/MainActivity.java @@ -27,14 +27,14 @@ public class MainActivity extends ReactActivity { return BuildConfig.DEBUG; } - /** - * A list of packages used by the app. If the app uses additional views - * or modules besides the default ones, add more packages here. - */ + /** + * A list of packages used by the app. If the app uses additional views + * or modules besides the default ones, add more packages here. + */ @Override protected List getPackages() { - return Arrays.asList( - new MainReactPackage() - ); + return Arrays.asList( + new MainReactPackage() + ); } }