Why will my signed apk not install? - android

I have been developing my app for a while and runing on a real device through Eclipse using Run As -> *Android Application*.
Now I am trying to distibute it to some beta users for the first time.
I used Eclipse to create a signed app, using a new keystore that I generated through the wizard. This appeared to work fine and when I check with Jarsign I get the message "Jar Verified", although there are a couple of warnings too. These are "This Jar contains entries whose certificate chain is not validated" and "Ths Jar contains signatures that do no include a timestamp".
I then copied the resulting apk onto the device and opened it. But got a message "This app was not installed". And in log cat I can see:
"Package has no certificates at entry ; Ignoring!"
I found some people had suggested going back to JDK 6 (I did have 7 previously), but that didn't help.
A few people suggested it might be due to duplicate activities in the manifest so I checked the manifest thoroughly.
What I have found is that if I rename the apk so that it is no longer exactly the same name as the last part of the package it suddenly works.
So if the package is com.mydomain.myapp and the apk is myapp.apk I get the error, but if it's myapp_debug.apk it installs just fine.
I find this very confusing and more than a little worrying. I would like to publish this app for real eventually and I'm not sure if I've done something wrong.

Based on your renaming makes it work description, you already have an app with the same package name installed on the device, but signed with a different certificate (probably the debug certificate used for eclipse-launch installs).
You must simply remove the existing installation before you install your release version. You can do that either from the settings menu, or with an ADB command of the form
adb uninstall your.package.name
Note that this removal will wipe out the private data stored by the app - that's part of why you have to do it, to prevent an imposter (naturally having a different certificate) from easily grabbing data left behind by a real app.
Remember also when distributing apps to others in this manner that they will need to allow unknown / non-market sources in their settings menu.

Related

I can no longer install android apps with apk

I recently created an android app. When I tried to debug my app on my phone, it worked. Then I generated the apk, and tried to execute it from the file browser, it doesn't work, and I have the following error message : "App not installed", despite having allowed the unknown source in the settings. I also tried with an official app. For that, I extracted the Apk with apk extractor, uninstalled the app, and then executed the apk: same error. I tried many solutions found on the web, but none of them worked :
I disabled play protect.
I reseted the app preferences in the settings.
I tried on my former phone and on my father's phone.
I updated the os on my phone (android 10 to android 12).
I have already installed many apps just by executing the apk on my phones (including my current one) and it's the first time i'm facing this problem.
Can you help me please ?
Debug build and Release build have different signatures so before installing "release app" you should uninstall "debug app".
Also check expiration date of your release signature and make sure it is a valid signature.

App not installed. An existing package by the same name with a conflicting signature. Two app with same prefix package name [duplicate]

In my emulator, when I try to do an upgrade of my apk programmatically. I get:
Android App Not Install.
An existing package by the same name with a conflicting signature is already installed
I'm still in the testing phase of this upgrade, so the file I download is a signed apk of a previous version, which I think should work without any issues.
From the suggestion in: an existing package by the same name with a confilcting signature is already installed I tried to run the emulator both in debug mode and in normal mode... neither worked.
Any thoughts on what I'm missing?
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 Settings -> Apps, then swipe to the All tab. Scroll down to the very end of the list where the old versions are listed with a mark 'not installed'. Select it and press the 'settings' button in the top right corner and finally 'uninstall for all users'
The problem is the keys that have been used to sign the APKs, by default if you are running directly from your IDE and opening your Emulator, the APK installed in the Emulator is signed with your debug-key(usually installed in ~/.android/debug.keystore), so if the previous APK was signed with a different key other than the one you are currently using you will always get the signatures conflict, in order to fix it, make sure you are using the very same key to sign both APKs, even if the previous APK was signed with a debug-key from another SDK, the keys will definitely be different.
Also if you don't know exactly what key was used before to sign the apk and yet you want to install the new version of your app, you can just uninstall the previous application and reinstall the new one.
Go to Settings > Apps, find and open the app info. Then, open the overflow menu (3 vertical dots), and choose Uninstall for all users.
Go to Settings > Apps, find and open the app info. Then, open the overflow menu (3 vertical dots), and choose Uninstall for all users.
If you are using the debug apk, the key that is used to sign it is in
C:\Users\<user>\.android\debug.keystore
If you use that same key, there should not be a conflict when installing.
If you don't want to bother with the keystore file, then just remove the package altogether for all users.
Connect your device with Mac/PC and run adb uninstall <package>
Worked for me.
Ref: https://android.stackexchange.com/questions/92025/how-to-completely-uninstall-an-app-on-android-lollipop
If above solutions did not work for you then you may have doing something as following ..
1) installing the app from Appstore.
2) updating it with sign APK with same package name updated version.
So basically there are two kinds if APK's.
1) you uploaded on playstore known as original APK.
2) download from playstore known as derived APK.
In this case basically you are downloading derived apk and updating it with original APK.
For let it work fine uploaded new signed released APK in the internal test mode on the Google Play Store and download the derived APK to check the update scenario.
There is a difference between signed and unsigned APK files. Most likely you had an unsigned on there previously. You just need to delete the unsigned before you install the signed version. How this can be accomplished varies on the exact version, but in general, go on the emulator to settings-> application, long click your app, and delete/remove/uninstall it.
If you use multiple users at android, verify that the app is uninstalled everywhere.
It may be application is not uninstall successful. If your device is this case, you can try this method.
First get the package name of the application, e.g 'com.xxx.app', you can use Root Explorer and find it from Manifest file(RE can decode the file). then you can use this script to uninstall it:
adb shell pm uninstall com.xxx.app // replace to package name that you want to remove
I had an issue where both debug and release build won't install on devices I used for debugging. The same msg would appear when trying to install the new version. The only workaround was to uninstall the current version and install the new one.
It looks like Android studio marks the apk it installs so that installation using the package managers would distinguish between version installed for debugging and versions downloaded from Google play or other external sources (this never happened to me when using eclipse).
There may be another reason when your application will not update when you either change/add/remove shareId in AndroidManifiest.
"android:sharedUserId"
Please check that also.
To prevent would recommend to use sharedUserId in your application despite in your current requirement you need or now.
Same package error:
Create a new Package in your app with different name.
Copy and paste all file in your old package to new Package.
Save Code.
Delete old Package And Clean and rebuild project.
I had to login as the owner and go to Settings -> Apps, then swipe to the All tab. Scroll down to the very end of the list where the old versions are listed with a mark 'not installed'. Select it and press the 'settings' button in the top right corner and finally 'uninstall for all users'
I tried all the above and it did not work.
I found that in spite of uninstalling the app a new version of the app still gives the same error.
This is what solved it:
go to Settings -> General -> application Manager -> choose your app -> click on the three dots on the top -> uninstall for all users
Once you do this, now it is actually uninstalled and will now allow your new version to install.
Hope this helps.
I just choose uninstallAll in Gradle Bar. It worked for me.

