简体   繁体   中英

Android app package name

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?

Only the package name in AndroidManifest.xml counts and must not change. The package you put your Java classes in can be anything.

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.

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"

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

I just want to add couple more observation: * the field package from AndroidManifest is also used for package of generated classes (eg 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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM