A Unity ID allows you to buy and/or subscribe to Unity products and services, shop in the Asset Store and participate
in the Unity community.
Now in Beta! Get 1:1 live lessons on any Unity topic or help troubleshooting your project – Connect with an expert on Unity Live Help
Discussion in 'Android' started by murali.vvn, Sep 30, 2010.
Is it required to sign our apk file ? If yes how to do it?
For development : No. For publishing (i.e. Android Market) : Yes.
1) Locate the Publishing Settings under PlayerSettings
2) Create a new keystore by selecting a keystore name and password (confirm the password)
3) Select "Create a new key" under Key Alias
4) A new window opens; enter the necessary information.
5) Select the newly created key.
6) Build ( Run); your app is now signed.
n.b. Remember the passwords; they are not stored with the project (for security reasons).
How to save key?
Can't find saved "user.keystore"
The keystore (including the key) will be created after step 4 below (ie after entering the details of the key)
Having trouble with this - I don't get a new window, and Create New Key is a checkbox above, not a selection under Key Alias. I'm still on f5 build.
No, it's "Create New _Keystore_" that is a checkbox.
Did you select "Create New Keystore" (assuming you don't already have one)?
Did you select a name for the Keystore (Browse Keystore)?
Did you enter a keystore password?
Did you confirm it (and does it match)?
Only then will the "Create New Key" be visible under KeyAlias.
When pulling down the KeyAlias drop list do you get any errors in the Console log?
ah, thanks Erique - didn't click Browse Keystore and save first.
FYI, In Windows, I had to download/install JDK and then manually add the JDK bin path to my PATH variable in Windows before I could get KeyTool and JarSigner to work from Unity. JDK installer did not do that automatically.
The 3.1 release will hopefully remedy this. If possible, please try the 3.1beta as it includes the fix for finding JAVA_HOME if not set by the JDK installer.
And if you don't have access to the beta, just email me: firstname.lastname@example.org
I have the same problem of Akasurreal: Unity does not find the command to create the keystore, so it saves nothing.
I'm trying to follow his procedure and see if it works.
I am on W7-64b.
You need to either install the JDK (on Windows usually), or have the jarsigner command in the PATH (which is the normal case for OSX).
I added JAVA_HOME variable with value C:\Program Files\Java\jre6\
Now I'm restarting the computer
That probably won't do; you need the JDK, not the JRE.
I downloaded the JDK, what the hell?
OK it works with value = C:\Program Files\Java\jdk1.6.0_23
Without the at the end!
I can't get this to work. I have my JDK installed at C:/Program Files/Java/jdk1.6.0_24 and I have made a PATH environment variable with this path. No matter what I do Unity tells me Unable to run keytool; do you have the JDK installed?
Hi, my java sdk version is 1.6.0_23
- Please read this URL -> http://www.devdaily.com/java/java-using-keytool-genkey-private-key-keystore
- Goto start button and key cmd command at Run...
- Use this command for create privateKey.store file ::.
keytool -genkey -alias foo -keystore privateKey.store
- Use this command for view your first alias name
keytool -list -v -keystore privateKey.store
4 ::. Publishing Setting
- Check at Create New Keystore
- Insert your keystore password first
- Comfirm your keystore password again- Check Existing Keystore
- Press Browse Keystore button
- Select file privateKey.store
- Now you can see foo at Alias name combo box already
- You can create new Key by unity3d
5 :: Please try and Good luck.
Use JDK 6u14 (jdk1.6.0_14). Unity works fine with that version.
If you live outside USA, just rollback to 6u14 and it will work.
Anyone know how to sign an APK when building from the command-line (e.g. from a build script or CI server)? Looks like the keystore/key passwords aren't saved, so can BuildPipeline.BuildPlayer() be used to build non-debug signed APKs?
They can be passed with PlayerSettings.keystorePass and PlayerSettings.keyaliasPass.
the password for the alias, does it need to be the same as that of the keystore?
No; you can set separate passwords for each keyalias inside a keystore.
If i had lost the keystore and want to update the version in android market. Is there a solution for this?
The version of JDK I'm using is 6u14. I had the same problems with newer versions.
Download the 6u14 from oracle website through here: http://cds-esd.sun.com/ESD7/JSCDL/jdk/6u14-b08/jdk-6u14-windows-x64.exe
Hi, I did all the procedure described in the posts but my alias not shown in the Key Alias combobox . What can I do?
Hi erique! Long since you posted these instructions, but I still have a question regarding the Google recommended procedure to publish Android apps. I could jump into Terminal (I'm on a Mac) to do the entire process there, but it'd be great to learn to do it in Unity too. I already have my keystore key and necessary utilities configured in my path, and in reading the docs at http://developer.android.com/guide/publishing/app-signing.html I see a step that you didn't address, which is optimizing the signed apk with zipalign. When you configure Unity properly for Android publishing and hit Build, is it still necessary to manually align the apk or does Unity take care of that for you too?
please answer to this question !
We take care of all that to make sure the .apk is ready to be uploaded to the Android Market (or similar). The .apk is signed and aligned the same way as when using Eclipse or ANT. It is not necessary to align the .apk manually.
erique thanks !
Thanks for the confirmation erique! So sweet to have a one-click-to-publish solution all within Unity, kudos!
Ok I have a keystore and alias setup No errors. select use keystore enter Pw, select my alias enter pw. My passwords are correct!! Build and run and get errors.
Unable to install APK!
1719 KB/s (6446484 bytes in 3.661s)
PostProcessAndroidPlayer:UploadAndStartPlayer(String, String, String, String, String, Boolean, Single, Single, Boolean) (at C:/BuildAgent/work/842f9557127e852/Editor/Mono/BuildPipeline/PostProcessAndroidPlayer.cs:826)
PostProcessAndroidPlayerostProcess(BuildTarget, String, String, String, String, String, String, BuildOptions) (at C:/BuildAgent/work/842f9557127e852/Editor/Mono/BuildPipeline/PostProcessAndroidPlayer.cs:403)
Should it build and run?
Where should the keystore file be saved? Anywhere? Or in the project folder somewhere?
If I just Build it builds to a .apk just fine. Try to upload to android market Devolper console and get "An unexpected error occurred. Please try again later." and thats it no more information. Waited a day and got the same and another day and the same now four days later same issue. Any help is good help Thank You in advance!!
To answer my own question uninstall jdk 1.7.0 and install 1.6.23 and all better. Found the answer in unity answers. Thanks.
I am so frustrated right now .... I just downloaded the new JDK and this is not working.... by the way is the country code for the United States 01, that's my best guess after googling us country code.
trying to install the JDK 6u14 (jdk1.6.0_14) like WolfoX suggested... hope this works
BeforeTheLight, can you provide a link to the JDK version you downloaded?
Unable to run 'keytool'; do you have the JDK installed?
System.ComponentModel.Win32Exception: ApplicationName='keytool.exe', CommandLine='-genkey -keystore "C:/Users/David/user.keystore" -storepass zipzap01 -alias earthcrosser -keypass zipzap01 -validity 18250 -dname "CN=David Robinson, OU=earthcrosser, O=Earth Crossers, L=Arlington, S=VA, C=01"', CurrentDirectory=''
at System.Diagnostics.Process.Start_noshell (System.Diagnostics.ProcessStartInfo startInfo, System.Diagnostics.Process process) [0x00000] in <filename unknown>:0
at System.Diagnostics.Process.Start_common (System.Diagnostics.ProcessStartInfo startInfo, System.Diagnostics.Process process) [0x00000] in <filename unknown>:0
at System.Diagnostics.Process.Start () [0x00000] in <filename unknown>:0
at (wrapper remoting-invoke-with-check) System.Diagnostics.Process:Start ()
at UnityEditor.Utils.Program.Start () [0x00033] in C:\BuildAgent\work\842f9557127e852\Editor\Mono\Utils\Program.cs:30
at UnityEditor.AndroidKeystoreWindow.CreateKey (System.String keystore, System.String storepass) [0x001ea] in C:\BuildAgent\work\842f9557127e852\Editor\Mono\GUI\AndroidKeystoreWindow.cs:321
I tried all this stuff and I'm still having no luck
Turns out I just needed to use the 32 bit JDK not the 64 bit JDK, so that fixed it
Yeah, always our annoying friend Java. The mister independent plataform where independent pltaform means bad and slow independently of the platform. Why they dont wanna let that weird thing die ? and I would love to say RIP Java.
God bless Microsoft and Apple with your native,stable and fast code.
Sorry for this mad post, but I'm very tired.
Wow, so I am having the same problems that everyone else has had here.
Ok so adding the location of the installation to the system environment variables
for Windows Business Vista 64x with a jdk1.7.0_01 version install
fixed the issues I was having.
I'm having a variant of this issue -- I have Windows 7 64 bit, and jdk 1.7.
Everything gets signed just fine through Unity. But when I deploy to the Android Market -- or install through a manual download -- the install fails -- I get the message Application Not Installed. From the market I get a signature error
When I look at the APK using jarsigner verify, I get this message:
[CertPath not validated: Path does not chain with any of the trust anchors]
Any help is appreciated.
I wasnt able to figure out how to create a keygen using unity but its easy enough if you just use the command line.
I have the same issue as Adsy, where as when I try to make the new key, the following error pops up in the console: "Unable to run keytool; do you have the JDK installed?"
I do have the JDK installed, but unity doesn't seem to find it. I found the keytool.exe, but unity won't listen when I try to redirect it there.
Any help would be greatly appreciated.
Also anyone coming here having KeyStore issues with Windows 7, make sure that you install the 32bit version of JDK. the 64bit version will not work
you can create it whit this:
keytool -genkey -keystore xxxx.keystore -storepass xxxxxx -alias xxx -validity 18250 -dname "CN=xxx, OU=xxx, O=xxxxxxx xxxxxx"
I got a keystore from an external party to sign my android build with and the name of the key i need to sign with contains a space. So i'm getting an error saying that it can't find a key with that name. Where that name is the first part before the space only. Is there a way to have the build process recognize the whole name of the key?
Currently no - I've just fixed this problem, but it will take some time to get the fix through testing and be released to the world.
As a workaround you can sign the .apk on the command line using
$ jarsigner -verbose -sigalg <sigalgo, probably MD5withRSA> -digestalg SHA1 -keystore file.keystore app.apk keyname
(as described here : http://developer.android.com/guide/publishing/app-signing.html)
Just make sure you remove any debug certificates first, i.e.
$ zip -d app.apk "META-INF*"
Thank you Enrique.
Yes, i did sign and align the apk manually as a temporary workaround. No big deal, just takes 2 min longer.
Has anyone had a problem when uploading a new version of an existing app, signed with the old and same keystore where the Dev console spits out an error:
"The apk must be signed with the same certificates as the previous version."
Now, i opened up my old source which i haven't touched for about 4 months, fixed a few bugs and made a new build. It was still referencing the old keystore in the playerSettings, so i'm definitely using the same key...
Is it possible to just delete the current APK (v1.0) in the dev console, and upload a new one with the keystore im currently signing with?
Hi about this key, does it allow a copy protection?
Should I choose in the publish page, copy protection unable or disable?
It says that this option will disappear and be changed with app licensing. Is it included in unity build?
I have a trouble.
After updating Unity up to 3.5.3 (free Unity + iOS license + Android license) I can't to sign my apk applications. And in the previous unity version signing with same keystore works with no problems.
What is this? How to solve this problem?