Android App Not Install. An existing package by the same name with a conflicting signature is already installed

In my emulator, when I try to do an upgrade of my apk programmatically. I get:
Android App Not Install.
An existing package by the same name with a conflicting signature is already installed
I'm still in the testing phase of this upgrade, so the file I download is a signed apk of a previous version, which I think should work without any issues.
From the suggestion in: an existing package by the same name with a confilcting signature is already installed I tried to run the emulator both in debug mode and in normal mode... neither worked.
Any thoughts on what I'm missing?
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 Settings -> Apps, then swipe to the All tab. Scroll down to the very end of the list where the old versions are listed with a mark 'not installed'. Select it and press the 'settings' button in the top right corner and finally 'uninstall for all users'
The problem is the keys that have been used to sign the APKs, by default if you are running directly from your IDE and opening your Emulator, the APK installed in the Emulator is signed with your debug-key(usually installed in ~/.android/debug.keystore), so if the previous APK was signed with a different key other than the one you are currently using you will always get the signatures conflict, in order to fix it, make sure you are using the very same key to sign both APKs, even if the previous APK was signed with a debug-key from another SDK, the keys will definitely be different.
Also if you don't know exactly what key was used before to sign the apk and yet you want to install the new version of your app, you can just uninstall the previous application and reinstall the new one.
Go to Settings > Apps, find and open the app info. Then, open the overflow menu (3 vertical dots), and choose Uninstall for all users.
Go to Settings > Apps, find and open the app info. Then, open the overflow menu (3 vertical dots), and choose Uninstall for all users.
If you are using the debug apk, the key that is used to sign it is in
C:\Users\<user>\.android\debug.keystore
If you use that same key, there should not be a conflict when installing.
If you don't want to bother with the keystore file, then just remove the package altogether for all users.
Connect your device with Mac/PC and run adb uninstall <package>
Worked for me.
Ref: https://android.stackexchange.com/questions/92025/how-to-completely-uninstall-an-app-on-android-lollipop
If above solutions did not work for you then you may have doing something as following ..
1) installing the app from Appstore.
2) updating it with sign APK with same package name updated version.
So basically there are two kinds if APK's.
1) you uploaded on playstore known as original APK.
2) download from playstore known as derived APK.
In this case basically you are downloading derived apk and updating it with original APK.
For let it work fine uploaded new signed released APK in the internal test mode on the Google Play Store and download the derived APK to check the update scenario.
There is a difference between signed and unsigned APK files. Most likely you had an unsigned on there previously. You just need to delete the unsigned before you install the signed version. How this can be accomplished varies on the exact version, but in general, go on the emulator to settings-> application, long click your app, and delete/remove/uninstall it.
If you use multiple users at android, verify that the app is uninstalled everywhere.
It may be application is not uninstall successful. If your device is this case, you can try this method.
First get the package name of the application, e.g 'com.xxx.app', you can use Root Explorer and find it from Manifest file(RE can decode the file). then you can use this script to uninstall it:
adb shell pm uninstall com.xxx.app // replace to package name that you want to remove
I had an issue where both debug and release build won't install on devices I used for debugging. The same msg would appear when trying to install the new version. The only workaround was to uninstall the current version and install the new one.
It looks like Android studio marks the apk it installs so that installation using the package managers would distinguish between version installed for debugging and versions downloaded from Google play or other external sources (this never happened to me when using eclipse).
There may be another reason when your application will not update when you either change/add/remove shareId in AndroidManifiest.
"android:sharedUserId"
Please check that also.
To prevent would recommend to use sharedUserId in your application despite in your current requirement you need or now.
Same package error:
Create a new Package in your app with different name.
Copy and paste all file in your old package to new Package.
Save Code.
Delete old Package And Clean and rebuild project.
I had to login as the owner and go to Settings -> Apps, then swipe to the All tab. Scroll down to the very end of the list where the old versions are listed with a mark 'not installed'. Select it and press the 'settings' button in the top right corner and finally 'uninstall for all users'
I tried all the above and it did not work.
I found that in spite of uninstalling the app a new version of the app still gives the same error.
This is what solved it:
go to Settings -> General -> application Manager -> choose your app -> click on the three dots on the top -> uninstall for all users
Once you do this, now it is actually uninstalled and will now allow your new version to install.
Hope this helps.
I just choose uninstallAll in Gradle Bar. It worked for me.

