Um yeah but make sure your setting are on right too. If you have an iPhone you go to your phones settings>privacy>Health>Pokémon go> and turn on all of them things.
First of all download gps joystick from link below https://play.google.com/store/apps/details?id=com.theappninjas.gpsjoystick
Now root your device using magisk.you can find many tutorial on internet for this.
After rooting now lets move gps app to system for which download App systemizer(terminal) from modules inside magisk (also download terminal emulator from play store)
Now after installing magisk module App systemizer open terminal emulator app and type su
Than type app systemize than follow the instructions given (remember to move app in priv-app)
After moving it to system now open gps joystick and tap on hamburger menu on left side and go to settings and enable the disable location service and reboot your device.
After rebooting the device open gps app and your are good to go
Happy spoofing.