Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: F-Droid: GMS libs in the final apk #4994

Closed
linsui opened this issue Jun 13, 2022 · 38 comments
Closed

[Bug]: F-Droid: GMS libs in the final apk #4994

linsui opened this issue Jun 13, 2022 · 38 comments

Comments

@linsui
Copy link

linsui commented Jun 13, 2022

Summary

F-Droid deploys a new binary scanner which finds GMS in the apk. See https://gitlab.com/linsui/fdroiddata/-/jobs/2577487197 I don't know where it comes from.

Steps to reproduce

You can use dexdump and grep to check the apk.

Expected behaviour

There is no nonfree libs.

Actual behaviour

GMS sleaks in.

Device name

No response

Android version

_

Commons app version

Since 2.6.5

Device logs

No response

Screen-shots

No response

Would you like to work on the issue?

No response

@linsui linsui added the bug label Jun 13, 2022
@nicolas-raoul
Copy link
Member

Thanks for letting us know about this!

@licaon-kter
Copy link

licaon-kter commented Jun 14, 2022

It's via mapbox, there are references in com/mapbox/android/core/location/

Any chance to update to https://github.com/maplibre/maplibre-gl-native instead of the old lib?

Ref: maplibre/maplibre-native#313

/LE: I tried to replace it locally (kept telemetry plugin since there's no -libre equivalent), and exclude gms, but it fails to build: Unresolved reference: Timber in some kotlin files

@nicolas-raoul
Copy link
Member

The Timber error sounds like something that could be solved with some Gradle wizardry maybe?

@bhavanagarlapati
Copy link

@nicolas-raoul Hi, can I take this up?

@nicolas-raoul
Copy link
Member

@bhavanagarlapati Yes, please let us know about your progress every two or three days, thanks! :-)

@bhavanagarlapati
Copy link

Hi @nicolas-raoul I started working on the issue. I will keep you posted

@kartikaykaushik14
Copy link
Contributor

Hi @nicolas-raoul , is the issue fixed or I can take this up?

@nicolas-raoul
Copy link
Member

@kartikaykaushik14 You are very welcome to take it up, thank you! Please let us know about your progress every two or three days.

@bhavanagarlapati I assume you have moved on, but if you have found anything please feel free to post your findings or ideas, thanks! :-)

@kartikaykaushik14
Copy link
Contributor

kartikaykaushik14 commented Feb 9, 2023

Update: I first tried following @licaon-kter 's suggestion and resolved all build-related issues but even maplibre-gl uses GMS libraries internally. Trying to look for other alternatives.

@licaon-kter
Copy link

Try to look at Delta Chat or Element recipes, where it's cleaned up and rebuilt before the app is built.

It sounds straight forward to me but you might need to try it first to confirm.

@nicolas-raoul
Copy link
Member