Re-installation failed due to different application signatures

I am getting the above error message when I try to debug an application that is already installed. Most others who run into this seem to be developing on different machines with different key files, but I am doing everything on the same box.
My issue is that I am testing my database upgrade process (i.e. what the onUpgrade() method of my SQLiteOpenHelper extension does). For this, I would like to try the upgrade on top of a variety of older builds. These builds are available as signed application packages. When I deploy such a package to a fresh emulator and then try to debug the current version on top, I get the error in the subject line. I think that this is because the debug deployment packages are unsigned, and the currently installed package is signed. Again, I know that the error goes away if I unstall the currently installed app, but then I cannot test the upgrade.
I do not want to go through the effort of switching back my dev environment to older build versions, so that I can build unsigned packages for these versions. I may not even be able to do this, because I switched source code repositories recently and lost some of the history.
I believe that if I were able to get Eclipse to generate a signed package for debugging, it should work. Alternatively, I could manually deploy a signed package and launch a debug session without a build/deployment step, but I have not been to figure out if this is possible, either. What can I do?
Edit: The Android documentation was helpful in figuring out how to sign a package with the debug key, but this does not help me, because I need to debug with a private key. I suppose that this is not possible.
You can sign current package with release key, install on device, run the application and connect debugger in Eclipse. How to connect debugger: in the DDMS perspective on the Devices view select your application and press button with "green bug":
I'll post it as an answer:
You should generate them all with one signature - otherwise it wont work. only uninstall and fresh install will work with different signatures. http://developer.android.com/guide/publishing/app-signing.html also taken from there:
Eclipse Users
If you are developing in Eclipse/ADT (and have set up Keytool and Jarsigner as described above in Basic Setup for Signing), signing in debug mode is enabled by default. When you run or debug your application, ADT signs the .apk with the debug certificate, runs zipalign on the package, then installs it on the selected emulator or connected device. No specific action on your part is needed, provided ADT has access to Keytool.

Re-installation failed due to different application signatures - AGAIN

I create an APK and install it on the device. All works OK.
Then I try and run the app from Eclipse and it gives the error above. I didn't make any changes or even need recompiling. I tried running it as debug as well as release and both have the same errors.
Something is messed up somewhere as this used to work :(
EDIT: If I want to send out a pre release to users that have a normal install from the market, does that work ok, if I just send them the APK?
This happens when you for example install or run applications with the same package but signed with two different(may be debug) keys. Just uninstall the application and run it from Eclipse againg.
You should be able to uninstall the application (either though the Android App Manager or apk uninstall <application package-path>) and then deploy it. It seems to get confused when you do a proper install then try to deploy a dev build over it.
You may have messed up your debug certificate. Try to remove it from ~/.android/debug.keystore (Linux/Mac OS X); or %USERHOME%/.android on Windows.
then uninstall using adb your app : adb uninstall yourpackagename
And try to launch it again from eclipse.
It is neither necessary nor desirable to perfom an uninstall of the application if, say, you want to preserve user data like settings.
I have had the same problem for a while, and my solution is simply exporting the app (like when publishing, with the release key) and intalling that .apk file on my phone (I attach it to an e-mail and send it to myself).
This will have the same effect as updating it normally through Google Play Store, and all previously saved data is retained.
It may not be as convenient as running it directly from Eclipse, but having to uninstall the application all the time is not such a great solution either.

Categories

Resources