简体   繁体   中英

Android-Installing to device using eclipse install two instance of same app at once-error

Android-Installing to device using eclipse install two instance of same app at once-error

and it runs when just after installed using the eclipse but when I touch the once of the icon its not starting it shows me the android common error syaing unexpectedly stopped?? please help me??

This is the manifest I'm using(activities)

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.hunter99x"

      android:icon="@drawable/icon"
      android:versionCode="1"
      android:versionName="1.0">
    <uses-sdk android:minSdkVersion="8" />

    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".main" android:configChanges="orientation|keyboardHidden" android:theme="@android:style/Theme.NoTitleBar"
                  android:label="@string/app_name" android:screenOrientation="portrait" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

                <activity android:name=".origine" android:configChanges="orientation|keyboardHidden" android:theme="@android:style/Theme.NoTitleBar"
                  android:label="@string/app_name" android:screenOrientation="portrait">
            <intent-filter>
                <action android:name="android.intent.action.origine" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

                        <activity `enter code here`android:name=".Gameover" android:configChanges="orientation|keyboardHidden" android:theme="@android:style/Theme.NoTitleBar"
                  android:label="@string/app_name" android:screenOrientation="portrait">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

                                                <activity android:name=".LandingScreen" android:configChanges="orientation|keyboardHidden" android:theme="@android:style/Theme.NoTitleBar"
                  android:label="@string/app_name" android:screenOrientation="portrait">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    </application>
    <uses-permission android:name="android.permission.VIBRATE"/>

</manifest>

I think the issue is because you have repeated

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>

this for 2 activities. Try removing this and declare just 1 acivity as your main. Tjis may solve your issue.

Try this code inside the activities and check if it works:

@Override
public void onBackPressed() {
      finish();
      System.exit(0);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM