After going through the firebase documentation.I found out firebase only need application ID ,not package name for integration so app can have different package name and different application in buid.gradle.Generally its preferable to use same apllication id as of package name.But if we have similar situation we can handle it.Find implementation as below:-
In project level Build.gradle
defaultConfig {
applicationId "org.XXX.mobile"
}
Add google plugin in same file
apply plugin: 'com.google.gms.google-services'
Now Add google-services.json in your project root folder ,which you got from firebase console.Sync your gradle now.Now you can see the Firebase service is service started successfully in your log.