-2

enter image description here

Apparently, there is an error in the code regarding android:exported, which should be true. In this error, it is stated that I must clearly state that android:exported="true" is about the receiver. Now my problem is that I did not use the receiver at all in AndroidManifest. Please help based on the image and source code of AndroidManifest that I have attached.

<?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>
Giorgio
  • 1,973
  • 4
  • 36
  • 51
tfih313
  • 3
  • 4
  • Somehow the error messages do not match with the manifest. The error messages are about activities in the "com.onesignal" namespace, the manifest references the "com.Coading.freecode" namespace. – Thomas Kläger Nov 24 '22 at 09:20

1 Answers1

1

Problem with exported. You need to set android:exported="false" to all other activities (android:exported="true" for launch activity or start activity).

If you're targeting android >=12 set all other activity to android:exported="false"

Like below code

<activity
            android:name="com.Coading.freecode.activity.MainActivity"
            android:screenOrientation="portrait"
            android:exported="false" // as here mentioned
            android:windowSoftInputMode="adjustPan" />

The exported attribute is used to define if an activity, service, or receiver in your app is accessible and can be launched from an external application.

Making it mandatory to define the exported value of each activity, service, and receiver adds a new layer of security. Since the developer will need to set it in order to compile the app to Android 12.

See doc https://developer.android.com/about/versions/12/behavior-changes-12#exported

Read more: https://cafonsomota.medium.com/android-12-dont-forget-to-set-android-exported-on-your-activities-services-and-receivers-3bee33f37beb

Hope this helps.

M DEV
  • 763
  • 1
  • 7
  • 20
  • According to you, I added android:exported="false" to all the activities, but it still gives me an error, and according to the links you gave in the attachment, I entered the merged manifest and put the list of errors in the attachment, please help me. link error : https://s6.uupload.ir/files/capture_snnl.png. – tfih313 Nov 24 '22 at 14:47
  • @tfih313 You're using any CamScanner application dependency in your app? – M DEV Nov 24 '22 at 15:44
  • This application will run until the target is 30 and it will not run when the target is 33. I have attached the pictures of the dependencies for you. Please see and give your opinion. image: https://s6.uupload.ir/files/screenshot_2022-11-25_191933_an31.png image: https://s6.uupload.ir/files/screenshot_2022-11-25_1921082_pb7.png – tfih313 Nov 25 '22 at 16:00