Reputation: 337
When creating an Android application using Java, you place your classes into packages such as com.example.appName
However, in the Android XML manifest file, you also specify the package there.
It is my understanding that the Google Play Store, where Android apps are uploaded, uses the package name as a unique identifier for your app.
So, which package name actually identifies your app/APK file? And can the package names in your code be different to the package name in the manifest?
Upvotes: 3
Views: 6942
Reputation: 3726
The answers here seem a little out from my experience.
In Android Studio the applicationId in your Build.Gradle is the important attribute and should not change.
Our Manifest package name was different from our applicationId, I changed them to be the same and was able to upload the APK to Google Play without error.
Upvotes: 0
Reputation: 1
I just want to add couple more observation: * the field package from AndroidManifest is also used for package of generated classes (e.g. R class) * and something important if you are using google map v2 in your project pay attention of the package used in authorization because need to be the same. if you don't do that it will just not fetch the map but with no error message in logcat. (just hit this issue today and yesterday)
googlemap v2 version 8.1.1 google play services 4.4.52
Upvotes: 0
Reputation: 9117
The Play store picks up the package as the identifier from the manifest file.
It really doesn't matter if your source files go into the same package or something else.
So, you can manage/arrange your source files into any arbitrary packages you want.
Generally, it's easier to have your source files in the same package/sub-package as your manifest file, so that referencing them from the manifest file is easier, as you will not have to specify the fully qualified class names for your activities/services etc.
Upvotes: 2
Reputation: 6201
Android XML manifest file package is understanding by the Google Play Store because Google Play Store only read this file , when you upload android application in google play store.
so, if you src package and manifest is different then it do not make any problem.
Thanks
Upvotes: 1
Reputation: 63955
Only the package name in AndroidManifest.xml
counts and must not change. The package you put your Java classes in can be anything.
Upvotes: 7
Reputation: 20041
which package name actually identifies your app/APK file?
play store will take only Android manifest package. like package="com.example.appName"
can the package names in your code be different to the package name in the manifest?
yes, you can use different package for your code but need to give the absolute package name when declaring in manifest.xml
android:name="org.demo.MyFile"
Upvotes: 1