I am working on a plugin integrating OneSignal Push Notification service.
I notice that when i am adding proguard additions, the plugin is not getting initialized, during Application Packaging
The problem occurs when adding the commented out additions bellow:
-dontwarn com.onesignal.**
-keep class com.google.android.gms.common.api.GoogleApiClient {
void connect();
void disconnect();
}
-keep public interface android.app.OnActivityPausedListener {*;}
<!---keep class com.onesignal.shortcutbadger.impl.AdwHomeBadger { <init>(...); }
-keep class com.onesignal.shortcutbadger.impl.ApexHomeBadger { <init>(...); }
-keep class com.onesignal.shortcutbadger.impl.AsusHomeLauncher { <init>(...); }
-keep class com.onesignal.shortcutbadger.impl.DefaultBadger { <init>(...); }
-keep class com.onesignal.shortcutbadger.impl.HuaweiHomeBadger { <init>(...); }
-keep class com.onesignal.shortcutbadger.impl.NewHtcHomeBadger { <init>(...); }
-keep class com.onesignal.shortcutbadger.impl.NovaHomeBadger { <init>(...); }
-keep class com.onesignal.shortcutbadger.impl.SolidHomeBadger { <init>(...); }
-keep class com.onesignal.shortcutbadger.impl.SonyHomeBadger { <init>(...); }
-keep class com.onesignal.shortcutbadger.impl.XiaomiHomeBadger { <init>(...); }-->
The conflict occurs with the commented out additions especially with the { <init>(…); } argument.
For example if i erase the <init> the plugin is initialized.
Any ideas what might causing this behavior?
If we add these additions at a ProguardAdditions.txt file to our project’s Build/Android directory, as it was possible since 4.10 version, will it work without problems?
Proguard is such a trouble maker I’m not surprised you are running into issues. To determine the root of the issue you would have to share what the output from proguard is telling you. Copy that info and past it back in this thread. At a cursory glance it looks like “<init>” declarations might cause issues since angled brackets are reserved characters in XML. What you can do is wrap your proguard additions section in a CDATA declaration that has worked for me.
Are you using proguardAdditions section in UnrealPluginLanguage (formerly APL) for adding to proguard? If so, you need to be aware that <init> will be treated as XML. Use <init> instead.
where ${manifestApplicationId} is the package name.
Adding a ManifestRequirementsAdditions.txt file at Build/Android/, which include the above additions, seems to add them properly at the generated …\Intermediate\Android\APK\AndroidManifest.