Sam
Sam

Reputation: 11

java.lang.IllegalArgumentException: xyz.appmaker.iiuiro: Targeting S+ (version 31 and above)

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/appName"
    android:supportsRtl="true"
    android:theme="@style/Theme.LauncherActivity">
    <meta-data
        android:name="asset_statements"
        android:resource="@string/assetStatements" />


    <meta-data
        android:name="twa_generator"
        android:value="@string/generatorApp" />

    <activity android:exported="true" android:name="com.google.androidbrowserhelper.trusted.LauncherActivity"
        android:label="@string/launcherName">
        <meta-data android:name="android.support.customtabs.trusted.DEFAULT_URL"
            android:value="@string/launchUrl" />

        <meta-data
            android:name="android.support.customtabs.trusted.STATUS_BAR_COLOR"
            android:resource="@color/colorPrimary" />

        <meta-data
            android:name="android.support.customtabs.trusted.NAVIGATION_BAR_COLOR"
            android:resource="@color/navigationColor" />

        <meta-data android:name="android.support.customtabs.trusted.SPLASH_IMAGE_DRAWABLE"
            android:resource="@drawable/splash"/>

        <meta-data android:name="android.support.customtabs.trusted.SPLASH_SCREEN_BACKGROUND_COLOR"
            android:resource="@color/backgroundColor"/>

        <meta-data android:name="android.support.customtabs.trusted.SPLASH_SCREEN_FADE_OUT_DURATION"
            android:value="@integer/splashScreenFadeOutDuration"/>

        <meta-data android:name="android.support.customtabs.trusted.FILE_PROVIDER_AUTHORITY"
            android:value="@string/providerAuthority"/>

        <meta-data android:name="android.app.shortcuts" android:resource="@xml/shortcuts" />

        <meta-data android:name="android.support.customtabs.trusted.FALLBACK_STRATEGY"
            android:value="@string/fallbackType" />

        
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>

        <intent-filter android:autoVerify="true">
            <action android:name="android.intent.action.VIEW"/>
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE"/>
            <data android:scheme="https"
                android:host="@string/hostName"/>
        </intent-filter>
    </activity>

    <activity android:name="com.google.androidbrowserhelper.trusted.FocusActivity" />

    <activity android:name="com.google.androidbrowserhelper.trusted.WebViewFallbackActivity"
        android:configChanges="orientation|screenSize" />

    <provider
        android:name="androidx.core.content.FileProvider"
        android:authorities="@string/providerAuthority"
        android:grantUriPermissions="true"
        android:exported="false">
        <meta-data
            android:name="android.support.FILE_PROVIDER_PATHS"
            android:resource="@xml/filepaths" />
    </provider>

    <service
        android:name="com.google.androidbrowserhelper.trusted.DelegationService"
        android:enabled="@bool/enableNotification"
        android:exported="@bool/enableNotification">



        <intent-filter>
            <action android:name="android.support.customtabs.trusted.TRUSTED_WEB_ACTIVITY_SERVICE"/>
            <category android:name="android.intent.category.DEFAULT"/>
        </intent-filter>
     </service>

</application>

Hi this is my PWA App manifest xml code

This code is working till android 7.0

but we have upgraded to android 33sdk version but the app is crashing

(showing This Error)

FATAL EXCEPTION: main Process: xyz.appmaker.iiuiro, PID: 2838 java.lang.IllegalArgumentException: xyz.appmaker.iiuiro: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles. at android.app.PendingIntent.checkFlags(PendingIntent.java:401) at android.app.PendingIntent.getActivityAsUser(PendingIntent.java:484) at android.app.PendingIntent.getActivity(PendingIntent.java:470) at android.app.PendingIntent.getActivity(PendingIntent.java:434) at androidx.browser.customtabs.CustomTabsClient.createSessionId(CustomTabsClient.java:185) at androidx.browser.customtabs.CustomTabsClient.newSession(CustomTabsClient.java:223) at com.google.androidbrowserhelper.trusted.TwaLauncher$TwaCustomTabsServiceConnection.onCustomTabsServiceConnected(TwaLauncher.java:301) at androidx.browser.customtabs.CustomTabsServiceConnection.onServiceConnected(CustomTabsServiceConnection.java:57) at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:2188) at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:2221) at android.os.Handler.handleCallback(Handler.java:942) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:201) at android.os.Looper.loop(Looper.java:288) at android.app.ActivityThread.main(ActivityThread.java:7872) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

Upvotes: 1

Views: 97

Answers (1)

TNT
TNT

Reputation: 79

To resolve this issue you need to modify your manifest file.

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.

You can refer to the following link for more info on this: https://developer.android.com/about/versions/12/behavior-changes-12#exported

Upvotes: 0

Related Questions