You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am not sure, if I am missing something. But, my MainActivity.java file (Android) does not look like the one in your Readme:
This is yours:
importcom.robinpowered.react.battery.DeviceBatteryPackage; // <--- importpublicclassMainActivityextendsActivityimplementsDefaultHardwareBackBtnHandler {
......
@OverrideprotectedvoidonCreate(BundlesavedInstanceState) {
super.onCreate(savedInstanceState);
mReactRootView = newReactRootView(this);
mReactInstanceManager = ReactInstanceManager.builder()
.setApplication(getApplication())
.setBundleAssetName("index.android.bundle")
.setJSMainModuleName("index.android")
.addPackage(newMainReactPackage())
.addPackage(newDeviceBatteryPackage()) // <------ add this line to yout MainActivity class
.setUseDeveloperSupport(BuildConfig.DEBUG)
.setInitialLifecycleState(LifecycleState.RESUMED)
.build();
mReactRootView.startReactApplication(mReactInstanceManager, "AndroidRNSample", null);
setContentView(mReactRootView);
}
......
}
This is mine:
packagecom.xxxxx;
importcom.facebook.react.ReactActivity;
publicclassMainActivityextendsReactActivity {
/** * Returns the name of the main component registered from JavaScript. * This is used to schedule rendering of the component. */@OverrideprotectedStringgetMainComponentName() {
return"xxxxxx";
}
}
When I try to build the app I see errors like:
public class MainActivity extends Activity implements DefaultHardwareBackBtnHandler {
^
symbol: class Activity
My questions are:
do I really need to add onCreate here and not in the MainApplication.java file instead?
does it work with react-native 0.50.3?
Thanks for your help.
The text was updated successfully, but these errors were encountered:
I've tried using this library in my project, using react-native 0.50.4.
What I ended up doing is using react-native link, which didn't change MainActivity.java, but changed MainApplication.java instead.
Hi,
I am not sure, if I am missing something. But, my
MainActivity.java
file (Android) does not look like the one in your Readme:This is yours:
This is mine:
When I try to build the app I see errors like:
My questions are:
onCreate
here and not in theMainApplication.java
file instead?react-native
0.50.3?Thanks for your help.
The text was updated successfully, but these errors were encountered: