QR code based enrollment uses a built-in download manager which seems to have bugs and doesn't report errors.
Unfortunately you cannot get diagnostics at startup provisioning, so you need to run a test and view issues in the Android log (logcat).
1. Install Android SDK on your computer.
2. Run adb. If it doesn't start, you may need to add the adb directory to PATH variable. The adb is located in the platform-tools subdirectory of Android SDK.
3. Enable USB debugging on your phone. See the section "Enable adb debugging on your device" of the Android adb manual: https://developer.android.com/studio/command-line/adb
4. Connect your phone to the computer by usb.
5. Download and install this utility.
6. Run the command on your computer from the command line
adb logcat >logcat.log
7. Run the utility, and enter the URL exactly as it appears in the QR code (parameter android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION).
8. Make sure you don't get the "Download successful" message.
9. Stop the adb logcat command. The file logcat.log must contain error messages, like that:
05-23 10:15:37.973 2964 4706 D DownloadManager: [18] Starting
05-23 10:15:38.028 2964 4706 W DownloadManager: [18] Stop requested with status HTTP_DATA_ERROR: Invalid host: https://hmdm.your-website.com/hmdm/files//hmdm-3.24-master.apk
05-23 10:15:38.029 2964 4706 D DownloadManager: [18] Finished with status WAITING_TO_RETRY
05-23 10:15:38.057 2964 2964 D DownloadManager: onStopJob id=18, reason=0
Now you get the diagnostics and can resolve the download error.