从Android Studio安装的应用程序会打开另一个活动而不是启动器活动

时间:2016-08-31 12:04:55

标签: android android-studio android-activity launcher run-app

每当我从Android工作室运行我的应用程序时,都会有

的活动
android:exported="true"

启动而不是启动器活动

<activity
        android:name=".activity.SplashScreen"
        android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize"
        android:label="@string/app_name"
        android:screenOrientation="portrait"
        android:theme="@style/Theme.AppCompat.NoActionBar"
        android:windowSoftInputMode="stateHidden|adjustPan">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

但是一旦安装了应用,就会打开正确的启动器活动,没问题。 当我从Android工作室启动我的应用程序时(即通过运行应用程序),只会发生问题。那么为什么会这样呢?

如果没有android:exported="true",在某些设备上,点击该应用的通知后,该活动就无法启动。那么保持导出真的很好吗?

此外,我无法在此处发布我的整个清单

2 个答案:

答案 0 :(得分:0)

When running the app from Android Studio, you're probably using instant run. which applies the code changes to the current running process of your app, so instead of installing the app again, it applies the new changes to the running app, in that case you see the current running activity as it is.

http://android-developers.blogspot.com.eg/2016/04/android-studio-2-0.html https://developer.android.com/studio/run/index.html

答案 1 :(得分:-1)

如果它只发生在Android Studio中而不是安装应用程序时,则很可能是运行配置存在问题。您可以通过转到

来访问它

运行 - &gt;编辑配置

相关问题