Yes, but changing the compile sdk without changing the target sdk opens you up to a whole mess of issues. We had this issue when going from 30 to 31, in particular because we had several downstream libraries (of our own making) that needed to get updated to support the new bluetooth permissions before we could switch our target sdk to 31.
So we changed the compile sdk to 31 and left the target at 30. However, this basically meant that we couldn’t check the version of the OS we were running on to determine behavior. We instead had to check a combination of the OS version and the target sdk version, to decide whether to use location or the new bluetooth permissions.