Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android 12 error Targeting S+ #609

Open
DalterioRaffaele opened this issue Nov 4, 2022 · 12 comments
Open

Android 12 error Targeting S+ #609

DalterioRaffaele opened this issue Nov 4, 2022 · 12 comments
Assignees
Milestone

Comments

@DalterioRaffaele
Copy link

Plugin don't work with android 12. 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.

@victorsosa
Copy link
Collaborator

any contribution is welcome

@victorsosa victorsosa self-assigned this Nov 4, 2022
@victorsosa victorsosa added this to the 1.9.3 milestone Nov 4, 2022
@ogousa
Copy link

ogousa commented Nov 14, 2022

if I set target=30 in config.xml :
<preference name="android-targetSdkVersion" value="30" />
will it work on my Android 13 device?

@EYALIN
Copy link
Contributor

EYALIN commented Nov 16, 2022

@DalterioRaffaele new version tested and works. what is the plugin version you are using?

@DalterioRaffaele
Copy link
Author

<plugin name="cordova-plugin-google-analytics" spec="^1.9.0">
    <variable name="GMS_VERSION" value="16.0.8" />
</plugin>

@EYALIN
Copy link
Contributor

EYALIN commented Nov 18, 2022

@DalterioRaffaele so please upgrade to 1.9.2 (remove the plugin and add it again). that should solve your problem.

@peggyyu526
Copy link

@EYALIN Remove plugin and install 1.9.2 doesn't work (also tried to reset the project)

@EYALIN
Copy link
Contributor

EYALIN commented Nov 18, 2022

@peggyyu526 for some reason, upgrading the plugin does not update the whole files (it's happened to me only with this plugin).
can you please share plugin.xml from the plugin? so I will try to understand what is missing there

@pugwonk
Copy link

pugwonk commented Jan 6, 2023

I'm using 1.9.2 and I'm still getting an error response from startTrackerWithId:

com.my.app: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.

I'm on Android 13 - is it possible this fix didn't take or there's a regression from Android 12?

@ZumelzuR
Copy link

Something that work in my specific case was to change the version of the
com.google.android.gms:play-services-analytics dependency, I had setted 15.0.1, and this was causing the issue. After I update to

implementation "com.google.android.gms:play-services-analytics:18.0.1"

the issue was solved. In ionic for do this you should change the version of the google play services version on the config.xml

<plugin name="cordova-plugin-google-analytics" spec="1.8.6">
    <variable name="PLAY_SERVICES_VERSION" value="18.0.1" />
    <variable name="GMS_VERSION" value="18.0.1" />
</plugin>

or removing and adding the plugin again adding the parameters with the proper versions for PLAY_SERVICES_VERSION and GMS_VERSION.

Also becareful, make sure if you do this change that you change all play services to the same version (18.+ in my case), for example I use cordova-plugin-googleplus, so you should change also the PLAY_SERVICES_VERSION for this plugin and all that inject a play-services dependency in the build.gradle file after the build.

@victorsosa
Copy link
Collaborator

any PR patch is welcome

@ZumelzuR
Copy link

any PR patch is welcome

As I told, there is NO need of a PR with a patch. Simply is a matter of use the properties at the time of install this plugin. As you put in the documentation:

cordova plugin add cordova-plugin-google-analytics --variable GMS_VERSION=11.0.1 --PLAY_SERVICES_VERSION=11.0.1

instead of 11.0.1, 18.0.1

@victorsosa
Copy link
Collaborator

yes, you are right

@victorsosa victorsosa modified the milestones: 1.9.3, 1.9.4 May 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants