Obtain generated debug key/certificate for developing on different machines - android

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.

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

How to avoid android signature problem when developing from two workspaces

I am developing an app from two different workspace on two different PCs.
Code is shared with git.
Problem is - when I build an install the apk on my mobile (htc one m8) PC 1 and then continue on PC 2, deploy the apk, I cannot install it on this same mobile. I get an error that says that an app in with the same package alreasdy is installed, but the signatures do not match.
I could certainly uninstall the app, then reinstall - but since I use databases, the uninstall would erase that data.
Is there a way to use the same signature on both PCs?
I use Eclipse with ADT and GenyMotion.
You can use the same signature on multiple computers by copying the debug signing key between the computers (or including it in source control).
You can then set Eclipse to use that keystore for debug builds by opening the Preferences > Android > Build menu.

Android - Install signed apk via Eclipse

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.

How can my friends test my Android application?

I am developing an Android application and it is not finished. I would like to test it on multiple devices, locations with various users that are not near me. How can I achieve this? Is there an APK I can send them? Is there a way that is as simple as plugging my phone in and then running the application from Eclipse? Or would I have to make an installer of some sort (I don't know)?
Obviously you can plug your phone(s) into the machine you are developing on and run it from eclipse. This will allow you to test and debug on the devices you have access to.
You can also export an apk from eclipse (see the android pages for instructions). You could put this up on a file sharing site and make it available to your friends. They could then install it, as long as they have authorised "unsigned" apks to be installed in their phone settings.
Assuming you have deployed the app at least once from within Eclipse to debug and test yourself, you will most likely have an APK under the bin directory in your Eclipse project. The file should be .apk. This APK will have been signed automatically by Eclipse with your debug key. This is obviously not the key you use for publishing but for testing among friends I think it's fine.
What I often do is just e-mail that APK file as an attachment to my friends to an e-mail account they have setup on their phone. Then all they need to do on their phone is make sure they have the system setting to allow installation of non-market apps (i.e. not from Google Play), which maybe named something slightly different like "allow 3rd party apps". Then they can simply click on the app attachment in their e-mail, download it and run it and they should automatically be prompted with instructions to install it.
I just used MyAppSharer. (I believe there are other similar apps out there - this is just the one I've used and is very simple/easy:
...you can share by market link or directly share APK (App's full
package)
I just used that, and sent my app via apk file to my coworkers. Can't get much simpler.
Just install the app on your phone via Eclipse, then run this AppSharer, and voila - share it w/ anyone!
You can can easily export your project as an APK in eclipse
File -> Export -> Export Android Project

When moving from 32bit machine to 64bit I have to uninstall my app

So this might sound like a complete and total noob question, but I'm going to ask and see what I find anyway.
I'm working on an Android application using Eclipse IDE. I have two development machines that I use (one for work, one for home) and one is 64bit while the other is 32bit. The phone that I'm using to test my application is a Google Nexus (Verizon flavored, most up to date drivers). If I build and run the application using one machine, then try to do the same on the other machine I get a console error that tells me to run an ADB command to uninstall my app because the signature has changed.
From what I understand it's because "debug.keystrore" (located in %USER_HOME%/.android) is different for each machine. Why does it do this? I assumed that the application signature was unique to the app not the app + dev machine. Is this normal behavior? If so, is there something I can do to get around it? I'm worried that copy/pasting the file between machines could cause problems, so I haven't tried it yet. Would I have to move this file every time I switch machines? Also, if I release my app into the wild; then loose my computer and have to start using a new computer (thus, changing the application sig) will everyone who installed my app have to uninstall the app because the application sig is different?
Bonus round: is there some way I can configure my IDE so that I don't have to change where eclipse looks to find the SDK every time I switch machines (i.e. make it look in both the ProgramFiles directory and the ProgramFiles (x86) directory.
To make sure the app was built by the same developer, Android wants the signature to be the same. Feel free to copy your debug key between machines. It has nothing to do with your machine or whether it's 32/64 bit; it only proves that you're the same developer.
When it comes time to release your app, you want to be very careful to
Keep your release key private, and
Keep your release key backed up in several places.
If you ever lose your release key, you won't be able to update your app, as you suspected.
Update: To make my answer more complete, it looks like the way to tell Eclipse which key to use is under Preferences -> Android -> Build.
I use Linux and don't use Eclipse; what I do is just copy ~/.android/debug.keystore from machine to machine, and the ant build tool uses it automatically, avoiding the pesky "certificates don't match" installation error.
For my release keystore, I have this line in my ant.properties:
key.store=../private/my-release-key.keystore
and keep my-release-key.keystore in a private repository much to the same effect.
I guess that for different platforms Google team has created different debug keys (I guess for tracking purposes). These debug keys do not depend on your application. If you want to distribute your application you need to create your own key. If you sign your application with your own certificate there should not be such kind of problem (because in this case, certificate depends only on attributes that you've entered when you create certificate). Under the Preferences -> Android -> Build you can select which keystore to use.
The signature is unique to each of the developers. From what I understand, if you are using the debug key, it uses your mac address or other unique characteristic to create an arbitrary key. So when you build and install your app onto a device with one machine, and then go to use another, you have different signatures, and thus your issue.
To be able to not have this issues, you should create your own key, as others have mentioned, and then use that to sign when you build.
You will NEVER want to release an app with your debug key, this is just for developing and when you go to release your app, you want to use your unique key that you created.
These keys are used to keep others from updating your apps, without your permission, so create a your own dev key and you won't have this issue.
Here is a link that should help you get started and pointed in the right direction: http://developer.android.com/tools/publishing/app-signing.html
I've copied "debug.keystore" from one machine to another, there are no ill side-effects. You can simply overwrite one with the other, and the un-install/re-install problem is fixed. The debug key is there only to protect the developer's own devices from other developer's binaries.
As others have mentioned, you do not publish your app with the debug key, you must make a release key and sign it, per the instructions on developer.android.com.
Also it's worth noting that the "debug" key is only valid for 1 year from the date it was created (when the SDK was installed). After a year, the SDK will say it's expired, and generate a new debug key. You'll have to re-copy the new key to the other machine, and you'll have to un-install the app signed with the old debug key.
As for the other problem you mention, you should have separate Eclipse workspaces that both reference the same Android project, using different SDK locations. The project does not need to be in a sub-folder of the workspace, so you can make this separation.

Categories

Resources