applicationId is the main domain of your application. The applicationId is not related to the package name, although some application developers name the applicationId and the package name the same.
Each application to be published must have a unique domain name, generally using 3 word arrangements (can be more than 3), for example: com.app.yourappname, com is identified as the domain, app as the name of the developer and yourappname as the name of the application.
Open Gradle Scripts > build.gradle (Module: app)
Change the application ID with your own id name
Click Sync Now.
Change the id as unique as possible, because application id is very important used if you want to publish the application to the google play
Important : your applicationId must be the same as the Android package name you created in the firebase console when you created google-services.json
Package name is the folder path to store class files. The package name is not required to be changed, so it uses the default source code. But we recommend changing it according to the applicationId structure, if you want to change it:
Click the settings icon in Android Studio
Select Tree Appearance, remove the checklist in the Compact Middle Packages section
Select one of the sub packages then right click > Refactor > Rename...
When finished, return the checklist to Compact Middle Packages so that the package name structure looks neater again
Important: the structure of the package name must be the same as the namespace in the build.gradle file, otherwise the project will be error
After the renaming of the package name is complete, you need to rebuild the project and invalidate the cache
Select Build > Rebuild Project and wait until the building project finishe
Select File > Invalidate Caches.. > Invalidate and Restart