terveystalo / react-native-piwik-pro-sdk

React Native wrapper for Piwik Pro SDK
https://www.npmjs.com/package/react-native-piwik-pro-sdk
MIT License
2 stars 2 forks source link

Android crash java.lang.ClassNotFoundException #39

Closed aeirola closed 3 years ago

aeirola commented 3 years ago

Android apps which do not contain the com.google.android.gms:play-services-ads-identifier package crash with the following error:

Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/ads/identifier/AdvertisingIdClient;
at pro.piwik.sdk.Tracker$1.doInBackground(Tracker.java:225)
at pro.piwik.sdk.Tracker$1.doInBackground(Tracker.java:220)
at android.os.AsyncTask$3.call(AsyncTask.java:394)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)

This is due to the fact that the upstream library doesn't mark its dependencies properly. See https://github.com/PiwikPRO/PPMS-PublicDocs/issues/520

This could probably be circumvented by adding the upstream dependency to this library.

aeirola commented 3 years ago

Apparently this only happens if you have a dependency which increases the version of com.google.android.gms:play-services-basement from 11.0.4 to 15.0.0 or higher. But as 15.0.0 was released in April 2018, it is probably better to assume that a client would want to use a newer version, instead of attempting to limit the version to 15.0.0.