I'm writing a game which uses obj files. I created an object in blender and I applied texture without UV coordinates and my question is: how to export this object to obj file, but with texture coordinates?
As you already noticed, there's no way around UV coordinates for games. Thankfully, blender comes with some very good UV unwrapping tools.
The simplest way to get UV coordinates from a 3D model in blender is to use Smart UV Project. You can do that by pressing U while in edit-mode and then select "Smart UV Project" from the menu.
This creates UV "patches" given some angular threshold. The result can look like this:
Done, you've got UV coordinates now. However, these coordinates are most likely not that useful, since you'll end up with a ton of seams. A good unwrapped mesh has less seams, preferably at places where they can easily be hidden (eg. where an uniform color meets) or where the seams will be obstructed by other geometry. That's why you usually mark the seams yourself (in edit-mode select the edges that should be a seam and press Ctrl + E and select "Mark Seam" in the menu). Then use the regular "Unwrap" (not "Smart UV Project") to unwrap the mesh,
Good UV unwrapping is hard and requires practice. This video-tutorial might help you getting started.