Hello,
I have recently tried to custom my proguard.append.cfg
file to reduce the size of the IPA generated by my MOE project. Everything works normally and the size of my IPA has drastically decreased. However, I have now a very specific problem which occurs when a notification is received and when the user tap on it to launch the app.
I have implemented the method “applicationDidReceiveRemoteNotificationFetchCompletionHandler” in my Main class like below:
public void applicationDidReceiveRemoteNotificationFetchCompletionHandler(
UIApplication application,
NSDictionary<?, ?> userInfo,
@ObjCBlock(name = "call_applicationDidReceiveRemoteNotificationFetchCompletionHandler")
Block_applicationDidReceiveRemoteNotificationFetchCompletionHandler completionHandler) {
if(application.applicationState() == UIApplicationState.Active) {
//app is currently active, can update badges count here
readUserInfoAndLaunchMainViewController(userInfo);
} else if(application.applicationState() == UIApplicationState.Background){
//app is in background, if content-available key of your notification is set to 1,
// poll to your backend to retrieve data and update your interface here
} else if(application.applicationState() == UIApplicationState.Inactive){
readUserInfoAndLaunchMainViewController(userInfo);
}
}
When the proguard level is set to “app”, this piece of code works as expected but when I set it to “all”, I cannot start my app by clicking on a notification anymore. The app crashes and I get the following stack trace in the logs:
art I 2330 1344421 /Users/rolandvigh/public-repo/aosp/art/runtime/dex_file.cc:2036] Exception in AnnotationFactory.createAnnotation
art F 2330 1344421 /Users/rolandvigh/public-repo/aosp/art/runtime/java_vm_ext.cc:456] JNI DETECTED ERROR IN APPLICATION: java_array == null
art F 2330 1344421 /Users/rolandvigh/public-repo/aosp/art/runtime/java_vm_ext.cc:456] in call to GetArrayLength
art F 2330 1344421 /Users/rolandvigh/public-repo/aosp/art/runtime/java_vm_ext.cc:456] from long apple.uikit.UIApplication.applicationState()
art F 2330 1344421 /Users/rolandvigh/public-repo/aosp/art/runtime/java_vm_ext.cc:456] "main" prio=5 tid=1 Runnable
art F 2330 1344421 /Users/rolandvigh/public-repo/aosp/art/runtime/java_vm_ext.cc:456] | group="main" sCount=0 dsCount=0 obj=0x10a8e40a0 self=0x11c01ac00
art F 2330 1344421 /Users/rolandvigh/public-repo/aosp/art/runtime/java_vm_ext.cc:456] | sysTid=1344421 nice=-1 cgrp=default sched=1/31 handle=0x1b734ab80
art F 2330 1344421 /Users/rolandvigh/public-repo/aosp/art/runtime/java_vm_ext.cc:456] | state=? schedstat=( 0 0 0 ) utm=0 stm=0 core=0 HZ=100
art F 2330 1344421 /Users/rolandvigh/public-repo/aosp/art/runtime/java_vm_ext.cc:456] | stack=0x16fa08000-0x16fa10000 stackSize=1008KB
art F 2330 1344421 /Users/rolandvigh/public-repo/aosp/art/runtime/java_vm_ext.cc:456] | held mutexes= "mutator lock"(shared held)
art F 2330 1344421 /Users/rolandvigh/public-repo/aosp/art/runtime/java_vm_ext.cc:456] at apple.uikit.UIApplication.applicationState(Native method)
art F 2330 1344421 /Users/rolandvigh/public-repo/aosp/art/runtime/java_vm_ext.cc:456] at com.digitalplumecompany.boostyourteam.Main.applicationDidReceiveRemoteNotificationFetchCompletionHandler(Main.java:175)
art F 2330 1344421 /Users/rolandvigh/public-repo/aosp/art/runtime/java_vm_ext.cc:456] at apple.uikit.c.UIKit.UIApplicationMain(Native method)
art F 2330 1344421 /Users/rolandvigh/public-repo/aosp/art/runtime/java_vm_ext.cc:456] at com.digitalplumecompany.boostyourteam.Main.main(Main.java:47)
art F 2330 1344421 /Users/rolandvigh/public-repo/aosp/art/runtime/java_vm_ext.cc:456]
Here is the full stack trace: stacktrace.txt (16.6 KB)
It seems that the method “apple.uikit.UIApplication.applicationState()” cannot be called. Am I missing a rule in my proguard.append.csv
file ? (proguard.append.txt (1.3 KB))
Best regards,
Nicolas