we are using Square ReaderSDK library for implementing communication of Reader with our Point of Sale Android application. We set these two fields for the building of the app to the latest version, because of the need of other libraries, which are requiring it for the correct working: compileSdkVersion 31 buildToolsVersion 31
Then we also implemented latest Square libs for the above functionality: implementation "com.squareup.sdk.reader:reader-sdk-$SQUARE_READER_SDK_APPLICATION_ID:1.5.1" runtimeOnly "com.squareup.sdk.reader:reader-sdk-internals:1.5.1"
Unfortunately, once we tried to build the app even for debug purposes, we received the error message: Manifest merger failed : android:exported needs to be explicitly specified for . 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. See <activity> | Android Developers for details.
We found, that it’s caused by missing the field android:exported for any component in AndroidManifest.xml file which includes parameter with the body. So we went through the merged manifest (once we decreased/reverted the build version and tried to find which components are missing this field and are blocking us from success building). And it looks like, that this files defined within dependent libraries are missing it: com.squareup.ui.ApiActivity com.squareup.ui.LocationActivity com.squareup.ui.main.ApiMainActivity com.squareup.queue.QueueService$BootReceiver com.squareup.notification.LocaleChangeReceiver com.squareup.cardreader.ble.lock.PosMarkerReceiver
Is there a possibility to add that exported field into this SquareReaderSDK library with also all their dependencies so that it will support also the latest Android version 12 (build version code 31)?
Fixing such issue can be a bit cumbersome, cause the IDE doesn’t provide details on the error, it just tells you that there is an Activity, Receiver or Service without the exported parameter, but does not tell you which one it is. As Jakos recommend, you can manually check the merged manifest, or use this script in case the generated manifest is too large.