Android的启动错活动 [英] Android launching wrong activity

查看:149
本文介绍了Android的启动错活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Android的推出错误的活动时,我开始应用程序。

Android is launching wrong activity when I start app.

的Manifest.xml:

<activity
    android:name="com.company.app.activities.RS_SplashScreenActivity"
    android:label="@string/app_name" >
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />

        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>
<activity
    android:name="com.company.app.activities.RS_PreviousLauncherActivity"
    android:label="@string/app_name"
    android:theme="@style/myTheme" >
</activity> 

我添加了一个新的活动 RS_SplashScreenActivity ,并设置为发射活动。不过它试图启动 RS_ previousLauncherActivity 这曾经是一个启动的活动添加 RS_SplashScreenActivity 之前

I added a new Activity RS_SplashScreenActivity and set it as launcher activity. Still it tries to launch RS_PreviousLauncherActivity which used to be a launcher activity before adding RS_SplashScreenActivity.

我相信Android的选择上考虑以下日志错误的发射活动从控制台。

I am sure that android chooses wrong launcher activity on account of below logs from console.

控制台:

[2013-10-10 12:03:58 - app] Android Launch!
[2013-10-10 12:03:58 - app] adb is running normally.
[2013-10-10 12:03:58 - app] Performing com.company.app.activities.RS_PreviousLauncherActivity activity launch
[2013-10-10 12:04:01 - app] Uploading app.apk onto device '5C78E6332221CD6A1'
[2013-10-10 12:04:05 - app] Installing app.apk...
[2013-10-10 12:04:12 - app] Success!
[2013-10-10 12:04:12 - app] Starting activity com.company.app.activities.RS_PreviousLauncherActivity on device 5C78E6332221CD6A1
[2013-10-10 12:04:12 - app] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.company.app/.activities.RS_PreviousLauncherActivity }
[2013-10-10 12:04:13 - app] ActivityManager: java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.company.app/.activities.RS_PreviousLauncherActivity } from null (pid=4530, uid=2000) not exported from uid 10084
[2013-10-10 12:04:13 - app] ActivityManager: at android.os.Parcel.readException(Parcel.java:1425)
[2013-10-10 12:04:13 - app] ActivityManager: at android.os.Parcel.readException(Parcel.java:1379)
[2013-10-10 12:04:13 - app] ActivityManager: at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:1783)
[2013-10-10 12:04:13 - app] ActivityManager: at com.android.commands.am.Am.runStart(Am.java:463)
[2013-10-10 12:04:13 - app] ActivityManager: at com.android.commands.am.Am.run(Am.java:108)
[2013-10-10 12:04:13 - app] ActivityManager: at com.android.commands.am.Am.main(Am.java:81)
[2013-10-10 12:04:13 - app] ActivityManager: at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
[2013-10-10 12:04:13 - app] ActivityManager: at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:235)
[2013-10-10 12:04:13 - app] ActivityManager: at dalvik.system.NativeStart.main(Native Method)

任何想法,为什么出现这种情况?

Any idea why this happens?

编辑:

public class RS_SplashScreenActivity extends Activity {

    // Splash screen timer
    private static int SPLASH_TIME_OUT = 3000;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.splash_screen);

        new Handler().postDelayed(new Runnable() {

            @Override
            public void run() {
                // This method will be executed once the timer is over
                // Start your app main activity
                Intent i = new Intent(RS_SplashScreenActivity.this, RS_PreviousLauncherActivity.class);
                RS_SplashScreenActivity.this.startActivity(i);

                // close this activity
                RS_SplashScreenActivity.this.finish();
            }
        }, SPLASH_TIME_OUT);
    }

编辑: 当我删除的活动标记 RS_ previousLauncherActivity ,它检测到正确的活性发射,但是当我添加活动标签再然后开始选错活动。

Edit : When I remove activity tag for RS_PreviousLauncherActivity, it detects correct activity as launcher but when I add activity tag again then it starts selecting wrong activity.

编辑: 我得到下面的日志中的控制台。可能是这事做与我的问题。

Edit : I get below logs in console. May be this has something to do with my problem.

[2013-10-09 10:27:04 - app] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.apache.james.mime4j.message.Header$1) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.

还有一件事,同样的项目工程上的其他计算机。

And one more thing, this same project works on other machine.

推荐答案

右键点击您的项目,然后选择运行方式>运行配置... 。检查弹出你是否有在对话框中启动默认的活动安卓标签中选择:

Right click your project and select "Run As" > "Run Configurations...". Check in the dialog that pops up whether you have "Launch Default Activity" selected in the Android tab:

有可能的是,保持发射旧活动的机器上,它被设置以启动该特定活性(第二个单选按钮)误

It is likely that on the machine that keeps launching the old activity, it was set to launch that specific activity (the second radio button) by accident.

这篇关于Android的启动错活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