javaandroidkotlingradlegoogle-play-core

Error with Receiver Export on API 34: "One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED Should be Specified"


I am developing an Android application and encountered the following error message:

One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts.

This error occurred when I was using com.google.android.play:core:1.10.3. I suspect it's related to how broadcast receivers are registered or managed in the app. Since I use this libraries in app update functions, I can not remove it.


Solution

  • With new google updates, they extract in app update from core library. You can remove this

    implementation 'com.google.android.play:core:1.10.3'
    

    And add this

    implementation 'com.google.android.play:app-update:2.1.0'
    

    After making this change, sync your project with the updated Gradle files. This should resolve the error related to the RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED specification in API 34.

    Thanks for @pakman suggestion, you can see the migration details on this official source. here: https://developer.android.com/guide/playcore/in-app-updates/kotlin-java