Summary:
In most .gradle files, lines are indented with 4 spaces, but in some places they are indented with 2 spaces. This PR fixes them and enforce it by adding .editorconfig settings.
Closes https://github.com/facebook/react-native/pull/10267
Differential Revision: D4048335
Pulled By: lacker
fbshipit-source-id: df2f2556380f56672cf85690eb1c80e640a6aedf
Summary:
**Test plan:** With the given patch applied to `react.gradle`, I specified the following in my `android/app/build.gradle`:
```
project.ext.react = [
nodeExecutableAndArgs: ["node", "--max_old_space_size=4096"]
]
```
and ensured in a `./gradlew installDebug --debug` run that the packager gets indeed invoked with these parameters.
Closes https://github.com/facebook/react-native/pull/7903
Differential Revision: D3390543
fbshipit-source-id: cf440b36633420b8f67070f47dfabf4c84cb28a7
Summary:
If for instance you're using a custom transformer, having this hook will let you specify it without forking all of react.gradle
**Test plan:** Specified some additional packager args in my app's `android/app/build.gradle`:
```groovy
project.ext.react = [
bundleInDebug: true,
extraPackagerArgs: ["--transformer", "path/to/my/transformer.js"]
]
```
and ensured they show up when gradle invokes the bundler.
Closes https://github.com/facebook/react-native/pull/7858
Differential Revision: D3382996
Pulled By: mkonicek
fbshipit-source-id: 437b2e6c902931d45b9d2f7ec97c833ba0cd3217
Summary:
Update to [OkHttp](https://github.com/square/okhttp) to [OkHttp3](https://publicobject.com/2015/12/12/com-squareup-okhttp3/)
We must also update:
- Fresco to 0.10.0
- okio to 1.8.0
**Motivation**
Reasons for upgrading:
* Issue #4021
* "We discovered that RN Android sometimes fails to connect to the latest stable version of NGINX when HTTP/2 is enabled. We aren't seeing errors with other HTTP clients so we think it's specific to RN and OkHttp. Square has fixed several HTTP/2 bugs over the past eight months." - ide
* OkHttp3 will be maintained & improved, but OkHttp2 will only receive [security fixes](https://publicobject.com/2016/02/11/okhttp-certificate-pinning-vulnerability/)
* Cleaner APIs - "Get and Set prefixes are avoided"
* Deprecated/Removed - HttpURLConnection & Apache HTTP
* React Native apps are currently being forced to bundle two versions of OkHttp (v2 & v3), if another library uses v3
* Improved WebSocket performance - [CHANGELOG.md](https://github.com/square/okhttp/blob/master
Closes https://github.com/facebook/react-native/pull/6113
Reviewed By: andreicoman11, lexs
Differential Revision: D3292375
Pulled By: bestander
fbshipit-source-id: 7c7043eaa2ea63f95854108b401c4066098d67f7
Summary:- converted shell script `scripts/e2e-test.sh` into JS script to have more programming flexibility
- using appium execute 2 tests after a fresh React Native app installation: check HMR and that debugging mode does not crash the app
- made sure tests can be stable on limited CI systems and added ways to debug any problems in the future
Using appium we can now interact with Android app and test its state.
As a follow up i am planning to write a blog post on how to use appium with android and ios for e2e testing.
Closes https://github.com/facebook/react-native/pull/6840
Differential Revision: D3173635
Pulled By: mkonicek
fb-gh-sync-id: 3cf044bc9f64d1a842ae4589dd1bcab76de3d66a
fbshipit-source-id: 3cf044bc9f64d1a842ae4589dd1bcab76de3d66a
Summary:BUCK is faster than Gradle.
For example `gradle app:installDebug` vs `buck install app` is ~7 seconds vs ~2 seconds with warm caches.
This is just the beginning to allow people to become familiar with BUCK.
It is enough for running the app locally and testing on a device.
Gradle is still used for dependency resolution.
Closes https://github.com/facebook/react-native/pull/6733
Differential Revision: D3126328
Pulled By: bestander
fb-gh-sync-id: 56aad276036c029af7e0e23d60c46ba2f77b3d2c
fbshipit-source-id: 56aad276036c029af7e0e23d60c46ba2f77b3d2c
Summary:The goal is to minimize the number of files we need to bootstrap. This allows us to make the upgrade process smoother for everyone.
If someone needs to customize the file, we already provide some config options. The ability to copy the file and modify it is always there for those few who need it.
**Test plan**
Generate a new project with the updated template. The app should build and run fine both in debug and production mode.
Related #6292
Closes https://github.com/facebook/react-native/pull/6610
Differential Revision: D3109099
Pulled By: foghina
fb-gh-sync-id: 13fc89e60daed30bf6349e532a140c1b6f8f053a
fbshipit-source-id: 13fc89e60daed30bf6349e532a140c1b6f8f053a
Summary:Same as d87d127 but for gradle. It will help to prevent installing global `react-native-cli` (more simple CI server configuration for ex.)
Tested on Linux and Windows.
Closes https://github.com/facebook/react-native/pull/6272
Differential Revision: D3076101
Pulled By: foghina
fb-gh-sync-id: 89c3870536b1ce3fdbb909909b887f3ce68b2951
shipit-source-id: 89c3870536b1ce3fdbb909909b887f3ce68b2951
Summary:If jsBundleDir variable was defined, then RN image assets would be
thrown into the assets folder along with the js bundle. This is a
bug. Image assets should be published into a different folder than the
js bundle.
A new variable resourcesDir is defined where RN image assets and the
like should be published into.
Closes https://github.com/facebook/react-native/pull/5828
Differential Revision: D2980235
Pulled By: mkonicek
fb-gh-sync-id: af913814e2fcce42aaa1fbed2a68fd719198f306
shipit-source-id: af913814e2fcce42aaa1fbed2a68fd719198f306
Summary:
This lets us say goodbye to Maven Central. This will greatly simplify
and speed up the release process as releasing Android artifacts to
Maven Central adds a lot of [complexity](https://github.com/facebook/react-native/blob/master/Releases-publish.md)
and delays the whole release by several hours when we have to wait
for the artifacts to propagate.
This diff assumes there's a local Maven repo at
`node_modules/react-native/android`.
The second part once this lands is to change our `release.sh` script to
output the artifacts under `react-native/android` before publishing to
npm.
This adds 3.7MB to the size of `node_modules` of any app. However,
we just download eagerly what we'd normally download later via Gradle.
**Test plan**
Released RN including a local Maven repo into Sinopia:
$ cd react-native
# Updated version in gradle.properties to 0.21.0
$ ./gradlew ReactAndroid:installArchives
# Moved everything in .m2/repository/com/facebook/react to react-native/android
$ ls react-native/android
com/facebook/react/react-native/0.21.0/react-native-0.21.0.aar
com/facebook/react/react-native/0.21.0/react-native-0.21.0.pom
com/facebook/react/react-native/maven-metadata.xml
...
# Set version in package.json to 0.21.0
$ npm set registry http://localhost:4873/
$ npm publish
Created and ran an app:
$ cd /tmp
$ react-native init AndroidNpm
$ cd AndroidNpm
$ react-native run-android
It worked.
Checked that we're using the artifacts from node_modules/react-native/android:
$ cd android
$ ./gradlew app:dependencies
compile - Classpath for compiling the main sources.
+--- com.android.support:appcompat-v7:23.0.1
| \--- com.android.support:support-v4:23.0.1
| \--- com.android.support:support-annotations:23.0.1
\--- com.facebook.react:react-native:+ -> 0.21.0
+--- com.google.code.findbugs:jsr305:3.0.0
+--- com.facebook.stetho:stetho-okhttp:1.2.0
...
Checked that Android Studio can find the source jars (you can navigate to RN sources in Android Studio). Opened the new project as described in the [docs](https://facebook.github.io/react-native/docs/android-setup.html#editing-your-app-s-java-code-in-android-studio).
public
Reviewed By: bestander
Differential Revision: D2912557
fb-gh-sync-id: 251c180518a3fb9bb8e80963b236e982d65533be
shipit-source-id: 251c180518a3fb9bb8e80963b236e982d65533be
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
Summary:
- Capitalise productFlavorName for target path
- Capitalise buildType in sourceName when flavour exists
- Fix the path the assets are added.
- Backward compatibility with bundleIn(buildTypeName) when flavours are added
Closes https://github.com/facebook/react-native/pull/5580
Reviewed By: svcscm
Differential Revision: D2911735
Pulled By: mkonicek
fb-gh-sync-id: 6fb391a12ee27ee2a503961d8779a85d31cf5367
Summary:
until we have an automated test in CI
Closes https://github.com/facebook/react-native/pull/5775
Reviewed By: svcscm
Differential Revision: D2911639
Pulled By: mkonicek
fb-gh-sync-id: 26d8194dd5a6fd7210f4b014787e6847217dd7f1
Summary:
ReactProp and ReactPropGroup were moved in the annotations package but the proguard file was not updated accordingly. This caused apps to crash when built in release using proguard.
Fixes#5655
Closes https://github.com/facebook/react-native/pull/5717
Reviewed By: svcscm
Differential Revision: D2905573
Pulled By: lexs
fb-gh-sync-id: 29ab14bacda7254d9896ff3991bf17d7fdfd6ea9
Summary:
This PR adds support for Android Gradle [Build Variants](https://sites.google.com/a/android.com/tools/tech-docs/new-build-system/user-guide#TOC-Build-Variants) when generating the JS bundle.
**Before**: only supported "bundleDebugJsAndAssets" and "bundleReleaseJsAndAssets"
**Now**: all variants are supported
Examples: "bundleDevDebugJsAndAssets", "bundleStageAlphaJsAndAssets", or "bundleBetaJsAndAssets"
The Gradle script will automatically create bundle tasks for each build variant found in a project.
Closes https://github.com/facebook/react-native/pull/4686
Reviewed By: svcscm
Differential Revision: D2815856
Pulled By: foghina
fb-gh-sync-id: 4518de70d178205bc3e5044d2446b56c40298da2
Reviewed By: mkonicek
Differential Revision:D2812482
Ninja: Doesn't affect any fb apps or code, purely for open source
fb-gh-sync-id: 4d190354112e3f002405686769dcc409e3394c3c
Summary:
This allows everyone to deploy significantly smaller APKs to they Play Store by building separate APKs for ARM, x86 architectures.
For a simple app, a release APK minified with Produard:
- Universal APK is **7MB**
- x86 APK is **4.6MB** (34% reduction)
- ARM APK is **3.7MB** (47% reduction)
Created a sample project, uncommented `// include "armeabi-v7a", 'x86'`:
cd android
./gradlew assembleDebug
Three APKs were created, unzipped each: one has only x86 binaries,
one has ARM binaries, one has both.
./gradlew assembleRelease
Three APKs were created, JS bundle is correcly added to assets.
react-native run-android
The correct APK is installed on the emulator and the app runs fine
(Gradle output: "Installing APK 'app-x86-debug.apk'").
With the line commented out the behavior is exactly the same as before,
only one universal APK is built.
Checked that version codes are set correctly as described in
http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splitshttp://developer.android.com/intl/ru/google/play/publishing/multiple-apks.html
Closes https://github.com/facebook/react-native/pull/5160
Reviewed By: svcscm
Differential Revision: D2811443
Pulled By: mkonicek
fb-gh-sync-id: 97b22b9cd567e53b8adac36669b90768458b7a55
Summary:
Having a base activity allows us to add new features and fixes without having to change the generated `MainActivity` file.
cc mkonicek arbesfeld
Closes https://github.com/facebook/react-native/pull/4827
Reviewed By: bestander
Differential Revision: D2783527
Pulled By: mkonicek
fb-gh-sync-id: 707b82839809ca2e1775f5d3ac022a6d00bcac5a
Summary: ```
* What went wrong:
Execution failed for task ':app:bundleReleaseJsAndAssets'.
> A problem occurred starting process 'command 'react-native''
```
Can be solved by this patch.
Closes https://github.com/facebook/react-native/pull/4209
Reviewed By: svcscm
Differential Revision: D2669661
Pulled By: foghina
fb-gh-sync-id: 951b7eb9dd3121de607cf5eb3dfb3af44cdf5994
Summary: From http://developer.android.com/guide/topics/resources/runtime-changes.html
> Some device configurations can change during runtime (such as screen orientation, keyboard availability, and language). When such a change occurs, Android restarts the running Activity (onDestroy() is called, followed by onCreate()). The restart behavior is designed to help your application adapt to new configurations by automatically reloading your application with alternative resources that match the new device configuration.
However, in a React Native app, there is only a single activity for the entire app, unlike a single activity per screen in Android, and resources are not specific to orientation etc. Destroying activity means reloading the entire app. Most of the time, this is not the intended behaviour, and can cause data loss for the user if the developer doesn't disable it explicitly. I'm proposing to disable it by default.
Closes https://github.com/facebook/react-native/pull/3813
Reviewed By: svcscm
Differential Revision: D2616083
Pulled By: foghina
fb-gh-sync-id: 8794e436f61581ff0bf569b1b112845cae77b688
Summary: This adds gradle tasks that call `react-native bundle` with the correct args to bundle dev/release JS and assets. The dev task is disabled by default, as in dev mode people only use reload JS in most cases.
Submitting this as a pull request to have community visibility, although we have this code internally as well now and this will require an import.
* generate a project with `react-native init`, add some assets, run `./gradlew assembleRelease`, sign & zipalign generated APK, run it -> works
* enable dev bundling task, run `./gradlew installDebug` (not `react-native run-android` so as to not start the packager) -> works
Reviewed By: svcscm
Differential Revision: D2555071
Pulled By: foghina
fb-gh-sync-id: c3d9fcd4c77862e6a4db4e4d8d8cc39ee9dff3ab
This is an early release and there are several things that are known
not to work if you're porting your iOS app to Android.
See the Known Issues guide on the website.
We will work with the community to reach platform parity with iOS.