Questions tagged [android-12]
For questions regarding programming in Android 12 (a.k.a., Android S), the primary 2021 version update for the Android OS.
android-12
549
questions
246
votes
39
answers
259k
views
android:exported needs to be explicitly specified for <activity>. Apps targeting Android 12 and higher are required to specify
After upgrading to android 12, the application is not compiling. It shows
"Manifest merger failed with multiple errors, see logs"
Error showing in Merged manifest:
Merging Errors:
Error: ...
133
votes
9
answers
98k
views
Targeting S+ (version 31 and above) requires that an explicit value for android:exported be defined when intent filters are present]
While debugging the application in android 12, the app is getting crashed.
110
votes
22
answers
97k
views
You uploaded an APK or Android App Bundle which has an activity, activity alias, service or broadcast receiver with intent filter, but without the 'an
Issue: You uploaded an APK or Android App Bundle which has an activity, activity alias, service, or broadcast receiver with intent filter, but without the 'android: exported' property set. This file ...
92
votes
9
answers
34k
views
Why am I seeing EGL_emulation app_time_stats in the log when running on an Android 12 emulator?
When testing a Flutter app on an emulator running Android 12, I'm seeing lines like these in the logs at regular intervals (approximately every second):
D/EGL_emulation(32175): app_time_stats: avg=312....
88
votes
12
answers
150k
views
Android 12 New Bluetooth Permissions
Bluetooth is the main dependency of our app. So, We already try to implement new Android 12 Bluetooth permissions. Our only resource is Android developers New Bluetooth permissions in Android 12. ...
85
votes
8
answers
71k
views
Fatal Android 12: Exception: startForegroundService() not allowed due to mAllowStartForeground false
I noticed one exception (Firebase Crashlytics) for Pixel 5 and Pixel 4a (both on Android 12), no other devices, happened only two times, one time for each device.
What does it mean? Android 11 and 12 ...
79
votes
8
answers
84k
views
Manifest merger failed targeting Android 12 [duplicate]
Using Android Studio 4.2.1, after changing sdk target to Android 12 in my build.gradle file, I am getting a Manifest merger failed with multiple errors, see logs error.
The errors shown in the Merged ...
72
votes
14
answers
40k
views
Android 12 Splash Screen Icon Not Displaying
I am seeing a weird issue with a new app that I am starting. I am utilizing the new Android 12 splash screen API to create my splash screen and I followed the guide provided by Google to do so. I ...
72
votes
11
answers
71k
views
Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified
App crashes at runtime with the following error :
java.lang.IllegalArgumentException: maa.abc: Targeting
S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or
FLAG_MUTABLE be specified ...
61
votes
5
answers
31k
views
Google Chrome browser in Android 12 emulator doesn't load any webpages (internet is working!)
I'm using Android Studio 2020.3.1 Patch 2, on Windows 10 and I'm running an Android 12 emulator.
I'm attempting to simply load any webpage using Google Chrome, however all that happens is that the ...
57
votes
8
answers
74k
views
Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent, On AlarmPingSender
Problem
Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. I got it after updating target SDK to 31. the error always ...
49
votes
7
answers
22k
views
How to configure Toast icon in Android 12?
Starting with Android 12, Google show a toast message with an app icon.
My application have launcher icon. Android 12 splash screen show app icon correctly.
Show toast by code
Toast.makeText(this, &...
47
votes
22
answers
85k
views
android:exported added but still getting error Apps targeting Android 12 and higher are required to specify an explicit value for android:exported
I have added android:exported="true" to my only activity in manifest but still getting below error after updating compile sdk and target sdk version to 31.I also tried rebuilding the project ...
44
votes
2
answers
11k
views
How does setExpedited work and is it as good&reliable as a foreground service?
Background
In the past, I used a foreground IntentService to handle various events that come one after another. Then it was deprecated when Android 11 came (Android R, API 30) and it was said to ...
29
votes
4
answers
8k
views
CannotDeliverBroadcastException only on Pixel devices running Android 12
I'm seeing a crash come through Crashlytics that I'm unable to reproduce or locate the cause of. The crash only ever happens on Google Pixel devices running Android 12, and the crash always happens in ...
25
votes
2
answers
8k
views
Android 12 Splash Screen API customization
Since Android released the new Splash Screen API with Android 12, a lot of apps had issues with duplicate splash screens, lack of customization, etc.
Right now, it is possible to set the background ...
24
votes
3
answers
26k
views
Android 12 - Foreground service launch restrictions
I'm developing an SDK that needs to startForeground service from the background. Because it uses background location and Bluetooth-related works. If the application is killed, the monitoring is ...
22
votes
2
answers
25k
views
How to verify android app links on android 12 and higher?
Problem is opening application over link in android 12 or higher.
Everything works fine on lower versions of android.
When I look at my “App Info” -> “Open by default” screen. I see unapproved ...
21
votes
1
answer
3k
views
Android 12: How to prevent activity restart on changing phone wallpaper?
On Android 12,
If we open an activity
Go to the home screen of the phone to change the wallpaper
Switch back to our activity, the activity restarts.
It seems it is related to the Material You ...
20
votes
3
answers
18k
views
Got "lacks permission android.permission.BLUETOOTH" on Specific device after android 12 update
So i have an application that connect to bluetooth printer. It is fine and running on all devices except these devices:
Xiaomi redmi note 10 Pro (Updated to android 12 with MIUI 13.0.1)
Oppo Reno 5 ...
20
votes
1
answer
5k
views
Is there a way to change the shape of the splash screen icon in Android 12?
I'm in the process of customizing the new splash screen that is being implemented in Android 12.
I have been able to change the icon to the one I want using
"< item name="...
18
votes
2
answers
9k
views
Cannot resolve method 'installSplashScreen' in 'SplashScreen'
I'm trying to migrate my existing custom Splash screen implementation to Android 12. I have implemented it exact same way as mentioned in the provided link : as mentioned in the provided link
When I ...
18
votes
0
answers
1k
views
How to close notification panel without AccessibilityService in Android 12?
I'm looking for a way to close a notification panel after the user pressed some button in my notification. Currently, I'm doing it like that:
sendBroadcast(Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS))
...
17
votes
1
answer
7k
views
How to implement themed icons by Material You in my Android App?
I can't find anything about that online, no documentation, nothing. Maybe one of you know how to do it or have got some advice for me.
Thank you in advance.
17
votes
3
answers
10k
views
Add multiple sizes of splash screen in ionic cordova when migrating to android 12 and above
Am trying to migrate ionic cordova app to android 12 (api 32). Cannot use <splash> tags anymore. instead that I should use <preference name="AndroidWindowSplashScreenAnimatedIcon" ...
17
votes
3
answers
2k
views
Android 12- Material You theme not working in emulator
I have created an android 12 emulator to see one of the features that is material you theme
Emulator details are
Name: Pixel 5
CPU: x86_64
the issue is when I change the wallpaper from settings ->...
16
votes
5
answers
7k
views
Android 12 splash screen before api 21
I'm trying to upgrade my application to target android 31 which introduces splash screen API so I followed the migration process mentioned here, but after migration the application doesn't run because ...
15
votes
3
answers
8k
views
Splashscreen Icon not showing entirely
I use the new splashscreen api to add an evenly splashscreen to all android versions down to API Level 23.
Are there any requirements for the splash icon? Currently i try to use a svg and i thought it ...
15
votes
2
answers
3k
views
Emulator for Android 12 preview no connection
I have installed the Android 12 Preview emulator. I had a lot of problems because the emulator was crashing on start up but after uninstalling and installing it again and restarting the machine etc, I ...
15
votes
0
answers
1k
views
Android 12 custom splash screen with background image
Can we use a background image drawable instead of a background single color. For other OS versions we had background image. Now how to set the exact same on Android 12? Any workaround possible?
14
votes
1
answer
6k
views
In Android 12/API 31, Geofence doesn't work with IMMUTABLE pendingintent. Why?
A new PendingIntent field in PendingIntent is FLAG_IMMUTABLE.
In 31, you must specify MUTABLE or IMMUTABLE, or you can't create the PendingIntent, (Of course we can't have defaults, that's for losers) ...
14
votes
3
answers
19k
views
TelephonyManager deprecated listen() CALL_STATE_RINGING on android 12
I'd like to listen if there's a phone call happening while my app is in the foreground.
It was like this before but now listen() is deprecated:
val tm = context.getSystemService(Context....
14
votes
4
answers
13k
views
How to use or opt out in Android 12 SplashScreen
The new API SplashScreen in Android 12 seems good but just like before the sample code in the documentation does not really help explaining the whole and proper implementation. There is also some ...
13
votes
6
answers
14k
views
Android 12 Splash Screen API - Increasing SplashScreen Duration
I am learning Android's new SplashScreen API introduced with Android 12. I have so far gotten it to work on my Emulator and Google Pixel 4A, but I want to increase its duration. In my Splash Screen I ...
12
votes
1
answer
24k
views
The application could not be installed: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED android 12 [duplicate]
Getting the following error when trying to install the app in android 12 device.
Installation did not succeed.
The application could not be installed: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED
Error
...
12
votes
4
answers
5k
views
Unable to get WIFI SSID using onCapabilitiesChanged in Android 12
Description
I am unable to get WIFI SSID using the onCapabilitiesChanged in the ConnectivityManager.NetworkCallback class in Android-12.
In Android-12, getConnectionInfo is deprecated. So, as the ...
12
votes
3
answers
4k
views
AudioManager auto switching own mode + not respecting setSpeakerphoneOn()
I want to play some audio with volume lvl adjusted to ear aka. "phone call mode". For this purpose, I'm using well-known and commonly advised
audioManager.setMode(audioNormalState ?
...
11
votes
4
answers
4k
views
Missing mutability flags: Android 12 pending intents with NavDeepLinkBuilder
I´ve started testing my app for issues on Android 12, and have had some warnings regarding mutability flags on pending intents that are set up for a home screen widget. These mutability flags are now ...
11
votes
1
answer
5k
views
Android 12 Battery optimization
I am trying to check if Android 12 is optimizing my app battery usage, so I used
isIgnoringBatteryOptimizations method (
https://developer.android.com/reference/android/os/PowerManager#...
11
votes
3
answers
13k
views
Android 12 Pending Intent Immutable flag not available under API 23
Similar to this question, but not the same
After update to Android 12 (SDK 31) we change PendingIntent.getActivity(context, 0, intent, 0) to PendingIntent.getActivity(context, 0, intent, PendingIntent....
10
votes
1
answer
3k
views
Android 12 Splash Screen Icon Not Showing From Notification
I am using the Android 12 splash screen API and while the splash screen icon shows without issue when opening the app from the launcher, opening the app from a notification only displays the splash ...
10
votes
2
answers
9k
views
'getter for connectionInfo: WifiInfo!' is deprecated. Deprecated in Java (Api 31)
When I want to get info about current wifi connection via WifiManager.connectionInfo I get
this:
'getter for connectionInfo: WifiInfo!' is deprecated. Deprecated in Java
How can I do it in Android ...
10
votes
3
answers
3k
views
Splash Screen API not support in Dark mode
I am trying to implement a splash screen.
I have followed the splash screen API approach implemented the
implementation 'androidx.core:core-splashscreen:1.0.0-alpha02'
splash.xml
<style name="...
9
votes
7
answers
11k
views
Android paho mqtt crashes Android 12 - Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE
I am using 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.5' for mqtt service and the app keeps crashing on android 12 devices with the following crash logs
java.lang.IllegalArgumentException: ...
9
votes
6
answers
11k
views
Flutter : INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during installPackageLI
My flutter app isn't install on Android 12 version. I tried with android:exported, but nothing work. It's show me this type of error-
✓ Built build/app/outputs/flutter-apk/app-debug.apk.
Installing ...
9
votes
4
answers
11k
views
Ionic android 12 splash error while adding cordova-android@11
Since Google raised the minimum sdk to 31 on the Google play console I had to make some changes and updates to Android 12, but when I try to add a new Android platform android@11 I have had this error ...
9
votes
4
answers
2k
views
Splash screen api is showing action bar for android 12
After the splash screen loads, I am getting a action bar, but I have set postSplashScreenTheme to no action bar theme. This is happening only to android 12 emulator.
<?xml version="1.0" ...
9
votes
2
answers
4k
views
Android 12 Device Owner Provisioning
I have an application, that can be successfully setup as Device Owner on devices up to Android 12 via QR code from JSON below:
{
"android.app.extra.PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME":
...
9
votes
1
answer
1k
views
on android 12 how to close the notification drawer when tap on the action button
When tap on notification's action button, if it is handled in a service the notification drawer could be closed with
public void onReceive(final Context context, final Intent intent) {
... ...
...
9
votes
0
answers
3k
views
Check if user has granted access to nearby device permission
I am reading the documentation here for the Android Nearby Permission specially for Android 12. I want to check if the user has granted access to Nearby device permission programmatically. The ...