I'm writing FIT files during export of workouts in my Android app "myWorkouts".
I'm using Java (obviously) and the FIT SDK. (Without this, it's really pain in the a... to create a valid FIT file.)
The problem is: they are not uploadable to GarminConnect.
Strava accepts them, but Garmin not.
It's very frustrating for me and my users because I don't get support from Garmin.
Without any further information, the upload just says: "An error occurred with your upload. Please try again."
For non GPS workouts I export rolling intervals (like 1sec, 2sec, depending on workout duration).
For GPS workouts, I export one item for each GPS reading.
I hope this helps.