Android sign apk file - android

I use this tutorial for sign my apk link
but I have stopped on the step Sign your application.
There is
./sign-mac-example.sh ../DialANumber/deploy/DialANumber.apk
Enter passphrase:
command
this not an internal or external program as I see in command line.
I use windows.
I have create all folder in workspce there are:
androidkeys (where I store my key my-release-key.keystore)
deploy (where I have export my apk file)
Thanks for help!

I can see this section a bit higher in the tutorial than the place you cite:
Write a short script to make your life easier Just to make the life
easier I wrote a short script which can be used each time to sign your
Android APK file. You can download it below and place it in the same
directory you placed the keystore at (see point 2).
Here the guy defines the script he calls with ./sign-mac-example.sh. However, regretfully this script is meat to work on linux and mac, not windows.
Nevermind the only line that is really crucial in this script is this:
jarsigner -verbose -keystore my-release-key.keystore "$1" alias_name
And you can use it in Windows also, just replace "$1" with ../DialANumber/deploy/DialANumber.apk.
I actually can not justify why the guy resorted to additional script here.

I recommend using Eclipse for signing Android Apps.
Therefore you have to install Android SDK and plugin for Eclipse. Create a project - When you're done, rghtclick on your Project and click export.
The wizard allows you to create a new keystore or use an existing one to sign your app.
I tried signing apps with console using Ubuntu, but it was hard - With Eclipse it's very easy and the export wizard creates the .apk

Related

How to create a new keystore in xamarin.android?

