Closed EmilAlipiev closed 4 years ago
Hello, Could you try updating android support library dependencies, install the OneSignal plugin (Beta*) and configure the project to Android pie in general and android application settings? See #135 for a similar response. Give it a try and let me know!
Closing due to no response
hi, i am just revisiting this issue and i followed your suggestion but problem still there. it didnt help. I am still getting below error message using R8, it doesnt occur with Proguard.
7>R8 : warning : Missing class: com.amazon.device.messaging.ADMMessageReceiver 7>R8 : warning : Missing class: com.amazon.device.messaging.ADMMessageHandlerBase 7>R8 : warning : Missing class: com.amazon.device.iap.PurchasingListener 7>R8 : error : Compilation can't be completed because some library classes are missing.
@EmilAlipiev , Are you using Proguard?
Edit: because R8 uses a different config file, it looks like the warnings aren't getting suppressed. This is strange, however, because you should be getting a lot more than those 3
Yes I use proguard. I dont get other warnings because I handled those in my proguard config file. See attached repro in xamarin.androif issue above. I use also vs2019 16.1.1 version which has new setting to switch between dx/proguard and r8/d8. So using dx and proguard project works fine but using d8 and r8, it fails with those errors.
@EmilAlipiev , Thanks for your patience while we investigate this issue.
Hi
I have the same exact problem her using las VS Xamarin for mac
R8 : warning : Missing class: com.amazon.device.messaging.ADMMessageReceiver R8 : warning : Missing class: com.amazon.device.messaging.ADMMessageHandlerBase R8 : warning : Missing class: com.amazon.device.iap.PurchasingListener R8 : error : Compilation can't be completed because some library classes are missing.
Seeing the same problem too. With upcoming changes to the way Google expects app upload (1st August), it would be good to have a resolution to this issue soon. Thanks
hi, i have made it working by setting linking to none in android project properties
@tirathpal this will not show the error as by setting linking to none you are not linking and therefore not using either D8 or R8 tools. The tools are there in order to link and do things like reduce the size of production apps
I did a fair amount of testing for this issue and here are my findings.
Native With a native project with and without importing OneSignal's SDK, D8 and R8 with multidexing enabled works perfectly fine. This led me to believe this was a Xamarin specific issue.
Xamarin I created a brand new Xamarin project and started off with dx and proguard enabled. I tested with and without multidexing enabled. Then I imported OneSignal and still no issues. Now I tried working with D8 and R8 without multidexing enabled and noticed no issues. Now I enabled multidexing and have not imported OneSignal SDK and notice an InflateException instead of a build error. Last thing to try was OneSignal import to reproduce your exact build error and noticed with multidexing disabled the issue does not occur, but with multidexiing enabled this is when the build error occurs and because of previous testing this would not be a OneSignal specific error but some sort of combination of R8 and multidex actually removing something from the project and causing any number of issues. In this case, OneSignal is missing libraries and without OneSignal the demo app has a InflateException for one of the layout resources.
Xamarin Github Issues with R8, D8 and Multidex Here is a similar issue I found on Xamarin's GIthub issues. https://github.com/xamarin/xamarin-android/issues/3136
what has this error to do with what i reported originally? i reported this in January and at the time i reported, this other bug wasnt exist. I have tested in intensively that time and without OneSignal package installed it was working perfectly fine. Other error has totally nothing to do with this issue. They produced a new bug seems like even related to Debug mode and in the conversation, it is claimed it works on release mode. Even it doesnt, they produced another bug but if they solved that bug today, this bug related to OneSignal package is exist. Please read the xamarin/xamarin-android#2670, there is workaround suggested there but i dont see why we should do this just for this library should handle it
Hi @EmilAlipiev I agree. It does seem to be a OneSignal package problem. We would like a fix @rgomezp but at the very least keep the issue open as it is real
The issue still exists. Is it possible to reopen it?
Thanks for your patience while we work to resolve this!
might not be so related but I fixed my issues on proguard (using dx and proguard)
-dontwarn com.onesignal.**
# OneSignal - These 2 methods are called with reflection.
-keep class com.google.android.gms.common.api.GoogleApiClient {
void connect();
void disconnect();
}
-dontwarn com.amazon.**
# OneSignal - Proguard ends up removing this class even if it is used in AndroidManifest.xml so force keeping it.
-keep public class com.onesignal.ADMMessageHandler {*;}
-keep public class com.onesignal.*
maybe something similar could be done for r8
Any update on this? I don't feel like i should use some hacky workaround with adding jars to my solution. That should be done by onesignal nuget package
On April 5 still happening, any solution?
@JArmandoCl You can safely use -dontwarn com.amazon.**
until an automatic solution is found for this Xamarin specific issue.
The -dontwarn com.amazon.**
is from OneSignal-Android-SDK in it's consumer-proguard-rules.pro file. This gets built into the release .aar which this Xamarin SDK uses. It should be getting picked up by Xamarin automatically but it seems the root the issue it is not.
Thanks for reply so quickly, actually i got com.google.android.gms.location.LocationListener warning too, im trying to build in release mode and bundle in android package format, do i have to do the same like amazon warnings?
@JArmandoCl You could add -dontwarn com.google.android.gms.location.**
as well. It isn't in the consumer-proguard-rules.pro file as it is included as an automatic dependency for the native SDK, but not for this Xamarin SDK.
Let me try, and i will back with results thanks
I made a custom proguard, but now im getting this warnings
1>PROGUARD : warning : com.onesignal.ADMMessageHandler: can't find referenced method 'android.content.Context getApplicationContext()' in program class com.onesignal.ADMMessageHandler 1>PROGUARD : warning : com.onesignal.OSUtils: can't find referenced class com.google.android.gms.gcm.GoogleCloudMessaging 1>PROGUARD : warning : com.onesignal.PushRegistratorGCM: can't find referenced class com.google.android.gms.gcm.GoogleCloudMessaging 1>PROGUARD : warning : com.onesignal.PushRegistratorGCM: can't find referenced class com.google.android.gms.gcm.GoogleCloudMessaging 1>PROGUARD : warning : com.onesignal.PushRegistratorGCM: can't find referenced class com.google.android.gms.gcm.GoogleCloudMessaging 1>PROGUARD : warning : com.onesignal.PushRegistratorGCM: can't find referenced class com.google.android.gms.gcm.GoogleCloudMessaging 1>PROGUARD : warning : there were 5 unresolved references to classes or interfaces. 1>PROGUARD : warning : there were 1 unresolved references to program class members.
@JArmandoCl I believe adding -dontwarn com.onesignal.**
should cover the reminding ones.
However so it matches what is in Android native SDK you should include all from this file https://github.com/OneSignal/OneSignal-Android-SDK/blob/master/OneSignalSDK/onesignal/consumer-proguard-rules.pro#L51
Finally, its working, i could compile an aab in release mode. These are the steps
1- Create a custom proguard.cfg and set build action to ProguardConfiguration 2- Copy the next code -dontwarn com.amazon. -dontwarn com.google.android.gms.location.LocationListener -dontwarn com.onesignal.
-dontwarn com.onesignal.**
-keep class com.google.android.gms.common.api.GoogleApiClient { void connect(); void disconnect(); }
-keep class com.onesignal.ActivityLifecycleListenerCompat* {;}
-keep class com.onesignal.OSSubscriptionState { void changed(com.onesignal.OSPermissionState); }
-keep class com.onesignal.OSPermissionChangedInternalObserver { void changed(com.onesignal.OSPermissionState); }
-keep class com.onesignal.OSSubscriptionChangedInternalObserver { void changed(com.onesignal.OSSubscriptionState); }
-keep class ** implements com.onesignal.OSPermissionObserver { void onOSPermissionChanged(com.onesignal.OSPermissionStateChanges); }
-keep class ** implements com.onesignal.OSSubscriptionObserver { void onOSSubscriptionChanged(com.onesignal.OSSubscriptionStateChanges); }
-keep class com.onesignal.shortcutbadger.impl.AdwHomeBadger {
-keep public class com.onesignal.ADMMessageHandler {*;}
-keep class com.onesignal.JobIntentService$ {;}
-keep class com.onesignal.OneSignalUnityProxy {*;}
3- In android options, set android package format to apk or bundle (if need to upload to google play) > set dex compiler to dx > set code shrinker to Proguard
Thanks!
Howdy, Thanks for the details @JArmandoCl !
Enjoy everybody
Description: I wanted to try xamarins new d8 and r8 instead of multidex and proguard. While build works for proguard. for r8 it fails because of onesignal nuget package. it returns error as below. i dont understand why it requires amazon classes which i dont even use.
please find more information in the link. there is also simply repro attached. just download and build https://github.com/xamarin/xamarin-android/issues/2670