android-native.mdx (SetUp - Android with Gradle)

Summary: Restyle of the page, including changes to spelling, grammar, links, and structure (where relevant).

Reviewed By: lblasa

Differential Revision: D36246509

fbshipit-source-id: 008b137defae3e15144670e0415ad91383012b21
This commit is contained in:
Kevin Strider
2022-05-10 02:04:32 -07:00
committed by Facebook GitHub Bot
parent 292c710f9e
commit 4fe3bbf82f

View File

@@ -6,19 +6,17 @@ sidebar_label: Android with Gradle
import useBaseUrl from '@docusaurus/useBaseUrl'; import useBaseUrl from '@docusaurus/useBaseUrl';
import Link from '@docusaurus/Link'; import Link from '@docusaurus/Link';
To set up Flipper for Android, you need to add the necessary dependencies to your To set up Flipper for Android, you need to add the necessary dependencies to your app, initialize the Flipper client and enable the plugins you want to use.
app, initialize the Flipper client and enable the plugins you want to use. Optionally, Optionally, you can hook up the diagnostics Activity to help you troubleshoot connection issues.
you can hook up the diagnostics Activity to help you troubleshoot connection issues.
## Dependencies ## Dependencies
Flipper is distributed via Maven Central. Add the dependencies to your `build.gradle` file. Flipper is distributed via Maven Central: add the dependencies to your `build.gradle` file.
You should also explicitly depend on [`soloader`](https://github.com/facebook/soloader)
instead of relying on transitive dependency resolution which is getting deprecated You should also explicitly depend on [SoLoader](https://github.com/facebook/soloader) instead of relying on transitive dependency resolution, which is getting deprecated
with Gradle 5. with Gradle 5.
We provide a "no-op" implementation of some oft-used Flipper interfaces you can There is a 'no-op' implementation of some oft-used Flipper interfaces, which you can use to make it easier to strip Flipper from your release builds:
use to make it easier to strip Flipper from your release builds.
```groovy ```groovy
repositories { repositories {
@@ -33,27 +31,18 @@ dependencies {
} }
``` ```
<div class="warning"> :::warning
The `flipper-noop` package provides a limited subset of the APIs provided by the `flipper` package and does not provide any plugin stubs.
It's recommended that you keep all Flipper instantiation code in a separate build variant to ensure it doesn't accidentally make it into your production builds.
Please note that our `flipper-noop` package provides a limited subset of the To see how to organise your Flipper initialization into debug and release variants. see thos [sample app](https://github.com/facebook/flipper/tree/main/android/sample/src).
APIs provided by the `flipper` package and does not provide any plugin stubs.
It is recommended that you keep all Flipper instantiation code in a separate
build variant to ensure it doesn't accidentally make it into your production
builds. Check out [the sample
app](https://github.com/facebook/flipper/tree/main/android/sample/src) to
see how to organise your Flipper initialization into debug and release
variants.
Alternatively, have a look at the third-party Alternatively, have a look at the third-party [flipper-android-no-op](https://github.com/theGlenn/flipper-android-no-op) repository, which provides empty implementations for several Flipper plugins.
[flipper-android-no-op](https://github.com/theGlenn/flipper-android-no-op) :::
repository, which provides empty implementations for several Flipper plugins.
</div> ## Application setup
## Application Setup Now you can initialize Flipper in your Application's `onCreate` method, which involves initializing SoLoader (for loading the C++ part of Flipper) and starting a `FlipperClient`.
Now you can initialize Flipper in your Application's `onCreate` method, which involves
initializing SoLoader (for loading the C++ part of Flipper) and starting a `FlipperClient`.
import Tabs from '@theme/Tabs'; import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem'; import TabItem from '@theme/TabItem';
@@ -121,12 +110,13 @@ It's recommended that you add the following activity to the manifest, which can
android:exported="true"/> android:exported="true"/>
``` ```
## Android Snapshots ## Android snapshots
Feeling adventurous? We publish Android snapshot releases directly off of `main`. :::note
Android snapshot releases are published directly off `main`.
:::
You can get the latest version by adding the Maven Snapshot repository to your sources You can get the latest version by adding the Maven Snapshot repository to your sources and pointing to the most recent `-SNAPSHOT` version.
and pointing to the most recent `-SNAPSHOT` version.
```groovy ```groovy
repositories { repositories {
@@ -143,8 +133,12 @@ dependencies {
## Enabling plugins ## Enabling plugins
Finally, you need to add plugins to your Flipper client. Above, we have only added the Layout Inspector plugin to get you started. See <Link to={useBaseUrl("/docs/setup/plugins/network")}>Network Plugin</Link> and <Link to={useBaseUrl("/docs/setup/layout-plugin")}>Layout Inspector Plugin</Link> for information on how to add them, and also enable Litho or ComponentKit support. You can check the sample apps in the [GitHub repo](https://github.com/facebook/flipper) for examples of integrating other plugins. Finally, you need to add plugins to your Flipper client.
## Having trouble? Above, the Layout Inspector plugin has been added to get you started. See the <Link to={useBaseUrl("/docs/setup/plugins/network")}>Network Plugin</Link> and [Layout Inspector Plugin](https://www.internalfb.com/intern/staticdocs/flipper/docs/features/plugins/inspector/) pages for information on how to add them, and also enable Litho or ComponentKit support.
See the <Link to={useBaseUrl("/docs/troubleshooting")}>troubleshooting page</Link> for help with known problems. For examples of integrating other plugins, take a look at the sample apps in the [GitHub repo](https://github.com/facebook/flipper).
## Questions or issues
If you have any questions or issues, refer to the <Link to={useBaseUrl("/docs/troubleshooting")}>troubleshooting</Link> page, or post the details on the [Flipper Support](https://fb.workplace.com/groups/flippersupport) Workplace group.