I'm trying to publish a xamarin.android app. I'm using Visual Studio with Xamarin Android 6, so I followed this. In part 2, it describes how to create a new keystore as shown in the following screenshot (You can see the complete describtion here):
I don't get where should I place this command. I looked at that keytool link, but couldn't find any thing. I tried cmd, MSBuild Command Prompt for VS2015 and Developer Command Prompt for VS2015, but all of them showed this error: '$' is not recognized as an internal or external command, operable program or batch file.
In addition to, I tried to create a new keystore using Visual Studio. I went to tools>Android>Publish Android App and I created a keystore and it appeared in path that I specified. Then I went back to that guide and continued from Sign the APK. But there's not any .apk with name and path that I specified. There are just 3 .apk that were before doing all this and don't work.
Now my question is that where should I use that command? In furthermore, I would like to know is there any other way to publish an xamarin.android app?
Reyhaneh,
Keytool is an executable provided by the Java SDK. You'll find it in your Java SDK folder, for example:
C:\Program Files (x86)\Java\jdk1.7.0_55\bin\keytool.exe
You can execute it in a normal command prompt. To create a new keystore, open a command prompt with the following line:
"C:\Program Files (x86)\Java\jdk1.7.0_55\bin\keytool.exe" -genkeypair -v -keystore <filename>.keystore -alias <key-name> -keyalg RSA -keysize 2048 -validity 10000
From my experience in generating the KeyStore and eventually publishing to google, which worked like a charm.
You first have to Archive your Xamarin.Android project by clicking on the Build menu and clicking Archive. If all works fine, this should archive the project but that's not our target. (Also please make sure the App is set to APK in the Android Package Format in the Project Properties. Just in case)
When it's complete, click on it and click the Distribute button at the bottom of the archive page.
Choose Adhoc
Click the Plus button to create the KeyStore
Fill out the form
Now, click SaveAs
Choose any place to put the APK file (we don't really care at this point)
Wait for all to be done
Go C:\Users"YOUR PC USER NAME"\AppData\Local\Xamarin\Mono for Android
You will see the KeyStore folder. Go into it to see your App folder containing your KeyStore. Please copy the entire folder and perhaps put it in your App source code folder for safekeeping or any other location of your choice.
THAT'S IT
FOR GOOGLE PLAY STORE PUBLISHING
You will need to provide the KeyStore in the Android Package Signing page in the project properties for the Android project. This is very essential as it's required before your app can be uploaded to the play store.
Next, change the Android Package Format in the Android Options tab (in the same android project properties windows) to Bundle
Now achieve the android project again by clicking the Archive button in the Build menu. This will now create the App Bundle file for Google Play Store. You can click on the Open Folder when done to get your app bundle file.
GREAT!!1
THAT IT...
Hope this helps... It's a pain at times to do all this just to get your app ready for publishing on the plat store or for other reasons.
You may get some additional information from the link below. It may be helpful as it contains some screenshots but it's not as simplified as what I have done above.
https://learn.microsoft.com/en-us/xamarin/android/deploy-test/release-prep/?tabs=windows

how do i find my SHA 1 for my android app in android studio?

I'm new to developing Android apps and I wanted to create a Google map inside of a Fragment. So far I've gotten the part where I need the API key and I'm confused by the instructions from the Android developer site and everything I've found online hasn't cleared my confusion.
Could someone provide me with a step by step of how to get my SHA1 fingerprint on Windows 7?
You cannot obtain the API_KEY until you get your SHA1.
Click here to get a nice tutorial that will guide you step by step with images (Specifically when you are operating on Windows 7).
Hope this would Help!!
There are two kinds of fingerprints, debug and release. Assuming you want a release one, then from a console window, you need to run this command to get the fingerprint
keytool -exportcert -alias MY_RELEASE_KEY_ALIAS -keystore MY_FULL_PATH_TO_RELEASE_KEYSTORE_FILE -list -v
The keytool program is in your JDK bin folder. So on Windows, something like C:\Program Files\Java\jdk1.8.0_20\bin is where you should find keytool
Last thing to note is that MY_FULL_PATH_TO_RELEASE_KEYSTORE_FILE in the command above should be the full path to your .keystore file, including the file name
After all that, you will be finally be provided with several fingerprints, including the SHA1. You can copy that, and go back to Google Developers Console and paste it as a new line in the allowed Android Applications, with your package name added to the end, separated by a semi-colon.

Every time I try to export a signed apk, ADT excludes a bunch of classes

Lately, whenever I try to export a signed apk for my app using the Export Wizard in Eclipse, ADT is excluding a bunch of classes from the signed apk.
I can build and debug the app without any problems, and the unsigned apk has no problems running on my Android device, but if If I install the signed apk, the app immediately crashes after opening, giving me a java.lang.ClassNotFoundException.
I unzipped the apk and then used dex2jar to convert the classes.dex file into a jar file.
unzip my_app.apk
./d2j-dex2jar.sh classes.dex
Examining the contents of the jar file (I used JD-GUI) revealed that it is, indeed, missing a bunch of classes. But why are they missing? Eclipse didn't give me any errors during the export... How can I create a signed apk that will work?
When you export a signed application, the build system runs ProGuard. This will eliminate all classes, methods, and fields that ProGuard thinks are not being used. Take a look at your proguard-project.txt file for notes on how to modify the ProGuard settings to keep things that it might otherwise discard.
If you post details about the removed classes (specifically, how they are used in your code), we can provide specific guidance on what settings to change.
For now, I've got around the issue by avoiding the Export Wizard in Eclipse and manually signing/aligning instead (instructions on android.com).
Steps for those who don't like reading long instructions:
Export an unsigned apk (right-click on you project and select Android Tools > Export Unsigned Application Package)
Sign the application using jarsigner:
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore
/path/to/same/keystore/used/by/export/wizard.keystore my_app.apk
key_alias
(key_alias is the same alias prompted for by the Export Wizard)
Align the package:
zipalign -v 4 your_project_name-unaligned.apk
your_project_name-aligned.apk
I'm still curious to know what's wrong with the Export Wizard and how I can get that working again.
Are you using ProGuard? If so, try disabling it and exporting the signed app again.
Maybe your ProGuard config is broken.

Signing APK from developer

Things to know:
I'm kinda new to programming
I have installed Eclipse with the Android platform loaded on my Macbook Pro
I have 2 PCs as well for further troubleshooting and flexibility
I commissioned a developer to port an iOS app to the Android platform. I did not build the app myself, I paid to have other people do it. I was able to run the avd and emulator and install/uninstall/reinstall with success through the adb protocol. Now I'm on to sign the APK for release in the Android Marketplace, except that's where I'm stuck. I have attempted and researched the hell out of this to no avail. I think the issue I'm running into is the materials I find are outdated.
Methods I've tried:
Using command prompt on my PC, I used the keytool command via the instructions here and was able to get through the first half, but when prompted for the second half I kept getting "cannot find jvm.dll". This guy had a similar issue, but no instructions on how to solve it, which he did apparently. NOTE: I did not find jarsigner.exe in ANYWHERE on any of my computers. I downloaded it from a website. Could be corrupt or invalid I suppose. Could never get a signed APK.
I found "signapk.rar" from this site and it actually seemed to work. I followed the instructions to a T and it produced the signed APK like it was supposed to. The problem was when I attempted to upload it, the Marketplace told me it expired before the 2033 date, whatever that was. So I assume that the code in this program had a validity entry that was large enough. I don't know how to change that, if that is the issue.
I came across Portecle just yesterday and was able to create a keystore and a certificate. I know where they are in my directory, but I don't know how to use that to sign the APK. It's terribly confusing.
Signing in Eclipse. This is the least successful method because I can't for the life of me figure out how to work the damn thing. I know I can't just 'import apk' and it work like magic, but that'd be great if it did. I created a new project and imported the file system after changing my APK to a ZIP. One time it imported the manifest and the other time it didn't do anything. I'm certain it's user error.
I understand if this were an easy process, everybody could be a developer. That's obviously not the case, so I'm trying to figure it out on my own while my developer is out of the country. Any and all help is appreciated.
Assumptions:
Assuming you have the keystore (private key to sign the apk) already generated by you.You can use the command line to do the signing without eclipse or android studio if the yourApp-unsigned.apk is already generated by your vendor or you
You are Using Windows for the below steps
Signing the apk:
Add the path for your jdk bin to your system variables (if you don't know how to do, that look for it its easy search for how to add path to windows system variables)
This is my jdk path (use yours)
C:\Program Files\Java\jdk1.8.0_25\bin
open Command Line and type the below using your App apk and keystore key
jarsigner -verbose -keystore c:\users\android\myAppKeyStore.keystore
c:\users\blabla\Desktops\myAppAPK.apk my_keystore_alias
if success, it will promote you to enter key phrase/password of your private key (the one used for your private key generation which you should know)
Verify it was signed Successfully using the command line
jarsigner -verify c:\users\blabla\Desktops\myAppSignedAPK.apk

Android Google Maps API Key

I'm developing an app that uses Google Maps. I got the debug keystore and got the API key to work while I am debugging my program in Eclipse, but I am thoroughly confused in how to change this so that it works on an Android device when I export the .apk. I have searched around Google, but am mainly finding things that use the debug.keystore and I don't think this is what I want to use when I deploy this on an Android device, because I sent my .apk to a friend and he said he is getting gray boxes on the Map View.
Can anyone fill me in, step-by-step, on how to correctly make a new keystore for my app and how to sign my app so that it will work outside of debugging on Eclipse? A video tutorial would be preferable, but if not, simple 1-2-3 step type instructions would work. Thanks!
Eclipse (through ADT) has a nice wizard that lets you create a real keystore and build a signed apk. Right click your project, then Android Tools -> Export signed Application package
For the google maps key just follow these instructions
head to the command prompt, (I use windows so I'm going to go that route but same general idea for the other OS's)
The keytool program you'll need is part of the JDK so you do have it if your able to compile the apps at all. but it may not be on the app path so you can't just type it into the command line to be used.
for me it was in:C:\Program Files\Java\jdk1.7.0_21\bin so to get it on the app path I typed this in set PATH=%PATH%;C:\Program Files\Java\jdk1.7.0_21\bin
next you need to change to the directory your keystore files are in for me that is: C:\android\keys so I used the command cd C:\android\keys to change to the proper directory
then you need to run the keytool with the proper settings so it knows your after the key and not trying to do something else. the command I used was: keytool -list -v -keystore Testkeys and Testkeys is the name of my keystore use the name of your keystore there instead.
Last by not least it will spit out a whole bunch of different information but the one your looking for will look something like this
SHA1: A1:DF:83:DD:04:B2:26:10:B2:EB:26:00:90:75:D0:10:66:5E:A9:8A
you want all the numbers and : that are after the "SHA1: " that is your app key for the published version of your app, the one you need to register with the google maps api service, and then they will give you a new map api key that you need to put in your project and then republish it, and then the maps will work.

Categories

Resources