警告:导出的活动不需要许可

Ime*_*iri 40 android android-manifest android-layout

我最近创建了一个项目并添加了一个启动和主要活动.我编辑了清单文件,并将启动活动和主要活动添加到其中.添加主活动后,它会向我发出警告"导出的活动不需要权限".这给了我什么警告?我的API版本是android:15.

请帮帮忙,谢谢!

这是我的清单文件!

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sliit.droidman"
android:versionCode="1"
android:versionName="1.0">

<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="15" />

<application android:label="@string/app_name"
    android:icon="@drawable/ic_launcher"
    android:theme="@style/AppTheme">
    <activity
        android:name=".SplashActivity"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.NoTitleBar">
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
    </activity>        
    <activity
        android:name="com.sliit.droidman.main.MainActivity"
        android:label="@string/app_name">
        <intent-filter>
            <action android:name="com.sliit.droidman.main.MAINACTIVITY" />
            <category android:name="android.intent.category.DEFAULT"/>
        </intent-filter>
    </activity>
</application>

</manifest>
Run Code Online (Sandbox Code Playgroud)

小智 75

将其添加到您的活动定义中

android:exported="false"
Run Code Online (Sandbox Code Playgroud)


小智 30

此警告意味着您的活动会暴露给可能在没有任何必要权限的情况下实例化它们的不同流程应用程序.

有关详细信息,请参阅:http : //developer.android.com/guide/topics/manifest/activity-element.html http://developer.android.com/guide/topics/manifest/activity-element.html#prmsn

  • 机器人:出口="假" (2认同)

Pet*_*rdk 26

这可能是由于<action android:name="com.sliit.droidman.main.MAINACTIVITY" />.我不知道你为什么要添加那个意图过滤器?

您通常不需要针对其他正常活动的intent-filter.

  • 我实际上是关于创建一个简单的Android应用程序的youtube教程.在那里,导师只是注意到了一个意图过滤器.他提到了原因.:(这就是为什么我把意图过滤器,nd现在Iget我真的不需要组件的意图过滤器!:)我刚刚通过Android开发人员区!:) 感谢您的时间! (2认同)