qfieldsync icon indicating copy to clipboard operation
qfieldsync copied to clipboard

QField Sync generates invalid relative paths (../) for local GPKG layers when packaging via USB

Open julienrobvq opened this issue 4 months ago • 7 comments
trafficstars

What is the bug or the crash? What were your expectations and what actually happened?

I’m using QField Sync to package a QGIS project via USB. My project contains both PostGIS layers (configured as Offline editing) and a local GPKG layer (configured as Copy).

On my Android device, I’m unable to load the local GPKG layers. I get the following error message:

Cannot open /storage/emulated/0/Android/data/ch.opengis.qfield/files/Imported Projects/RPNS_2025.gpkg.()

After investigation, I found that the paths in the .qgs file were using ../ to refer to the parent directory, like so: ../RPNS_2025.gpkg|layername=Hydro_Lineaire

I was able to fix the issue by manually editing the XML and removing the ../, like this:

RPNS_2025.gpkg|layername=Hydro_Lineaire

After that, the layers loaded correctly in QField.

However, I would prefer not to manually fix the XML every time I package the project. Is there a recommended way to configure my QGIS project and QField Sync settings to avoid this situation altogether?

Thanks in advance !

Steps to reproduce the issue

  1. In QGIS, create a new project

  2. Add:

  • One or more PostGIS layers.

  • One or more local GPKG layers

  1. In QField Sync configuration :
  • Set PostGIS layers to Offline editing.

  • Leave the GPKG layers set to Copy.

  1. In Project Properties > General, ensure "Save paths" is set to "Relative".

  2. Use QField Sync's cable packaging to export the project to an empty folder.

  3. Transfer the packaged project to your Android device

  4. Open the project in QField.

Version

3.0.1

Operating system name

Windows

Operating system version

Windows 11

Reinstall QFieldSync

  • [x] I have a fresh install of the latest QFieldSync version on a new QGIS profile, 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

julienrobvq avatar Jun 26 '25 15:06 julienrobvq