Google is not defined in android studio

I’m using android studio to run my app of ionic and capacitor integration. I’m using google maps javascript api to generate a map.
And everytime i use livereload it works but when i use only ionic capacitor run android to deploy app, the error of google is not defined appears in android studio. I need help pls.

You need to install the appropriate types for Google Maps, just run the following command:

npm install @types/googlemaps --save-dev

I have it, and it works fine on browser and in liveroad of android studio.
Ionic capacitor run android -l --external

But when i try to build the app without livereload it doesn’t
Ionic capacitor run android

The error is this:

I want the app to work everywhere that’s why i need to build the apk without livereload.

try this: declare var google; before the @component decorator. This worked for me as well.

I have it. Don’t know if i’m being specific enough. I can test the app fine with ionic serve and others and there is no error. Google is recognised.
But when i deploy too android studio that error appears. Kinda lost.