0

I'm updating the very old project to the latest SDK version 32. While updating IDE shows, If Apps targeting Android 12 and higher are required to specify an explicit value for android:exported when the corresponding component has an intent filter defined. So that I add exported tag for all activities, Set the value true for Launching activity and set it false for other Activities and services.

android:exported="true"

Adding the Gradle script below.

compileSdkVersion 31
buildToolsVersion '32.0.0'
defaultConfig {
    applicationId "xx.xxxyyyxxx.xxx"
    minSdkVersion 21
    targetSdkVersion 31
    versionCode 81
    versionName "0.0.81"
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

After the update, the App icon is visible but the app won't open when I click on it. When clicking on it, it shows the toast message "App not found". Any idea about this? How do I sort this out?

KZoNE
  • 1,249
  • 1
  • 16
  • 27

3 Answers3

1

If your app targets Android 12 or higher and contains activities, services, or broadcast receivers that use intent filters, you must explicitly declare the android:exported attribute for these app components. If the app component includes the LAUNCHER category, set android:exported to true. In most other cases, set android:exported to false.

<service android:name="com.example.app.backgroundService"
     android:exported="false">
<intent-filter>
    <action android:name="com.example.app.START_BACKGROUND" />
</intent-filter>

For more info you can check this link

Himanshi Thakur
  • 2,077
  • 14
  • 32
0
<activity android:name=".MainActivity"
        android:exported="false"> <---- set the value false for Launching 
activity ,Other Activities --android:exported="true"
Tota Madhu
  • 26
  • 4
  • 2
    Remember that Stack Overflow isn't just intended to solve the immediate problem, but also to help future readers find solutions to similar problems, which requires understanding the underlying code. This is especially important for members of our community who are beginners, and not familiar with the syntax. Given that, **can you [edit] your answer to include an explanation of what you're doing** and why you believe it is the best approach? – Jeremy Caney Dec 25 '21 at 00:43
0

add android:exported="true" in your activity launcher activity in manifest