Why does the app signature change in Android after a classpath change? - android

I have an Android project that branched into three different applications, app-1, app-2 and app-3, that apply some customizations. Currently there is a lot of code duplication, making maintenance a nightmare: do the changes in one of the branches, and then merge the other two.
So we create a library project, named app-core, that factors out most of the duplicated code. So far so good.
When I launch this into an emulator where the application was already loaded (before the refactoring), I get this exception:
Re-installation failed due to different application signatures
A different signature? But I just added a line in the .classpath to link to the app-core Java project!
The main question is: are the existing users going to be bothered by this too?
And the side question: Why is it a different signature?

The digital signature is driven by a signing key that exists on the machine that signs the app. If Developer A compiles an app using the standard debug key and installs it in an emulator, then tries installing some other variation of the app -- one signed with a production key, one signed with Developer B's debug key, etc. -- in the same emulator, you will get that error.
The main question is: are the existing
users going to be bothered by this
too?
Do you have the production signing key that you used for the version of the app your existing users are using? If yes, then there should be no problem. If no, you're screwed.

Uninstall the application on the device, then run code again, it will work. It happens for me and I tried same thing, now it is working correctly.

For this problem u need to check that the correct key is used under (Window->Preferences->Android->build).
This u can check from the android.mk file of the app.
And on placing the correct key path , CLEAN and BUILD the project to avoid this error .

I have had the similar kind of issue. If you are installing it on your device then you need to uninstall the app on your device prior to install it from eclipse. It will definitely solve your problem.
Cheers

Related

Which one is my main app file installation?

I'm pretty much newbie to android and I've built a .apk file of my app based on some researches. There is two files:
app-debug.apk
app-debug-unaligned.apk
My question is kinda duplicate of this and this. But honestly still I don't get the idea. All I want to know, should I install which one on my mobile? Or should I buy which one as an application? Also what's the difference of them? You know, this is not very clear:
It is a two step process. The unaligned apk is just an intermediate product.
Can please someone makes me clear about them? Also why the name of them contains debug word? Aren't they final output?
Can please someone makes me clear about them? Also why the name of them contains debug word? Aren't they final output?
No, the debug version contains extra code that allows Android studio to attach itself your app's running process on the phone for debugging purposes e.g. setting breakpoints, inspecting variables. Making this public can potentially allow others to reverse-engineer your app.
If you want to put an apk on the Google Play Store, you'll need to build the signed Release version. This is done from Android studio: Build -> Generate Signed APK... and selecting Release as your build type after accessing your keystore.
As for unaligned, as per the questions linked, it's an intermediate file and should be ignored. The answers in the posts you've linked explain it better than I could.
you will find your output apk in C:\Users\username\Desktop\new\projectname\app\build\outputs\apk
this will be your final apk and ignore all other apk.

Android signing conflict

