Android - Install signed apk via Eclipse - android

Good day.
I have an application and I recently wrote a code to make it update programatically by fetching the updated apk file on a server I host. I made the updated apk by changing the version code to version 2 and version name to 1.0.1 in the Android Manifest file. I also placed a textView in the first activity to know if it is the updated application or not. However, an issue I encountered while updating is that I get the An existing package by the same name with a conflicting signature is already installed error when Android tries to install the downloaded apk file. Since the error is about a conflicting signature, I guessed that whenever I install an application to my device (Nexus 7) from Eclipse, the application is not signed. What I did was that I Exported a signed copy of the version 1 of the application, moved it to my Nexus 7, and installed. From that signed application version, I tried to update and I encountered no problems.
However, this process is not efficient at all because if I want to debug my application to see if data stored like the database or sharedPreferences persist between app updates, what I'll have to do is to export my app, copy to tablet, then install. This does not allow me to use logCat efficiently - as the session filter won't work. The only way for me to see my logs is via the All Messages category and look for my tags.
So, my main question is: Is there a way to install a signed copy of your application via Eclipse so you can still debug efficiently via LogCat?
A secondary question: What happens to the private app data like the SQLite Database and the SharedPreferences when the application upgrades versions? Are they deleted?

When you debug (or run) Android will use the default store key for signing your application, and you can change it on Windows -> Preferences -> Android -> Build
Change your debug keystore there with custom debug keystore

Yes Its possible to install signed copy your application via Eclipse and you can still debug efficiently via LogCat.
Follow These steps.
1. Right click on your project from project list in eclipse.
2. Click Export.
3. Then select Export Android Application
4. Then select the project to export.
5. Click Next.
6. Then give the path of signing key (Keystore file). If you don't have any then create new keystore file by selecting Create new Keystore radio button on that Dialog.
7. Enter and confirm password and click Next.
8. Select Alias of Keystore file. which you have given while creating that file.
9. Enter password for that Alias and click Next.
10. Select the destination to export apk file and click finish.
It may take few minutes to build your app. Time depends on your application size.

Related

How to move android project to another pc?

i want to move my android studio project to another pc but when im moving files from pc one to pc two and i'm trying to run the same app it's not launching and asking to remove old(the same package) app, but i want to save app signature how can i do it? for example i want to work at home, after i'm going to work and continue my project at work is it possible and how? and yes, sorry for my bad english...
image
but i want to save app signature how can i do it?
Each Android Studio installation will generate its own debug keystore for signing a debug apk. Quoting from the documentation on app signing:
"The first time you run or debug your project in Android Studio, the IDE automatically creates the debug keystore and certificate in $HOME/.android/debug.keystore, and sets the keystore and key passwords."
Apps signed with a different debug key are perceived to be different apps. So you need to copy one of the debug keystores to the $HOME/.android/ folder on the other development machine.
Download GitHub desktop and sign up. Then create repository and push project in repository. At the work in Android Studio go to File -> New -> Import Project and past a link to created repository.
https://desktop.github.com/
To see how to transfer the debug.keystore that is required so you don't get the message "The device already has an application with the same application but a different signature. In order to proceed you will have to uninstall the existing application." (and lose your data). See Update the app in another machine with same debug.keystore in android

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.

I have forgotten my keystore password and I want to install my apk on Google Play. What do I do?

I have made an application and I signed its apk one month ago. Now I have forgotten its password and when I am using a new key for this and installing it on Google Play, it's giving me the fingerprint error. What can I do?
The application link is here.
The error occurs:
you can find your lost key password in below path
Project\.gradle\2.14.1\taskArtifacts\taskArtifacts.bin
open the file and search with the part of the password that you remember. You will find it definitely. Else, try searching with this string "signingConfig.storePassword".
Note: I have experienced the same and i am able to find it. In case if you didn't find may be you cleared all the cache and temp files.
Try to find your password here if you are using Gradle 4.0 and above.
Switch to project mode.
Open your project name folder.
Open .gradle folder.
Open gradle version folder (here in my case it's 4.4).
Open taskHistory folder.
Double click on "taskHistory.bin", select open in text editor option.
press ctrl+f to open search box and try to find your key (guesswork).
UPDATE:
In gradle 5.4 version the file path has been changed as below: <project>\.gradle\5.4\executionHistory\executionHistory.bin
You have to use the same certificate when you update your apk or Google Play won't recognize it as the same app.
If you can't remember your password at all, I don't think there is any other choice but to start with a new app (new package name).
From Google documentation
Application upgrade – As you release updates to your application, you must continue to sign the updates with the same certificate or set of certificates, if you want users to be able to upgrade seamlessly to the new version. When the system is installing an update to an application, it compares the certificate(s) in the new version with those in the existing version. If the certificates match exactly, including both the certificate data and order, then the system allows the update. If you sign the new version without using matching certificates, you must also assign a different package name to the application — in this case, the user installs the new version as a completely new application.
Source: http://developer.android.com/tools/publishing/app-signing.html
Similar info also here in Android developer blog: http://android-developers.blogspot.com.au/2011/06/things-that-cannot-change.html
Just as important as the manifest package name is the certificate that application is signed with. The signing certificate represents the author of the application. If you change the certificate an application is signed with, it is now a different application because it comes from a different author. This different application can’t be uploaded to Market as an update to the original application, nor can it be installed onto a device as an update.
[...]
In conclusion: There are some parts of your application that can not change. Please be careful.
The keystore password can be broken, but you'll still need the alias password later on.
Download the two files from here
https://gist.github.com/zach-klippenstein/4631307
Build with:
javac ChangePassword.java
Run:
java ChangePassword <keystore filename> <new keystore filename>
The lost key password can be found under the .gradle folder, the path be something like this:
.gradle\3.3\taskArtifacts\taskArtifacts.bin
I think 3.3 is the number of the gradle version, it may change in some cases. If the version is greater than 4.0 the path is actually different:
.gradle\4.1\taskHistory\taskHistory.bin
In any case, this are binary files, so they're full of unreadable data, but if you search for the string "signingConfig.storePassword" you'll find a lot of text, mine looked like:
<97>signingConfig.keyAlias^C<8a>MY_KEY_ALIAS<9c>signingConfig.storePassword^C<92>MY_STORE_PASSWORD<98>signingConfig.storeType^C<84>jks<9f>
Switch to project mode.
Open your project name folder.
Open .gradle folder.
Open gradle version folder (here in my case it's 5.4.1).
Open executionHistory folder.
Double click on "executionHistory.bin", select open in text editor
option.
press ctrl+f to open search box and try to find your key
(write storepassword).

Obtain generated debug key/certificate for developing on different machines

I'm using Eclipse to develop an app and I have two computers (a desktop and laptop) that I want to use to develop this app. I recently set up my laptop with Eclipse and imported the project over to that computer. However, I realized that I can't launch the application from my laptop onto my phone because the signature that is automatically generated when I build the app from my desktop doesn't match the one that is automatically generated on the laptop; unless I uninstall it on the phone. Does anyone know how to export the automatically generated signature from one Eclipse and import it into another?
Window -> Preferences |-> Android -> Build:
refer to your custom debug key store, (I copied mine from the C:\Users\${UserName}.android\debug.keystore) which I would put in something like drop box.
The automatically generated key is called the debug key/certificate.
You should generate a new key can just copy it over to both your devices. The only negative of this is your builds process is longer as you need a manual steps.
The other option is to copy over the debug key from one of the systems.
You will find the keys in a folder names .android in your home directory in Linux & user directory in Windows
Tip: Never loose the certificate once you push an app to the market.

Categories

Resources