Relative paths not updated after export: QField still references old “mainProject” folder
What is the bug or the crash? What were your expectations and what actually happened?
Hi everyone,
when exporting a QGIS project with QFieldSync, all layers are saved using relative paths, but these paths are not updated to reflect the new folder structure after export.
In the exported package, the layers still reference the original project directory (e.g. ../mainProject/data/file.gpkg), even though the project has been moved into a new folder (e.g. exported/):
As a result, QField looks for the data inside the old root folder — which no longer exists — and the project only works if a fake “mainProject” folder is manually recreated.
Best regards, Giuseppe
Steps to reproduce the issue
Steps:
- Create a QGIS project inside a folder (e.g. mainProject/) and store all layers in a subfolder data/, with relative paths enabled.
- Export the project to a new folder (exported/) using QFieldSync.
- Copy and Open the exported project in QField.
- Error: notice that the paths still reference the old folder structure (e.g. ../mainProject/data/...) instead of the new exported folder.
Version
3.7.9
Operating system name
Android
Operating system version
15
Reinstall QField
- [x] I have a fresh install of the latest QField version, but the problem persists.
- [ ] Problem can be reliably reproduced, doesn't happen randomly.
- [ ] Problem happens with all files and projects, not only some files or projects.
Additional context
No response
Hi @Heryx , we have the same problem of wrong data paths after a cable export with QFieldSync in our company since we updated QGIS to 3.40.X in March 2025. @nirvn @suricactus @SeqLaz already had a look to it at the former platform for reporting bugs (https://github.com/opengisch/QField/discussions/6117) and suggested some workarounds:
- Use the VACUUM on your geopackages
- Point the export folder to the default folder
C:/Users/{user}/QField/export/{Project name}/ - Use a complete fresh QGIS profile
Unfortunately, we still observe the problem, but it is hard to reproduce this error as for some projects (~80%) it always occurs and for some projects (~20%) QFieldSync works properly. It would be great to see a bug fix here for using the cable export option properly, even with customized profiles and outside of the default folder.
@lorenzomorning , @Heryx , what we're still missing here is the ability to replicate this issue, it's been quite frustrating TBH. I've been in zoom calls where I saw the problem occurring "live", yet none of us devs. have been able to replicate it locally.
If either of you have a reliable way to replicate this issue, please provide steps to reproduce, we will be more than happy to hunt this bug once and for all :)
@nirvn I truly understand you! When I think I found a pattern of this error, I try to reproduce it and mostly it works then, for what ever reason... I keep track of the problem and will send an example, in case I will find a reliable to replicate the issue.
@lorenzomorning , I'm sure we can collectively get to the bottom of this together as a community.