Android 警告:导出的活动不需要许可
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11333988/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Warning: Exported activity does not require permission
提问by Imesh Chandrasiri
I recently created a project and added a splash and a main activity. I edited the manifest file and added the splash activity and the main activity in to it. After adding the main activity, it gives me a warning "Exported Activity Does not Require Permission". What is this warning that it gives me? my API version is android:15.
我最近创建了一个项目并添加了一个启动项和一个主要活动。我编辑了清单文件并将启动活动和主要活动添加到其中。添加主要活动后,它给我一个警告“导出的活动不需要权限”。它给我的这个警告是什么?我的 API 版本是 android:15。
Please help, Thank you!
请帮忙,谢谢!
this is my manifest file!
这是我的清单文件!
<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>
采纳答案by Peterdk
It could be due to the <action android:name="com.sliit.droidman.main.MAINACTIVITY" />
. I don't know why you add that intent filter?
这可能是由于<action android:name="com.sliit.droidman.main.MAINACTIVITY" />
. 我不知道你为什么要添加那个意图过滤器?
You normally don't need an intent-filter for other normal activities.
您通常不需要其他正常活动的意图过滤器。
回答by lomec
add this to your activity definition
将此添加到您的活动定义中
android:exported="false"
回答by furykid
This warning means that your activities are exposed to different-process apps that might instantiate them without any required permission.
此警告意味着您的 Activity 会暴露给不同进程的应用程序,这些应用程序可能会在没有任何必要许可的情况下实例化它们。
for details see: http://developer.android.com/guide/topics/manifest/activity-element.htmlhttp://developer.android.com/guide/topics/manifest/activity-element.html#prmsn
详情参见:http: //developer.android.com/guide/topics/manifest/activity-element.html http://developer.android.com/guide/topics/manifest/activity-element.html#prmsn