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.
Related
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
I have signed and zipalign my android application and now wishes to upload it on the play store.
I however get the following message when I am done uploading it:
Upload failed
Your APK's package name must be in the following format "com.example.myapp". It may contain letters (a-z), numbers, and underscores (_). It must start with a lowercase character. It must be 150 characters or fewer.
My apk name is
dd.afm.aftermath.apk
So I don't understand why it does not comply?
Thanks in advance
Change your AdnroidManifest.xml file's package value from "AndroClient.AndroClient" to "com.example.myapp" (or whatever).
Then Xamarin will use it when compiling.
The error message complains about the 'package name', not about the APK file name.
Your package name is set to 'AndroClient.AndroClient', which does not match the prescribed pattern of com.example.app. Change your package name to something like com.dualdub.androclient.
background
The package name and version code is what identifies an app. Increase the version code, while keeping the same package name, and people will get automatically updated to the new version. Change the package name and the Google Play Store considers it a different app.
As you probably know, there are now millions of published apps. To prevent package name clashes the prescribed way is to prefix your app's name with your website domain in reverse. In your profile it says that http://dualdub.com is your website. So you should prefix your app's name with "com.dualdub.". Package names are case-sensitive; it is common practice to use all lower case.
Google Play Store reads your package name from the AndroidManifest.xml, from the 'manifest' element; 'package' attribute. How to change that depends on your IDE.
Change package name with Android Studio
When you are using Android Studio you are also using the Gradle build system. The Gradle build system overrides the package name in the manifest for you. During the build it puts the applicationId in the manifest package attribute.
Open the build.gradle file in your app module. It should be located at: <projectDir>/app/build.gradle. It should look something like this:
app/build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.0"
defaultConfig {
applicationId "com.example.appname"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
Update the applicationId to be com.dualdub.androclient.
Change package name with Eclipse
To be honest, I have never used Eclipse so I will have to give you vague directions.
In the AndroidManifest.xml you have the manifest package attribute. It plays a dual role: 1) it specifies the package name (also known as the applicationId), 2) it helps shorten class names that you specify with other elements, e.g. when specifying activities you can write android:name=".MainActivity" instead of android:name="com.example.appname.MainActivity".
To change the package name you will actually have to change the namespace of your code. In your .java files change the first line from 'package AndroClient.AanroClient;' to package com.dualdub.androclient;.
Most likely, Eclipse will have a refactoring tool to rename java packages to make this easier for you.
As the error says:
It must start with a lowercase character
While your package name is: AndroClient.AndroClient, which starts with an upper case letter.
Citing from the documentation:
Package Name is the package namespace for your app (following the same rules as packages in the Java programming language). Your package name must be unique across all packages installed on the Android system. For this reason, it's generally best if you use a name that begins with the reverse domain name of your organization or publisher entity. For this project, you can use something like "com.example.myfirstapp." However, you cannot publish your app on Google Play using the "com.example" namespace.
I'd suggest to just conform to the "reverse domain" rule of thumb
its the problem of your package..
Change your package name as remove example from it..
eg:
com.developer.name
The first line of your java source probably has the package name.
package com.gosylvester.hilbilyfashliegt;
The package name is also in the manifest.
The app name or what you call the app is setup in the manifest for android:label
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.gosylvester.hilbilyfashliegt"
android:versionCode="7"
android:versionName="Juger" >
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name="com.gosylvester.hilbilyfashliegt.MainActivity"
android:label="#string/app_name"
android:theme="#style/Theme.AppCompat.Light.DarkActionBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Generally you would store the app name in the res/values/strings.xml below app_name is the app name.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Hil Bily FashLiegt</string>
<string name="action_settings">Make stays</string>
<string name="author" translatable="false">by cousin Dan</string>
<string name="new_this_version">""New this one. Stil Kant make wir catch stay on good. Toch screen to mak er on. Use make stays for duk tap wird"</string>
<string name="aboutcheckbox">Reckon not show this here agin</string>
<string name="shareText">I reckon this here hillbile fashliegt app is worth a jar of moonshine. https://play.google.com/store/apps/details?id=com.gosylvester.hilbilyfashliegt</string>
<string name="sharesubject">Android add free flashLight App by Dan Sylvester</string>
<string name="about_firstrun">com.gosylvester.hilbilyfashliegt.firstrunabout</string>
<string name="preferences">com.gosylvester.hilbilyfashliegt.prefrences</string>
</resources>
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
I am using Eclipse 4.2 with Android SDK.
I am wondering if it is possible to change the default package ID com.example that shows in the "New Android Application" wizard as you type the application name?
I would like it to default to my own package ID so that I don't need to correct the Package Name field each time.
Is this possible to do? Please explain how.
No, you cannot change the default; it's hardcoded in the plugin sources.
(For the curious, it's in com.android.ide.eclipse.adt.internal.wizards.templates.NewProjectPage#SAMPLE_PACKAGE_PREFIX in the ADT code base). We should consider persisting the most recently set package prefix and inserting the parent package next time. Feel free to file an issue for that at http://b.android.com category Component-Tools.
-- Tor
With Android Studio not running, edit the file: C:\Users\MyAccount\.AndroidStudio\config\options\options.xml (replace C: with the installation drive and MyAccount with your account name).
Within the xml file look for "property name="SAVED_COMPANY_DOMAIN" value=" and change the value to what you want.
Following user2232952's guidance, for new versions of Android Studio change the value of:
<property name = "SAVED_ANDROID_PACKAGE" value = "com.example" />
I'm not sure why so many people have right answers with wrong file location...
I've installed android studio 2020.3 with all default settings and the file others.xml is in folder
C:\Users\MYUSER\AppData\Roaming\Google\AndroidStudio2020.3\options
For anyone coming here in 2020, the file you are looking for is other.xml
It can be found in your AndroidStudio library under config/options/other.xml
(For mac this is probably ~/Library/Application Support/Google/AndroidStudio4.1/options)
Then you can follow the instructions by #Murillo Comino
<property name = "SAVED_ANDROID_PACKAGE" value = "com.example" />
EDIT:
As per #Douglas Kazumi 's comment, it is important that AS will be closed while editing this.
If you've already created your project, you could go to your AndroidManifest.xml file and update the attribute in the Manifest (root) tag
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="your.package.name"
android:versionCode="1"
android:versionName="1.0" >
Just make sure the rest of your code also reflects this change.
Click the package name and hit Alt+Shift+R and Rename, it will update everything!
I have uploaded my app on android market.I did some changes,and want to update it again so I am getting the error.
"The new apk's versionCode (1) already exists"
So what should I do.Plese help me
Thank you
it is not possible as per my knowledge that without change your app version code, update app to market you must need to update it.
Go to manifestfile >> and set version code new
like this ::
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="your.package.name"
android:versionCode="2"
android:versionName="2.0" >
you get your manifest and increment the version code, example:
before:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="your.package.name"
android:versionCode="1"
android:versionName="version name" >
after:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="your.package.name"
android:versionCode="2"
android:versionName="new version name or not ^^" >
good luck.
You can not upload new installer same application package with same version code.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="your.package.name"
android:versionCode="1"
android:versionName="1.0" >
Change the version code (most likely incrementing it) in your manifest.xml.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="your.package.name"
android:versionCode="2"
android:versionName="2.0" >
you must have to change your venter code hereersion code
Just as an addition to Dr Nik's answer (sorry, my rep isnt high enough to comment), remember to save the amended manifest before exporting the signed apk, otherwise the changes don't go through and you get the same error. Exporting doesn't autosave. Had me frustrated for 20 mins until I worked it out.
For Android Studio you must also change build.gradle file which has defaultConfig method contains versionCode