Install two versions of an apk (with different applicationIds) - android

How much do I have to change in an android project for it to be installed as a new app?
I thought that it would be enough to change the applicationId in the build.gradle file, but I am not able to install the second version of the app without uninstalling the first version. In the play store I get error 910 or error -505 and when installing it manually I get:
Installation failed with message Failed to finalize session : INSTALL_FAILED_CONFLICTING_PROVIDER: Package couldn't be installed in /data/app/net.mindlevel-1: Can't install because provider name net.mindlevel (in package net.mindlevel) is already used by net.veglevel.
It is possible that this issue is resolved by uninstalling an existing version of the apk if it is present, and then re-installing.
Do I have to change the package name in AndroidManifest.xml too?
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.mindlevel">
And if I have change that, I have to change every single source file to use that package right?

In your manifest, there is a <provider> element with a hardcoded android:authorities attribute. That needs to be changed as well as your applicationId, as there can only be one provider installed for each unique authority.

Related

problem while uploading apk on play store

When I upload my apk on the playStore(release in alpha), I am getting this error:
Upload failed
You need to use a different package name because
[name of package] is used by a pre-installed
application. To upload a pre-installed application, please contact
Google Play Developer Support. Learn more.
However, it is my first release and no one is using this package name.
Last thing, the version code is 1531. Maybe is it due to that? FOr the first release, I have to set it to 1?
There exists other application with the same package name for sure.
You can refactor-rename your package name, and make it sure that changes reflect in a manifest file, Proguard configuration etc.
Copy your Package name in the Manifest file
<package="com.example.myapplication"> Press ctrl+shift+R enter your old package name and replace with a new one.
Your application is having the same named package, which is already used by some other app on play store.
The solution is to change the package name using refactoring. It will change your package name.

Android Studio - APK with capitalized package name - INSTALL_PARSE_FAILED_MANIFEST_MALFORMED

I know that almost identical question was asked here, but accepted answer doesn't work for me.
Make apk with Capitalized package name in android studio
Let me explain.
Our Android app was developed in Xamarin.Android, we did a mistake with package naming - Visual Studio and Xamarin configured our's app manifest with uppercased package name (this was a mistake which now I pay with my sanity). It worked for Xamarin version, but we decided to rewrite that app in Android Studio after some releases. Now the problem begins...
We are not able to directly deploy/install apk on devices older than Android 8.0, we get following error: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED
It's funny that issue does not exists on devices with newest API.
It's clearly issue with our package name which is something like:
YES_We_Failed_On_It.We_Failed_Very_Badly
If I change it to lowercased everything works, but the case is we can't release another application with different package name.
Is there any possibility to fix this?
It will be self answer question.
If anyone else will be at my position, fix is quite simple.
As mentioned in docs: https://developer.android.com/studio/build/application-id.html
When you create a new project in Android Studio, the applicationId exactly matches the Java-style package name you chose during setup. However, the application ID and package name are independent of each other beyond this point. You can change your code's package name (your code namespace) and it will not affect the application ID, and vice versa (though, again, you should not change your application ID once you publish your app).
Application ID and Java package name are not the same.
So to fix this I renamed my package to be lowercased and stayed with uppercased Application ID. Problem disappeared.
At the end of build, build tools copy our Application ID into final APK's manifest, that's why it's still the same package I think.
Also from docs:
One more thing to know: Although you may have a different name for the manifest package and the Gradle applicationId, the build tools copy the application ID into your APK's final manifest file at the end of the build.

open a new version with the same package name android studio

I would like to add code to my app but I would like to do that on a new version in case so that i can always get back to my older version which worked.
I need the package name to be the same cause i'm using google services like :JSON and firebase which are relies on the package name.
Could someone please advise step by step?
when I tried to open a new project and copy the files to that new project got warnings like INSTALL_FAILED_INVALID_APK and Gridle not imported. for example:
"Installation failed with message Failed to finalize session : INSTALL_FAILED_INVALID_APK: Split lib_slice_2_apk was defined multiple times.
It is possible that this issue is resolved by uninstalling an existing version of the apk if it is present, and then re-installing.
WARNING: Uninstalling will remove the application data!
Do you want to uninstall the existing application?"

I am incrementing, but still get "An APK with this package name and version code already exists."

first post for me. I posted this to Oculus forums also.
I am trying to update my Alpha build with a second APK but am receiving the following error:
An APK with this package name and version code already exists. Please
increment the version code and then resubmit your update.
My previously uploaded Alpha has a version of 1.0 and version code 1.
My new Android Manifest has the following:
android:versionCode="2" android:versionName="2.0"
so I have incremented both the version name and the version code but still get the error. Am I missing something?
Thanks
So it turns out that you also have to set the version number and code in Unity under Edit -> Project Settings -> Player -> Other. I was just setting the version number in the Manifest XML itself and hadn't heard of this setting in Unity.

Google play says: "You need to use a different package name" - why?

I have already published an app called com.mycompany.mygame on google play.
I then decided to publish an ad free version of it. I did not change the package name in eclipse because I noticed that in the "export" process you have the opportunity to have the final apk set as anything you like. So I set it there as com.mycompany.mygameaf - note the additional "af" on the end. But then when tried to upload it to the market, google said:
You need to use a different package name because "com.mycompany.mygame" is already used by one of your other applications
So now I'm confused. Is the complaint because I'm not allowed to have an apk that is a name which is and extension of a previous app? Or does the final apk somehow have knowledge of what the original name was?
What is the easiest way to resolve this?
Apart from correcting app name in the Manifest I also had to change applicationId in the app's gradle.build file.
defaultConfig {
applicationId "com.example.changednameofmyapp"
...
}
Also, if you're using ProGuard, do not forget to change appropriate rules in your proguard-rules.pro
Just search the old package name in the whole project and change it.
Regardless of the name of the .apk file, the package name of the Application contents inside it must be unique.
You can use refactor-rename to change this, though make sure that the change penetrates to the manifest file, proguard configuration, etc.
The name of the APK doesn't matter, its the package name within the AndroidManifest file that counts.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yourcompany.yourapp"
There can only be one app on the market with that package name so in order to publish your ad free version you would have to change the package name in the manifest file, e.g. add the af onto the end of the package name within your manifest.
As mentioned in other answers, you're development would be simpler if you put all the shared code and assets a common library project that is a dependency of your paid and free versions.
You may also wish to play with the new Gradle build system (in Android Studio) which allows you to dynamically set things like the package name at runtime. It also allows you to switch resources during build time, which is extremely convenient; You could have a boolean resource that represents whether the current app is the paid version. This allows you to enable/disable app features based on a check to that value.
The filename of the APK is irrelevant, the package name of your app is used as a unique identifier - it is in the root element in the AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.packagename"
android:versionCode="1"
android:versionName="1.0" >
When you initially create your project in Eclipse it creates an actual package structure which matches this package name for you to put your source files in.
You can actually chnage your package name by modifiying this manifest value and you can just keep the folder/package structure as is - it does not need to match your actual application package name.
Alternatively, right click your project in Eclipse, go to "Android Tools" and then select "Rename Application Package"
After you do this you should be able to submit your binary
The package name in the manifest is used to identify the application within Android and within Google Play. So different apps need different names.
The easiest workaround might be to just create a new package, with no code in it, and use that as the app's package name in the manifest.
What I've done to solve my many-apps-from-one-codebase problem is put all the apps' code in a library project, and then I have several app projects that use that library. The app projects contain no code, just a manifest and custom resources.

Categories

Resources