Fix release builds on Android, take 2 (#1329)
Summary: Changelog: Fixed react-native-flipper causing Android release builds to fail https://github.com/facebook/flipper/issues/1325 made progress but did not quite fix https://github.com/facebook/flipper/issues/1303. Android Release builds would still fail because `PackageList` depended on `FlipperPackage` and couldn't find it in release builds. There doesn't appear to be a clear way to set up a debug-only package with React Native's Android autolinking (see https://github.com/react-native-community/cli/issues/1211), so this change creates an empty `FlipperPackage` to satisfy that dependency, while still avoiding bundling the Flipper library into the release build. (manual linking also works, but seems less-desirable for consumers of the library) ## Changelog Add an empty `FlipperPackage` to the `release` folder to satisfy the reference put in `PackageList` by the autolinker for release builds. Pull Request resolved: https://github.com/facebook/flipper/pull/1329 Test Plan: Verified that release builds did fail without this change (using ReactNativeFlipperExample app) Successfully built a React Native Android Release app from Android Studio using this library and verified that the APK still did not contain Flipper. Built debug and verified that Flipper still worked as before. Reviewed By: passy Differential Revision: D23292543 Pulled By: mweststrate fbshipit-source-id: cb897a0e6dcdc04e29d676596447ca9dd68182c8
This commit is contained in:
committed by
Facebook GitHub Bot
parent
79b1f8a1c1
commit
3e95645f45
@@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.facebook.flipper.reactnative;
|
||||||
|
|
||||||
|
import com.facebook.react.ReactPackage;
|
||||||
|
import com.facebook.react.bridge.NativeModule;
|
||||||
|
import com.facebook.react.bridge.ReactApplicationContext;
|
||||||
|
import com.facebook.react.uimanager.ViewManager;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exposes the react native modules that should be created per ReactApplicationContext. Note that an
|
||||||
|
* application context lives shorter than the application itself, e.g. reload creates a fresh one.
|
||||||
|
*
|
||||||
|
* <p>This is an empty implementation to keep Flipper out of release builds while still satisfying
|
||||||
|
* autolink's expectation to find a FlipperPackage.
|
||||||
|
*/
|
||||||
|
public class FlipperPackage implements ReactPackage {
|
||||||
|
@Override
|
||||||
|
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user