Get applications package name - android

I am using Xamarin. I need to get the Google Maps API key and to do this I need my application's package name. How do I get this?
My app is called SimpleMapDemo and is one of the samples for using Google Maps.

Open your Manifest file and you shall find the package name of your application from the <manifest> tag.
Below is an example:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.recorder"
android:versionCode="1"
android:versionName="1.0" >
In the above example my applications package name is: com.example.recorder

Related

What should I put as package name in "Generate an OAuth 2.0 client ID" step?

I am following the "Get Started with Play Games Services for Android" at Get Started with Play Games Services for Android.
In step 3 "Generate an OAuth 2.0 client ID" I have to fill the "Package name" field.
My question is very simple: What should I type there as the package name? An arbitrary one like com.google.blahblah or does it have to be my Android app package name?
It has to be your Android package name, the one you specify in your Android manifest file.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.basiccontactables"
android:versionCode="1"
android:versionName="1.0" >
Here, whatever is in the package attribute should be specified in the Generate client ID step.

Android Studio using a library and project with the same package name

I have a library I use as a base for all my android apps and has the following manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android"
xmlns:tools="http://schemas.android.com/tools"
android:versionCode="36"
android:versionName="1.b" >
<uses-sdk
android:minSdkVersion="5"
android:targetSdkVersion="21"
tools:overrideLibrary="com.facebook.android"/>
I then try to use it in one of my projects which has the following manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android"
xmlns:tools="http://schemas.android.com/tools"
android:versionCode="36"
android:versionName="1.6" >
<uses-library
android:name="com.example.android"
android:required="true"/>
<uses-sdk
android:minSdkVersion="5"
android:targetSdkVersion="21"
tools:overrideLibrary="com.facebook.android"/>
Note that the package name used is the same: com.example.android. Since the app is published under com.example.android, I cannot change it for the app. As for the library, for historical reasons, it has the same pacakge name. When I build the project, I get the following error:
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':exampleCom:processDebugResources'.
Error: A library uses the same package as this project: com.example.android You can temporarily disable this error with
android.enforceUniquePackageName=false However, this is temporary and
will be enforced in 1.0
I do not want to change the package name of either library or app. I am not sure where to add the "android.enforceUniquePackageName=false" . Any ideas? Also, how to solve beyond 1.0 (which I am already using)?
You can add enforceUniquePackageName=false in the app modules build.gradle file under android:
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
enforceUniquePackageName = false
...
}
Unfortunately this results in another problem with an unfixed bug from the build tools.
Error:Execution failed for task
':app:packageAllDebugClassesForMultiDex'.
java.util.zip.ZipException: duplicate entry: ... BuildConfig.class
See https://stackoverflow.com/a/27310034/668400
An ounce of prevention is worth a pound of cure. It may not help this particular situation, but for future developers to avoid getting into this situation, please note the JLS recommendation in Chapter 6. Names which addresses this very problem:
Package Names
Developers should take steps to avoid the possibility of two published
packages having the same name by choosing unique package names for
packages that are widely distributed. This allows packages to be
easily and automatically installed and catalogued. This section
specifies a suggested convention for generating such unique package
names. Implementations of the Java SE platform are encouraged to
provide automatic support for converting a set of packages from local
and casual package names to the unique name format described here.
If unique package names are not used, then package name conflicts may
arise far from the point of creation of either of the conflicting
packages. This may create a situation that is difficult or impossible
for the user or programmer to resolve. The class ClassLoader can be
used to isolate packages with the same name from each other in those
cases where the packages will have constrained interactions, but not
in a way that is transparent to a naïve program.
You form a unique package name by first having (or belonging to an
organization that has) an Internet domain name, such as oracle.com.
You then reverse this name, component by component, to obtain, in this
example, com.oracle, and use this as a prefix for your package names,
using a convention developed within your organization to further
administer package names. Such a convention might specify that certain
package name components be division, department, project, machine, or
login names.
Package name is a unique identifier for a package and therefore you should not have the same package name for both the library and the application. Change the package name for the library if the application is already published.
worked on as 2.2, gradle 2.14.1
android {
enforceUniquePackageName = false
//it was deprecated, but still work
android.packageBuildConfig = false
...
}
details:new-build-system

Android/data/package------my package name is missing

Android 4.4;
when my apk is installed.
there is no my package in Android/data/com.example.helloworld on mysdcard even the inner mem card
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.helloworld"
android:installLocation="preferExternal"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
there is some other package there,"com.android.browser" .etc
i try to delete the browser's folder,when i run the browser or restart the mobile the package appear again
but there is no package_name of mine,no where to find,but the app runs normal
on 4.4 we cant mkdirs there,only under the package name(but where is the name #.#)
so first:i dont wanna create this folder by my finger
second:no root,not all users know root
i want my package name back when install the apk.
thank you very much.
myb you should clear/delete some memory or something..its just my opinion btw im still new in stackoverflow and android development too.
Good Luck!

Overwrite Android Application

I'd like to overwrite my old android application. What are the things i have to be do for that ?
Do Changes in AndroidManifest.xml is enough ?
I like to use another package structure and a new project to do so.
Regards.
Following are required:
Same key
Same Package Name
Higher versionCode in the manifest
The package name indicated in the manifest should be the same:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.company.demo.app"
android:versionCode="1"
android:versionName="1.0" >
If you're talking about the registration in Google Play, I think that only the package="..." attribute of the <manifest> node must be the same (and the version must be superior to the one of your first application of course).
It must also be signed with the same key.
That way, the Google Play site will recognize your old application as a new version, and it will replace the old one.

Application Installation in Android

I needed to know that when my a application installs in a device in android, which component of application framework decides its installation site and how i can manages its installation site (mobile memory or SD card)?
you can provide option for your installation on your SD card.You will need this in your manifest
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:installLocation=["auto" | "internalOnly" | "preferExternal"
You can choose among these.
But by default your app will always be saved on device.The user can always transfer it to SD card .
check the android documentation here[1]. To install to SD Card put
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:installLocation="preferExternal">
in your manifest.
For backwards compatibility use "auto" instead of "preferExternal".
[1] http://developer.android.com/guide/appendix/install-location.html
In your Manifest file, it is set as default so when the user downloads the application, it is downloading into their mobile memory. If you want the user to have to option of moving the application to their SD card, you can add:
android:installLocation="auto"
It should be placed into the manifest section. For example:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.application"
android:installLocation="auto"
android:versionCode="1"
android:versionName="1.0" >

Categories

Resources