Android清单的android:exported ="false"阻止应用在设备上运行 [英] Android Manifest's android:exported="false" prevents app from running on device

查看:289
本文介绍了Android清单的android:exported ="false"阻止应用在设备上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

美好的一天,

在我的简单Andorid应用(实际上只是一个webview应用)中,我在Android Manifest中添加了"android:exported ="false",以避免出现未经许可的导出服务"警告/漏洞.但是,当我在设备上运行它时它将显示未安装应用程序"错误,除非我将其更改为"android:exported ="true",否则该应用程序将在我的设备上正常启动.

In my simple Andorid app which is really just a webview app, I added "android:exported="false" in Android Manifest to avoid the "Exported service without permissions" warning / vulnerability. However when I run it on my device it would give "App is not installed" error, unless I change it to "android:exported="true", then the app would launch fine on my device.

然后,我尝试按如下所示添加权限标签,以避免出现没有权限的导出服务"警告,但该应用程序将无法再次运行.正确运行应用程序的最佳方法是什么?我真的不需要导出任何服务. Internet权限用于我的应用程序中的某些注释链接,这些链接将在外部浏览器中打开.

I then tried to add a permission tag as follows to avoid the "Exported service without permissions" warning but the app would not run again. What would be best to have the app running correctly? I don't really need to export any service. The internet permissions is for some annotation links in my app which would open in an external browser.

对不起,如果我刚接触Android开发,但缺少一些基本知识,谢谢您的指点.

Sorry if I'm missing something basic as I'm new to Android development, thanks for any pointers.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"   
package=com.mymundane.app">
<uses-permission android:name="android.permission.INTERNET" />
<permission android:name=com.mymundane.app.mypermission" 
  android:label="mypermission" android:protectionLevel="signature">
</permission>
<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label=com.mymundane.app"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme"
    android:fullBackupContent="@xml/backup_descriptor">
    <activity android:name=com.mymundane.app.MainActivity" 
        android:exported="true"  android:screenOrientation="portrait" 
         android:permission=com.mymundane.app.mypermission">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

</manifest>

推荐答案

已导出"属性描述了是否可以允许其他人使用它.

The "exported" attribute describes whether or not someone else can be allowed to use it.

因此,如果您在某个Activity上具有"exported = false",则其他任何应用程序甚至Android系统本身都无法启动它.只有您可以在自己的应用程序内部执行此操作.

So if you have "exported=false" on an Activity, no other app, or even the Android system itself, can launch it. Only you can do that, from inside your own application.

因此,在标记为LAUNCHER Activity的Activity上设置"exported = false"基本上会告诉系统它永远无法启动您的应用程序.

So settings "exported=false" on the Activity marked as the LAUNCHER Activity would basically tell the system that it cant launch your application, ever.

至于您提到的错误,清单中没有显示任何服务?该警告在哪里显示?

As for the error you mentioned, i don't see any services in your manifest? Where is that warning shown for you?

这篇关于Android清单的android:exported ="false"阻止应用在设备上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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