How to keep both released and updated APK? - android

After downloading my app from the Play Store I tried to run it from Android Studio
but got this error..
Is there a simple way to keep both apps?

What is the problem
There is conflict between your production APK and your debug APK.
The debug APK (installed by Android Studio) is signed using the debug.keystore (keystore).
The production APK is signed using one you created, with a passphrase only known by you.
So the device refuses to replace an application by another one claiming to be the same (same packageName) but that has a different signature (eg: has not been signed using your passphrase, so potentially not by you -- the author).
How to solve it
You now have two choices:
You want to have both applications side by side, then use another packageName for debug. This is easily done using Gradle:
android {
// ...
buildTypes {
debug {
applicationIdSuffix '.debug'
// ...
}
release {
// applicationIdSuffix
// ...
}
}
}
You want to keep only one application at a time: you just need to remove the old application to install the new one (with another signature).

just change the package name of application until you finish your editing

Reason why you are getting this error
Anytime you try to install an application with the same package name of any application installed in your device, you get this error.
Solution
Try to modify your package name of application in your current Android Studio

Another option is to modify android studio to sign your apk with the release keystore in debug as well, although thats generally not recommended.
That way when you install either apk you will keep your data.
Only problem is that both apks must be at the same versions to be interchangeable (you will not be able to install a lower version apk, at least not easily).

Related

AppCenter "App not installed as package conflicts with an existing package"

I have seen a similar stack overflow question but none that was for AppCenter. You can see that I have completely different version number and version codes for each release. I downloaded release 332, then tried download release 333 and this error message happens. How do I fix this? Why does this not happen on iOS appcenters?
Are all of your builds signed with the same release signing config? If the builds are not signed with the same key then you will get this error because it treats them as two different applications instead of an upgrade to the existing application.
Your old app has the same package name that the new app has. Whatever the version number maybe, you cannot install another app with same package name. Assuming, the old package name is com.demoapp New app will not accept its package name as the same as above. It should be something like com.demoappCopy.

Android: Can't overwrite existing app with new version

I'm developing a new version of an existing app. This is a complete redesign from the ground up, so I've created a separate project for this update. Now I need to test the app's behavior when upgrading from v2 (old version) to v3 (new version). The two projects have the same applicationId, module name, and are signed by the same key. However, when I install v2, and then subsequently install v3, the old app is not overwritten; I end up with two installs. What am I missing that is causing Android to view these apps as distinct?
Two APKs cannot both be installed on the device if the have the same application ID. The module name doesn't matter, and a different signing key would just force a complete uninstall/reinstall instead of an update.
Double check your application IDs for minor typos.
Also check if you have an applicationIdSuffix defined in your build.gradle. It is fairly common to append something like .debug to debug builds so you can have both a debug and release build installed on your device. If that's the case, make sure you are trying the upgrade with a release build.
You can also log (or show the application ID) in a Toast to verify that they are different and what you expect. Just call BuildConfig.APPLICATION_ID to get the current application ID.

What is the difference between a debugged version android apk and a release non-debugged version android apk?

What are some notable differences that a developer should take note?
The first one is debuggable and the second one isn't.
That means that the first one will output all your Log.d's and the production version won't.
Also, by default, debug versions are compiled without ProGuard while production builds are compiled using the default ProGuard rules
you may take a look at those posts
Android Studio: Build type release /debug - what relevance does this have?
also the officiel documentation is clear and hepful
http://developer.android.com/tools/publishing/app-signing.html
hint
debug when you are working on the project
release when you are about to publish the app
good luck !
One of the most important differences is that debug version of app is not prguarded so it can be reverse engineered. The reason why it's not proguarded is because you can track your logcat outputs easily without need to check mapping files.
In debug mode, you sign your app with a debug certificate generated by the Android SDK tools. This certificate has a private key with a known password, so you can run and debug your app without typing the password every time you make a change to your project.

How to update an Android app programmatically

I have developed an app for Android. When I installed it for first time, the app works. But when I do some changes in source code, we cant install it without deleting it from phone. I want that app should be updated wen I install it for second time. Any solutions?
Note: My app consists of database which I don't want to delete so want to update new app on existing one
Change your VersionCode in your Android Manifest to subsequent versions
android:versionCode
android:versionCode — An integer value that represents the version of
the application code, relative to other versions. The value is an
integer so that other applications can programmatically evaluate it,
for example to check an upgrade or downgrade relationship. You can set
the value to any integer you want, however you should make sure that
each successive release of your application uses a greater value. The
system does not enforce this behavior, but increasing the value with
successive releases is normative. Typically, you would release the
first version of your application with versionCode set to 1, then
monotonically increase the value with each release, regardless whether
the release constitutes a major or minor release. This means that the
android:versionCode value does not necessarily have a strong
resemblance to the application release version that is visible to the
user (see android:versionName, below). Applications and publishing
services should not display this version value to users.
See this http://developer.android.com/tools/publishing/versioning.html
How you are installing the application if by connecting usb you are trying so the new application will install and you can uninstall the first application and install the updated one so the new application will run perfectly.
Well, if you have compiled your second version you want to replace the old one...
I don't know what are you using to program for android, but if you use eclipse sdk that is done automatically..
The problem is probably because of your keystore with that you export your application. If you export your app with the default Android keystore, and then if you change the app on another PC and export it again with the default keystore on that other PC and install it on the same device, the Android will see that you have 2 same apps but with different keystores. That's why you need to first unistall the app and install it again.
It doesnt matter if you use the defualt Android keystore on both PC-s. They still aren't the same keystore.
One solution is that you create a keystore eg. ProjectKeystore and you create a folder keystore in your project. Put the keystore in that folder, and maybe put a file with the keystore username and pass. With that you can use the same keystore when you export your app on any PC.
But if you change version code then you will be prompted with this error. So Try looking for keystore
Re-installation failed due to different application signatures.
ExpenseTracker] You must perform a full uninstall of the application.
WARNING: This will remove the application data!
ExpenseTracker] Please execute 'adb uninstall com.spundhan.expensetracker' in a shell.
I have had similar problems trying to install my apps on occasion. To solve the problem I went to the app management screen and told the program to stop running then my update installed properly. I think it has something to do with the way android handles the program lifespan. When you exit a program it doesn't always stop running. If there is an error in something then android can have a problem closing the program before it can update it.

Have development version of app installed at the same time as an installation from market?

What is the best way to have a development/test version of an android app installed at the same time as the released version from market? i would like to send testers a .apk file via email they can install side by side with the currently released version available through the market. how is this possible? (it guess i could sign it with the same key so they can update the existing version, but if there is a bug in the test version they can't easily go back)
the same goes for my own device - when i want to try out the version of my app from market i always have to completely remove the development version including all my data and install it from market and set it up again.. this is pretty annoying, but i guess it's simply necessary to test my app after uploading it to the market.. and i don't have a dedicated development device..
is there a good workflow for this?
You will have to change its package name. Something like: com.you.package.test
FWIW there is now an easy way with android's new gradle build system.
One can simply specify a different application id for debug versions: http://www.lopez-manas.com/?p=294
buildTypes {
debug {
debuggable true
applicationIdSuffix '.debug'
versionNameSuffix '-debug'
signingConfig signingConfigs.debug
}

Categories

Resources