enter image description here
显然,在代码中有一个关于android:exported的错误,这应该是真的。在这个错误中,我必须明确声明android:exported=“true”是关于接收器的。现在我的问题是,我在AndroidManifest中根本没有使用接收器。请根据我所附的AndroidManifest的图片和源代码提供帮助。
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-feature
android:name="android.hardware.camera"
android:required="true" />
<uses-feature
android:name="android.hardware.camera.autofocus"
android:required="false" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="com.android.vending.BILLING" />
<application
android:name="com.Coading.freecode.MyApp"
android:allowBackup="true"
android:hardwareAccelerated="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:largeHeap="true"
android:networkSecurityConfig="@xml/network_security_config"
android:requestLegacyExternalStorage="true"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.CamScanner"
android:usesCleartextTraffic="true">
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true"
tools:replace="android:authorities">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths"
tools:replace="android:resource" />
</provider>
<activity android:name="com.Coading.freecode.activity.BaseActivity" />
<activity
android:name="com.Coading.freecode.activity.SplashActivity"
android:screenOrientation="portrait"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.Coading.freecode.activity.MainActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan" />
<activity
android:name="com.Coading.freecode.activity.ScannerActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.yalantis.ucrop.UCropActivity"
android:theme="@style/uCropStyle"
android:screenOrientation="portrait" />
<activity
android:name="com.Coading.freecode.activity.IDCardPreviewActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.Coading.freecode.activity.CropDocumentActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.Coading.freecode.activity.CurrentFilterActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.Coading.freecode.activity.SavedDocumentActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.Coading.freecode.activity.DocumentEditorActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustNothing" />
<activity
android:name="com.Coading.freecode.activity.SavedEditDocumentActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.Coading.freecode.activity.SavedDocumentPreviewActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.Coading.freecode.activity.NoteActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.Coading.freecode.activity.ImageToTextActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.Coading.freecode.activity.GroupDocumentActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.Coading.freecode.activity.PDFViewerActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.Coading.freecode.activity.QRGenerateActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.Coading.freecode.activity.QRReaderActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.Coading.freecode.activity.PrivacyPolicyActivity"
android:screenOrientation="portrait" />
<meta-data
android:name="com.google.android.gms.vision.DEPENDENCIES"
android:value="ocr" />
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="@string/admob_app_id" />
</application>
</manifest>
1条答案
按热度按时间2cmtqfgy1#
exported
出现问题。您需要将android:exported="false"
设置为所有其他活动(android:exported="true"
用于启动活动或启动活动)。如果您的目标是android〉=12,则将所有其他活动设置为
android:exported="false"
如以下代码
导出的属性用于定义应用中的Activity、服务或接收器是否可访问以及是否可从外部应用启动。
强制定义每个Activity、服务和接收器的导出值增加了一层新的安全性,因为开发人员需要设置它才能将应用编译到Android 12。
请参见文档https://developer.android.com/about/versions/12/behavior-changes-12#exported
阅读更多信息:https://cafonsomota.medium.com/android-12-dont-forget-to-set-android-exported-on-your-activities-services-and-receivers-3bee33f37beb
希望这对你有帮助。