samzilverberg/cordova-mixpanel-plugin

error: cannot find symbo

Closed this issue · 6 comments

raxon commented

After add plugin to cordova 10 and try build i got error, on ios works like normal

platforms/android/app/src/main/java/android/MixpanelPlugin.java:333: error: cannot find symbol
        mixpanel.getPeople().setPushRegistrationId(pushId);
                            ^
  symbol:   method setPushRegistrationId(String)
  location: interface People

Having the same error .

Same error either...

I know this is not the best practice but is a quick solution.

1- On the project root create folder 'modules'
2- Copy the folders 'cordova-plugin-mixpanel' and 'mixpanel' to the new folder 'modules'
Example:

-ProjectRoot
-- modules
---- cordova-plugin-mixpanel
---- mixpanel
-- package.json
.......
3- Add the dependency on package.json

{
  "dependencies": {
      "@awesome-cordova-plugins/mixpanel": "file:modules/mixpanel",
      "cordova-plugin-mixpanel": "file:modules/cordova-plugin-mixpanel",
  }
}

4- Go to '/modules/cordova-plugin-mixpanel/src/android/MixpanelPlugin.java'
4.1- find 'mixpanel.getPeople().setPushRegistrationId(pushId)',
4.2- Comment this line or change it with the new way or official documentation.

5- Remove node_modules and install again, sync .

Note:
I was looking for the method setPushRegistrationId but apparently is not official on mixPanel .
Feel free to destroy mi opinion.

Ran into the same problem.. it works when commenting out mixpanel.getPeople().setPushRegistrationId(pushId); in the MixpanelPlugin.java file (same file from above)

    private boolean handlePeopleSetPushId(JSONArray args, final CallbackContext cbCtx) {
        String pushId = args.optString(0);
         // mixpanel.getPeople().setPushRegistrationId(pushId);
        cbCtx.success();
        return true;
    }

Although a more definite solution is prefered.

Edit:
After some research I found out that because Mixpanel has discontinued their push services (Messages & Experiments) and removed it from their API since 6.0.0 (https://github.com/mixpanel/mixpanel-android/wiki/Changelog). setPushRegistrationId() was still available prior to that. Made a PR to completely remove it for Android: #133 . It's already been removed on the iOS side.

Thanks, this will be include in next release

package published