I am developing 2 android applications, which are clients for my server. I cannot install both applications on my android phone. I install the first app to phone, everything is ok. Then when I try to install the second app on the phone, I get the message that the application will replace another application (the first one), and then I get following error:
Application not installed: an existing package by the same name with a conflicting signature is already installed.
I mention that I have created one separate keystore file for every application, export them as in the android official signing application guide, then zipaligned them.
So the OS thinks that it is a single application? But in fact there are 2 different apps.
What am I doing wrong?
I think you are using the same package, which is not allowed for two different apps.
But for anyone who have the same error for installing another version on top of previously installed app:
I wanted to test released version of my app when the problem occured. I've had the app previously installed using eclipse, and than I wanted to install the same app but with released signature. I have even uninstalled the app using apps gallery, but the problem persisted.
The solution for me was to unistall the app using Settings->Apps->"the app"->top right corner menu->Uninstall for all users
I had the same error message, but these answers did not help. On a 4.3 nexus 7, I was using a user who was NOT the owner. I had uninstalled the older version but I kept getting the same message.
Solution: I had to login as the owner and go to the settings->apps... Scroll down to the end of the list where my old version was listed with a mark 'not installed'. Select it and press the 'settings' button in the top right corner and finally 'uninstall for all users'
Not sure what happens when you use the same signing key, because in all honesty, I never really tried it.
That being said, as Anand Tiwari, in his comment, has already simplified the answer, you cannot install two different applications with the same package name on one device. They, logically speaking, may be different to you, but for the OS, they are in fact, the same.
The problem also manifests itself when you try to upload the applications to the Android Market (Google Play). Google Play will simply not accept the second application. There is a short and simple explanation by Warren Faith here: https://stackoverflow.com/a/5788664/450534
As an example of how similar applications with a few changes are published to the Google Play store:
The free version of FriendCaster is: https://play.google.com/store/apps/details?id=uk.co.senab.blueNotifyFree
The paid version if the same app is: https://play.google.com/store/apps/details?id=uk.co.senab.blueNotify
Notice the ending of the package names. In this case, you will be able to install both the apps simultaneously on one device.
I think your problem is that both your files have the same package name. You can name both apps with similar packages, but they can't be identical. In fact, using the same package base can be used to communicate between applications ie. App1: com.mypkg.app1 and App2: com.mypkg.app2. However, they both can't be called com.mypkg.app - the package name is how Android identifies apps, and can't be identical.
You should be able to sign as many different apps (assuming their package is different) with the same key.
Make sure not to lose your signing certificate, if you lose it, you will not be able to upload a new app with the same package name. If you lose your signing certificate, you will be in big trouble.
Good luck.

android development - smart way to have both the current published version and the development version on my device

I guess this could be a common problem for new android developer like myself so I thought to ask it even so it is not a big deal.
I would like to have both the current published stable version of an app and the under development version on my device. Yet when I want to install both I get
Re-installation failed due to different application signatures.
You must perform a full uninstall of the application.
I understand it technically yet I was wondering how I could have an easy way around this so I can have both application on my phone. I could change the package name for the time being but I hope there is an even more straight forward way to get it done.
Thanks
UPDATE
Solution as given by "Marc Bernstein" in the following post - thx Algo for posting the link to it
How to change package name of an Android Application
There is a way to change the package name easily in Eclipse. Right click on your project, scroll down to Android Tools, and then click on Rename Application Package.
Just change package name of your published and development version Application. Changing Package name is really very simple and easy, follow that post
https://stackoverflow.com/a/9171773/185022
The "published" version should be signed using a release keystore.
The "development" version should be signed using a debug keystore.
At installation time, Android will complain that the two applications (having the same package name) have different signatures, and won't install the latest one (Re-installation failed due to different application signatures.).
To fix this (normal) behavior, change the package name of your application while developing it (ex: com.example.myapp-dev).

Losing data because of different Android signatures

I've been using my application for a while and produced a lot of data in it. Now it came time to upgrade it but the problem is that I've bought a new laptop and I can't upgrade the application due to different signature another IDE is using. It is impossible now to save the data, right?
Update: I didn't use any .keystore intentionally, I was just installing from Eclipse.
It doesn't matter along as you use the same .keystore when you sign the application.
You need to use the keystore and the same options.
So you are saying that you have uploaded your application without any signing certificate, basically copying the .apk from the /bin folder? As far as I know this is not possible.
If you indeed upload it with your .debug certificate, then I am afraid you will not be able to update your app, since as you have noticed, every installation of Android ADT creates a different .debug certificate on each machine.

How to re-sign an existing android app after modifing it

every one .
now I am in a project upon android system application source code with the Android v 2.1r1 : Contacts .
I have modify the source code and run it on the emulator successfully..
but i get a problem on publishing it to my android phone with the same system version because of without signing it.
how can i do if i want to publish it to my android phone after modifying it?
do i need to resign the Contacts.apk built by mm ?
can i just signing the Contacts.apk built by mm?
thx for your reading and replies !
You do exactly what the title of your post says. Re-sign the app with your own key. Google isn't about to give you theirs. So you need to create your own key and sign your app with it.
If you don't know how to do this, there are a ton of resources/tutorials/walk throughs already on-line.
I suggest starting here
As user432209 said, you will have to resign the package with your own key. It sounds like you might also be having an issue with your version of Contacts conflicting with the version on your phone. If so, you may need to change the package name.

Categories

Resources