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>
Related
I am releasing my android app project on play store. So After reading some blogs I decided to put that app for testing to some limited users and then publish the app. But when I uploaded the package of my app in play store then an error in red line comes like:
Your base manifest is missing android:icon. nullLearn more about android:iconnull.
You need to use a different package name because "com.example" is restricted.
Why this error is popping, I already done setting my icon. And also what is the meaning of this line "com.example" is restricted..
Issue 1: Your base manifest is missing the android:icon attribute
Open your app's manifest file, go to the <application> tag. Inside the <application> tag, you need to set your app's icon with the android:icon attribute. See the below code for a reference:
<application
android:allowBackup="true"
android:icon="#drawable/app_icon"
android:label="#string/app_name"
android:networkSecurityConfig="#xml/network_security_config"
android:supportsRtl="true"
android:theme="#style/AppTheme"/>
Issue 2: You need to use a different package name because "com.example" is restricted
The package name is the unique identifier for your application. "com.example" is the default package name for Android applications so you need to change your application package name. Follow this tutorial to change the app package name.
You cannot upload your apk to play store using com.example package name. Your package name should be unique in nature, you need to change your package name
Change package name
I am trying to build Linphone android from this, with SDK api 23 and NDK r11c on Ubuntu 16.10. I already built it successfully but I cannot change its package name so as to be able to upload it to Google Play Store despite following its instruction to the letter. For Example:
To create an apk with a different package name
You need to edit the custom_rules.xml file:
look for the property named "linphone.package.name" and change it value accordingly
Already done:
<?xml version="1.0" encoding="UTF-8"?>
<project name="custom_rules">
<property name="linphone.package.name" value="my.name" />
....
Then I did this
also update the values in the AndroidManifest file where the comment appears
by replacing all instances of org.linphone in every <!-- Change package ! --> comment. All of them are comments though so that may be not important. I did not change this one because it will throw an error when I run make
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.linphone"
android:installLocation="auto"
android:versionCode="3253"
android:versionName="3.2.5">
And the next step is
change the package name also in the files: res/xml/syncadapter.xml, res/xml/contacts.xml and res/values/non_localizable_custom where appears
which I did exactly like I was told. The last step is running make.
But the result I always get is org.linphone no matter whichever name I changed it to. Did I botched any step? Can we even change linphone package name to something other than org.linphone? And no, I cannot change its package name by this method, it would just brick the project, render it unbuildable.
Now the package name are in build.gradle and no more in custom_rules.xml
def getPackageName() {
return "org.linphone"
}
and its used here:
defaultConfig {
compileSdkVersion 23
buildToolsVersion "25.0.2"
applicationId getPackageName()
multiDexEnabled true
}
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 need to deploy two application on the play store :
Eg:
com.android.myapppro and com.android.myappfree both have similar code but small changes like [Show/Hide Ads]
So while changing the package name of the application updating the Gradle file
applicationId "com.android.myapppro"
To
applicationId "com.android.myappfree"
is sufficient, or do i need to update the AndroidManifest.xml also.
Changing the AndroidManifest.xml will force me to update the R imports in all the classes.
Please Help!
Thanks in advance.
From ApplicationId versus PackageName
Therefore, we have decoupled the two usages of package name:
The final package that is used in your built .apk's manifest, and is the package your app is known as on your device and in the Google Play
store, is the "application id".
The package that is used in your source code to refer to your R class, and to resolve any relative activity/service registrations,
continues to be called the "package".
You need to change only applicaitonId and left AndroidManifest.xml as is.
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.