(Just in case MapBox and maplibre are not usable, I want to mention that other options seem to be available: https://wiki.openstreetmap.org/wiki/Software_libraries#Native_widgets)

@linsui
Copy link
Author

linsui commented Feb 13, 2023

Maplibre will remove the dep of GMS soon. See maplibre/maplibre-native#801

@kartikaykaushik14
Copy link
Contributor

I have a probable solution and just wanted to confirm if it's feasible.

As @licaon-kter rightly pointed out, there are references in com/mapbox/android/core/location/. This is currently being used in only one class fr.free.nrw.commons.LocationPicker.LocationPickerActiviy.java. However, we can avoid using the libraries altogether by getting the last known location from locationComponent instead of using the location engine to get the last location of the user. In addition to it we can exclude gms from mapbox-android-sdk as suggested in this comment in the MapLibre repo

Please refer to 116ff70

@licaon-kter
Copy link

@kartikaykaushik14 unfortunately the exclusion is not enough anymore, see Linsui's link above for the path forward.

@kartikaykaushik14
Copy link
Contributor

kartikaykaushik14 commented Feb 14, 2023

I was going through Delta Chat as a reference and they seemed to have removed telemetry as in this line after they made changes to move to maplibre.

Do we retain telemetry or remove it?

I'm facing a build issue with com.mapbox.mapboxsdk.maps.TelemetryDefinition as it seems to be derived from the mapbox-android-sdk dependency which we are trying to eliminate. The telemetry dependency that we had earlier - "mapbox-android-telemetry:7.0.0" does not contain the TelemetryDefinition class and can in fact be removed since maplibre already provides the required support.

@licaon-kter
Copy link

@kartikaykaushik14 when I said "deltachat recipe" I meant https://gitlab.com/fdroid/fdroiddata/-/blob/master/metadata/com.b44t.messenger.yml#L1855-L1880

@kartikaykaushik14
Copy link
Contributor

@licaon-kter so if my understanding is correct, we do not have to implement the pre-build steps in the deltachat recipe once MapLibre removes the dependency of GMS right? I see that the changes were merged just yesterday and they have removed gms dependencies in the files that were previously being done through the pre-build steps. So can we probably wait for the official release in such a case?

@kartikaykaushik14
Copy link
Contributor

Also, please advise regarding Telemetry if I should retain it or remove it like in the case of deltachat?

@licaon-kter
Copy link

@kartikaykaushik14 yup, I guess you'd need a new maven release

@nicolas-raoul
Copy link
Member

@kartikaykaushik14 We need to remove telemetry, due to our app's privacy policy. Thanks a lot!

@kartikaykaushik14
Copy link
Contributor

kartikaykaushik14 commented Feb 23, 2023

MapLibre has released a new version 10.0.0 that contains the fixes to remove gms dependencies. But as a result, there is a heavy backward compatibility break. For example, It requires a Kotlin version 1.7.20 (we currently use 1.5.10). And the minSdkVersion is 21 (currently 19, compile and target Android SDK Versions have to be modified to 31). The changes are not straightforward. Is there an open issue where we are handling any such upgrades?

@kartikaykaushik14
Copy link
Contributor

Also, can we have a separate issue to track removing telemetry and I can be assigned to it? We have to remove telemetry first, make the required upgrades, and then we can proceed to move to MapLibre.

@nicolas-raoul
Copy link
Member

@kartikaykaushik14 Good idea, feel free to create such issues as you see fit. Thank you!

@nicolas-raoul
Copy link
Member

@kartikaykaushik14 Would you mind creating an issue about switching to MapLibre? You can be assigned to it if you want (the general rule is one assigned issue at a time, but since you are very knowledgeable on the topic and involved already, an exception would be justified).

@kartikaykaushik14
Copy link
Contributor

@nicolas-raoul Could we close this issue too as we closed #5154, #5158, #5175 and #5182?

@nicolas-raoul
Copy link
Member

Yes, sure.

Thanks a lot @kartikaykaushik14 for brilliantly solving this very complex issue!

@licaon-kter
Copy link

Ping us when ready to release.

@nicolas-raoul
Copy link
Member

@sivaraam How about pushing a beta release as soon as you can? 🙂

@licaon-kter
Copy link

Which commit you want as beta?

@nicolas-raoul
Copy link
Member

@licaon-kter Commit cf35307 (latest commit on master) would be great for beta, it is very reliable already.

@licaon-kter
Copy link

@nicolas-raoul
Copy link
Member

@licaon-kter Thanks a lot! Will it appear at https://f-droid.org/en/packages/fr.free.nrw.commons/? I do not see any beta-related setting in the F-Droid app, is there a way for F-Droid users get it? :-)

@licaon-kter
Copy link

F-Droid Client, your app, either manually expand Versions and install or go to upper right menu and enable "Betas".

This will be built in the next cycle.

@sivaraam
Copy link
Member

sivaraam commented Apr 9, 2023

@sivaraam How about pushing a beta release as soon as you can? slightly_smiling_face

Sure. We certainly need to do that. Will initiate the process soon 🙂

@mnalis
Copy link
Contributor

mnalis commented Jun 3, 2023

Is this still blocking f-droid release?
I'd love to see latest bugfixed version 4.1.0 published on f-droid

@sivaraam
Copy link
Member

Is this still blocking f-droid release? I'd love to see latest bugfixed version 4.1.0 published on f-droid

Thanks for nudging about this in the corresponding F-droid issue @mnalis ! I too hope to see 4.1.0 on F-droid soon 🙂

@licaon-kter I believe F-droid has an option to automatically recognize when new version of the app are released. Kindly let me know if anything is to be done for it in our end. That would help automate this stuff.

@licaon-kter
Copy link

@sivaraam if it works once tested we can re-enable the disabled autoupdate

@licaon-kter
Copy link

Done 🎉 https://gitlab.com/fdroid/fdroiddata/-/commit/32e5bd97aa49be4b8d1228e1ae7413cc81d5ffff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants