duplicate class: MainActivity
<p>I got a simple question that i am sure someone that understands a little bit better the basics of Java can help me. </p>

<p>I am using React-Native and got everything working for iOS, but when trying to compile for android i get an error called "duplicate class: com.myApp.MainActivity".</p>

<p>I know its probably MainActivity is defined 2 times in the following code, but for some reason i tried with everything i know, and i am not able to merge these two MainActivity into one.</p>

<p>Can someone point me in the right direction? Thanks!</p>

<pre><code>    package com.myApp;

    import com.facebook.react.ReactActivity;
    import com.oblador.vectoricons.VectorIconsPackage;
    import com.tuanpm.RCTSmartconfig.RCTSmartconfigPackage;
    import com.pusherman.networkinfo.RNNetworkInfoPackage;
    import com.tuanpm.RCTMqtt.*;

    public class MainActivity extends ReactActivity {

        /**
         * Returns the name of the main component registered from JavaScript.
         * This is used to schedule rendering of the component.
         */
        @Override
        protected String getMainComponentName() {
            return "myApp";
        }
    }

    public class MainActivity extends Activity implements DefaultHardwareBackBtnHandler {
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            mReactRootView = new ReactRootView(this);

            mReactInstanceManager = ReactInstanceManager.builder()
                    .setApplication(getApplication())
                    .setBundleAssetName("index.android.bundle")
                    .setJSMainModuleName("index.android")
                    .addPackage(new MainReactPackage(),
                new VectorIconsPackage(),
                new RCTSmartconfigPackage(),
                new RCTMqttPackage())
                    .addPackage(new RNNetworkInfoPackage())      // &lt;- ADD HERE
                    .setUseDeveloperSupport(BuildConfig.DEBUG)
                    .setInitialLifecycleState(LifecycleState.RESUMED)
                    .build();

            mReactRootView.startReactApplication(mReactInstanceManager, "myApp", null);

            setContentView(mReactRootView);
        }
    }
</code></pre>

<p><strong>UPDATE 1</strong></p>

<p>After following @cybersam solution, i am getting this:</p>

<pre><code>:app:compileDebugJavaWithJavac
/Users/nicolasferro/Desktop/myApp/android/app/src/main/java/com/myApp/MainActivity.java:9: error: cannot find symbol
public class MainActivity extends ReactActivity implements DefaultHardwareBackBtnHandler {
                                                           ^
  symbol: class DefaultHardwareBackBtnHandler
/Users/nicolasferro/Desktop/myApp/android/app/src/main/java/com/myApp/MainActivity.java:12: error: cannot find symbol
    protected void onCreate(Bundle savedInstanceState) {
                            ^
  symbol:   class Bundle
  location: class MainActivity
/Users/nicolasferro/Desktop/myApp/android/app/src/main/java/com/myApp/MainActivity.java:14: error: mReactRootView has private access in ReactActivity
        mReactRootView = new ReactRootView(this);
        ^
/Users/nicolasferro/Desktop/myApp/android/app/src/main/java/com/myApp/MainActivity.java:14: error: cannot find symbol
        mReactRootView = new ReactRootView(this);
                             ^
  symbol:   class ReactRootView
  location: class MainActivity
/Users/nicolasferro/Desktop/myApp/android/app/src/main/java/com/myApp/MainActivity.java:16: error: mReactInstanceManager has private access in ReactActivity
        mReactInstanceManager = ReactInstanceManager.builder()
        ^
/Users/nicolasferro/Desktop/myApp/android/app/src/main/java/com/myApp/MainActivity.java:26: error: cannot find symbol
                .setInitialLifecycleState(LifecycleState.RESUMED)
                                          ^
  symbol:   variable LifecycleState
  location: class MainActivity
/Users/nicolasferro/Desktop/myApp/android/app/src/main/java/com/myApp/MainActivity.java:20: error: cannot find symbol
                .addPackage(new MainReactPackage(),
                                ^
  symbol:   class MainReactPackage
  location: class MainActivity
/Users/nicolasferro/Desktop/myApp/android/app/src/main/java/com/myApp/MainActivity.java:16: error: cannot find symbol
        mReactInstanceManager = ReactInstanceManager.builder()
                                ^
  symbol:   variable ReactInstanceManager
  location: class MainActivity
/Users/nicolasferro/Desktop/myApp/android/app/src/main/java/com/myApp/MainActivity.java:29: error: mReactInstanceManager has private access in ReactActivity
        mReactRootView.startReactApplication(mReactInstanceManager, "myApp", null);
                                             ^
/Users/nicolasferro/Desktop/myApp/android/app/src/main/java/com/myApp/MainActivity.java:29: error: mReactRootView has private access in ReactActivity
        mReactRootView.startReactApplication(mReactInstanceManager, "myApp", null);
        ^
/Users/nicolasferro/Desktop/myApp/android/app/src/main/java/com/myApp/MainActivity.java:31: error: mReactRootView has private access in ReactActivity
        setContentView(mReactRootView);
                       ^
11 errors
:app:compileDebugJavaWithJavac FAILED
</code></pre>