-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
minifyEnabled stops working at API 0.9.53 onwards: Location has no zero argument constructor #55
Comments
Issue does not appear on Android 7, 0.9.62 works fine with Android 7 But does not work with Android 8 onwards. Test setup is not equal, just random observations to provide clues. |
Test results look like it broke with API 53 62 - no update container values But I can't reproduce it with my physical android 7 device, it works fine even with 62. I hope you have enough clues or maybe it is easier for you to run https://github.com/Falcosc/locus-addon-tasker/tree/master in your IDE together with your locus project. |
Hello Falco, Now, most of the variables inside are 'nullable'. Previously, for example, "getAltitude" always returned any value even if altitude was not defined. Now it looks like this. Because your code is in Java and not Kotlin, you probably do not see a compile warning here. May this be a problem you face here? |
Having null there is fine. Because here https://github.com/Falcosc/locus-addon-tasker/blob/9a2b3c8607d7d07bb8a9bb6fd4c0fb14c26e2692/app/src/main/java/falcosc/locus/addon/tasker/intent/handler/UpdateContainerRequest.java#L45 I just put the null result into String.valueOf which return "null" in this case. And I actually got the warnings and changed the one place where null would cause issues. It only complained about places where the nullable altitude was put into null not supported annotated methods. But String.valueOf is supporting null. The strange thing is: I can't reproduce it on my Android device. Currently, I have created a demo without any custom code to remove even more possible causes
Now I wait for the response of the incompatible device users. Based on this example, we either get the cause of the issue as an error message or we get an easy to execute demo for you :) |
Maybe we have trouble with the logging: since I can't reproduce it - I need to rely on the response of the incompatible device user. We can only see uncaught exceptions, but since everything is caught we don't see any errors. We did at least found an uncaught exception in locus.api.objects.styles.GeoDataStyle.readObject while switching from API 51 to 52 since it was uncaught, I will create a new ticket if it can be reproduced on 62 after we get the basics working. For that reason, we only test the gps location fields for now. On prod we still use 0.9.39 Edit: we found a way, sideloading signed release APKs does work but now the error starts to disappear. |
Only my non debugging release builds are affected, on my release builds I can reproduce the issue on all my devices, but now I have no logging support. What kind of evil trick did you implement in your API to break only release builds? 😆 |
@menion I found the issue. Starting with API 53, release builds are not able to get the update container. Because my update container cache does init with I did register a custom logging to log to TextView and got the error.
But I have trouble getting the source file lines corrected in the release build. https://github.com/Falcosc/locus-addon-tasker/blob/APItest/app/proguard-rules.pro If you tell me how to get your line numbers in the build, then I can repeat the test. |
Thanks for the sample branch! If you disable proguard/R8 with
all seems to work correctly. So, it seems that the change in the Solution? Exclude Locus API objects with
placed into "app/proguard-rules.pro" file. Hope this helps. |
Thank you |
I'll do this today, thanks for the offer. Confirmation that this really solved this problem is welcome, thanks! |
I still have trouble with keep, source file line numbers are still looking minified. But haven't deployed it yet. I have the same goal like https://issuetracker.google.com/issues/122752644#comment7 The answer was
But I don't like to retrace all the time I see a stack trace. |
Perfect, thank you. Meanwhile, I did give up and use progard option '-dontoptimize' Falcosc/locus-addon-tasker@986792c In the end, if your project uses lint to remove unused code, the optimization isn't worth the hassle but shrinkRessources is a meaningful addition: Maybe you want to mention that dontoptimize is recommended to avoid the hassle with stacktraces while keeping shrinkRessources working. We can close this with your readme update, thanks for your help. |
Thanks, nice test. Interesting is, that I do not have this "keep rule" in the main Locus Map app. On the second side, the Locus Map system is quite complex and it is possible, that the app keeps constructors of API objects for a different reason. |
Do you run optimize on the whole Locus Maps project? I assume Locus Maps does not convert binary into UpdateContainer objects. But yes, if you use more of them, less stuff gets removed. |
Update Container is requested like this:
https://github.com/Falcosc/locus-addon-tasker/blob/9a2b3c8607d7d07bb8a9bb6fd4c0fb14c26e2692/app/src/main/java/falcosc/locus/addon/tasker/utils/LocusCache.java#L188
And I get the values via the provided field getters
https://github.com/Falcosc/locus-addon-tasker/blob/9a2b3c8607d7d07bb8a9bb6fd4c0fb14c26e2692/app/src/main/java/falcosc/locus/addon/tasker/uc/UpdateContainerFieldFactory.java#L75
And here is how the user request gets a new update container and how it executes the getter function via apply to get the value https://github.com/Falcosc/locus-addon-tasker/blob/9a2b3c8607d7d07bb8a9bb6fd4c0fb14c26e2692/app/src/main/java/falcosc/locus/addon/tasker/intent/handler/UpdateContainerRequest.java#L45
I didn't debug step through the code but on the weekend I plan to go throug the API version to find the point at which it does break.
Values look like this
isEnabledMyLocation = false
isTrackRecRecording = false
getLocMyLocation().getLongitude() = 0.0
getLocMyLocation().getLongitude() was uninitialized
getLocMyLocation().getSpeed() 0.0
The project builds in the latest android studio. This is the change which breaks it: Falcosc/locus-addon-tasker@02ce313
I did comment out all API version specific implementations in this branch to highlite that only the API version change is causing the problem.
Do you already have a clue which refactoring could cause trouble with the update container?
The text was updated successfully, but these errors were encountered: