Search Unity

Android Signing

Discussion in 'Android' started by murali.vvn, Sep 30, 2010.

  1. PJisAnarchist

    PJisAnarchist

    Joined:
    Jan 9, 2012
    Posts:
    9
    Just to say thank you guys (gamestudio > perfect step by step), and suggest that this thread should be a tutorial on the Android Publishing page of Unity.com

    That helped a lot!
     
  2. cj_coimbra

    cj_coimbra

    Joined:
    Nov 23, 2011
    Posts:
    3
    I think I am facing the same problem you guys did but I can't get past to it. I am on OS/X, using Unity 3.5.2 and whenever I try to create "create new key" after entering the info and confirming, I get this error:

    And then the alias is not shown on the alias drop down (only Unsigned (debug) is shown actually)

    Now I checked my Java stuff here and it seems to be running ok, my version is "1.6.0_33" (according to java -version)

    I've also runned the same command printed on Unity output via terminal and it seems to work, but when I select the "use existing keystone" option using the created keystore it happens the same thing as before...nothing is shown on the alias drop down menu.

    Then I created this keystore on a Windows7 command prompt and try to load it back on Unity but... nothing changed...

    Updated my Unity to the latest version (3.5.5f3) and gave another shot...still the same problem...

    Is there something else I could/should do??? (besides what I am constantly thinking these days -> abandoning Unity)
     
  3. softwizz

    softwizz

    Joined:
    Mar 12, 2011
    Posts:
    793
    I get the same fault, is there any solution to this.
    Using the debug signing works no problem but my own generated key wont let the application install.

    EDIT:

    I uninstalled jdk-7u3-windows-x64 and then installed jdk-6u34-windows-i586 and it all works 100% now.
     
    Last edited: Aug 22, 2012
  4. saulosom

    saulosom

    Joined:
    Jul 27, 2012
    Posts:
    26
    Ok, I get it.
    I follow the gamestudio's tutorial.

    But I have other problem now.
    I insert the key. Is all ok, but when I try to install in my device, it say: "Application is not installed".

    I try in 2 differents devices, and it show me the same.

    I test to build without the key and I installed, but I need with the key.

    Can anyone help me, please?
     
    Last edited: Aug 31, 2012
  5. softwizz

    softwizz

    Joined:
    Mar 12, 2011
    Posts:
    793
    Did you try the solution in my post above yours?
     
  6. spdygnlz

    spdygnlz

    Joined:
    Sep 10, 2012
    Posts:
    1
    Hi everyone.

    I've just done battle with the infamous JDK 1.7 signing issue and have gone back to the JDK 1.6. When I create a new keystore and key, I can build,sign, and install my app just fine. I can't, however, use the old key and keystore I previously made.

    First of all, does that make sense that the key I created (albeit with the 1.7 version of the JDK) won't work anymore? I'll admit, I'm completely new to the whole signing thing, but I thought the important part was the actual signing process that happens after the build.

    Second of all, if I'm not mistaken, when I try to upload the new apk to the Google Play store, it won't let me upgrade the existing bad version because it will have a different key. Is there any way around that? I'd rather use the existing listing and upgrade rather than have to disable it and have old garbage laying around. Any hints?

    Thanks,
    David
     
  7. softwizz

    softwizz

    Joined:
    Mar 12, 2011
    Posts:
    793
    What I did was delete the non working JDK 1.7 generated keystore and created a new one with JDK 1.6 using the exact same details passwords and alias and had no problems.

    I think it is an issue with the generation of the keystore itself that is the problem with 1.7

    I also use the JDK 'keytool.exe' program from the windows command line to generate my keystore then just use that keystore in unity.
     
  8. MD_Reptile

    MD_Reptile

    Joined:
    Jan 19, 2012
    Posts:
    2,664
    I'm totally trying this right now, if this works your a life saver.
    Edit: nope play knew it was different :(
     
    Last edited: Sep 28, 2012
  9. mrwhat

    mrwhat

    Joined:
    Sep 12, 2012
    Posts:
    3
    I can´t say how much these pages helped me! F*** JDK 1.7!
    But now i can´t update my app in the developer console because i don´t have the old keystore :(
     
  10. debasis

    debasis

    Joined:
    Oct 18, 2012
    Posts:
    1
    I am using Unity3d 3.5.4f1 on Mac OS lion 10.7.5
    After following all the step of creating keystore inside unity3d editor, when I click on create key button, nothing is happening. The Keystore window remains same with no error.
     
  11. tom1103

    tom1103

    Joined:
    Jul 14, 2012
    Posts:
    3
    What do I need to do? I can to every step except 5 and 6. If I do step 4 and then press "create key" it saids : Do you have JDK installed? and this is my error:
    Unable to run 'keytool'; do you have the JDK installed?
    System.ComponentModel.Win32Exception: ApplicationName='keytool.exe', CommandLine='-genkey -keystore "C:/Users/Public/Documents/Unity Projects/Roll-A-Ball/user.keystore" -storepass "(13579)" -alias "ball" -keypass "(13579)" -validity 20075 -dname "O=Tom-Games, C=+31" -keyalg RSA', 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\14194e8ce88cdf47\Editor\Mono\Utils\Program.cs:30
     
  12. CaptN_Nemoïd

    CaptN_Nemoïd

    Joined:
    Oct 25, 2012
    Posts:
    4
  13. Tomo-Games

    Tomo-Games

    Joined:
    Sep 20, 2010
    Posts:
    223
    It helps to simply sanity check your APK to confirm Unity is actually signing your app.

    Your keystone settings will be reflected in the output plus the expiration date. You should see any Debug CERT messages in there...

    Note if you then apply Android Market License aka Google Play's Public Key (provide by google) you may also see this error: jarsigner: java.util.zip.ZipException: error in opening zip file. Which will be ok. You would leave this field blank when signing your app for Barnes and Noble Nook.
     
    Last edited: Nov 10, 2012
  14. unityasoft

    unityasoft

    Joined:
    Oct 28, 2011
    Posts:
    263
    I think I've signed properly through Unity and yet when I attempt to upload my apk to google play it throws this error:

    Upload failed
    We could not save your changes. Please try again.


    I cant check if i've signed properly through jarsigner or keytool because the exe in this path just disappears:
    C:\Program Files (x86)\Java\jdk1.7.0_09\bin

    I've tried adding the path to the environment variables and no luck .

    What am I missing?
     
  15. jogo13

    jogo13

    Joined:
    Sep 26, 2012
    Posts:
    19
    I successfully created the key/keystore inside of unity 3.5.6. One note is that i believe you have to make the alias name the same as the keystore file name itself (without '.keystore' of course. :)
     
  16. CH

    CH

    Joined:
    Jul 4, 2012
    Posts:
    109
    I just found out that the pasword cannot be too short. I think. Try a longer password if you encounter problems with this!
     
  17. Madsen

    Madsen

    Joined:
    Nov 29, 2010
    Posts:
    15
    Thanks for all the help. :p

    We had the same problem with Unity 3.5.5 , Windows 7 64-bit, Java 1.7 64bit .

    gamestudios Tutorial help a lot - so better use Java 1.6 32bit.

    One remark. I think it's possible to see that the key is bad, all our old keystores had some strange code at the
    end (Extensions: ...........)
    So it's good to have a look at the keystores with:
    keytool -list -v -keystore name_of_the_keystore.Keystore
    So you don't have to upload bad version to Play Store, to test it.

    (If you can't run that command you should set the system varriables like gamstudio explained it.)
     
  18. johno

    johno

    Joined:
    Feb 20, 2011
    Posts:
    12
  19. bitter

    bitter

    Unity Technologies

    Joined:
    Jan 11, 2012
    Posts:
    530
    Hi, I just wanted to let you know that for 3.5.7 and 4.0 we did a major cleanup in regards to how we handle apk signing. Hopefully this will solve any problems previously related to different versions of java and/or different signing algorithms. The fix should also provide you with more detailed error messages as to what the problem is when the apk fails the signing process.
     
  20. mb35534

    mb35534

    Joined:
    Dec 24, 2012
    Posts:
    1
    Anyone have a solution for this? I did see the answer at http://stackoverflow.com/questions/4322367/i-lost-my-keystore-file but I would like more explanation. If I remember all the fields in the "Create a new key" dialog, shouldn't I be able to generate the same key and update my application? What other variables does key generation take into account to make it unique? I'm new to this; thanks.
     
  21. bitter

    bitter

    Unity Technologies

    Joined:
    Jan 11, 2012
    Posts:
    530
    Unfortunately you can't. The certificate and the key used for signing is unique. I haven't looked at the implementation but I'm pretty sure 'secure random' is part of the equation. So, make sure you always backup the keystore!
     
  22. matrix211v1

    matrix211v1

    Joined:
    Jan 20, 2009
    Posts:
    193
    What is the latest version of the jdk we can use to make keystone? I am trying it with 1.7.0 v11 32 bit and the Unity Editor is telling me to go take a hike.

    Using Unity Pro 4.0.1 (With Unity Pro Android)

    Thanks.

    [EDIT]
    Fixed all my problems with JDK Java SE 6 Update 41 32 bit version.
     
    Last edited: Feb 22, 2013
  23. yanebra

    yanebra

    Joined:
    Apr 26, 2013
    Posts:
    11
    Question:

    If Unity can create new keystore and alias key, why we still need to create and make use of keytool and jarsigner?( are there some reasons behind?)
    And where is the LVL? I am a bit messy with it now, what is the proper way to publish a apk in google play, PLEASE give a hand!!!
    THX
    Yan
     
  24. TheGreatFool

    TheGreatFool

    Joined:
    Aug 22, 2012
    Posts:
    1
    "All applications must be signed. The system will not install an application on an emulator or a device if it is not signed."
    from : http://developer.android.com/tools/publishing/app-signing.html
     
  25. RodErn

    RodErn

    Joined:
    Jun 1, 2013
    Posts:
    1
    After trying with the above steps, achieve sign my apk, but deploy it on the device I get a message in the lower right corner that says "development build"
     
  26. bitter

    bitter

    Unity Technologies

    Joined:
    Jan 11, 2012
    Posts:
    530
    All applications are automatically signed by the android build tool used by Unity. If you don't provide a key the application will be signed with a debug key provided by the tool. However, this debug key will not be valid for publishing.
     
  27. bitter

    bitter

    Unity Technologies

    Joined:
    Jan 11, 2012
    Posts:
    530
    That has nothing to do with the signature. In the Build Settings window there is a checkbox "Development Build", make sure that is unchecked before doing your final release build.

    http://docs.unity3d.com/Documentation/Manual/PublishingBuilds.html
     
  28. skakac-33

    skakac-33

    Joined:
    Oct 6, 2013
    Posts:
    8

    In 4.3.2f1 i cant find 2) 3) step..
    http://d.pr/i/ie2i

    And I always get this error msg when browsing through player settings
    http://d.pr/i/iz7J

    --
    Edit: there was something wrong with my unity, I fixed it with layout change
    now it all ok
     
    Last edited: Jan 13, 2014
  29. syamilsynz

    syamilsynz

    Joined:
    Dec 22, 2013
    Posts:
    31
    Thanks, it works fine with me
     
  30. javanoob

    javanoob

    Joined:
    Aug 15, 2012
    Posts:
    64
    Thanks :)
     
    Last edited: May 4, 2014
  31. BenoitFreslon

    BenoitFreslon

    Joined:
    Jan 16, 2013
    Posts:
    166
    Hello,

    I can't see the "Create a new Key" under Key Alias in Unity 4.3.

    Here a screenshot.

    http://prntscr.com/3o13p3

    Thanks.
     
  32. bitter

    bitter

    Unity Technologies

    Joined:
    Jan 11, 2012
    Posts:
    530
    You have to select where to save your keystore. Hit "Browse Keystore" and select a location. After that "Create a new Key" should then be enabled for that keystore.
     
  33. BenoitFreslon

    BenoitFreslon

    Joined:
    Jan 16, 2013
    Posts:
    166
    Thanks bitter ;)
     
  34. Que

    Que

    Joined:
    Mar 14, 2014
    Posts:
    135
    This fixed my issue. I was distracted by creating keystore and keys, and forgot to uncheck the "Development Build".

    Thanks.
     
  35. quary

    quary

    Joined:
    Jul 26, 2014
    Posts:
    2
    Hello, I am using unity 4.5.4 and the signing seems to go well, but when i try to upload application on google play i get the "invalid certificate" error.... Can anybody help me with this? Thx
     
  36. The_Thinker

    The_Thinker

    Joined:
    Dec 6, 2013
    Posts:
    38
    step 3 isnt in the new unity
     
  37. eriQue

    eriQue

    Unity Technologies

    Joined:
    May 25, 2010
    Posts:
    595
    I believe it's still there, as long as you've entered all the information in step (2) (using the correct/matching passwords)?
     
  38. The_Thinker

    The_Thinker

    Joined:
    Dec 6, 2013
    Posts:
    38
    yes thanks I have found it
     
  39. JigneshKoradiya

    JigneshKoradiya

    Joined:
    Dec 7, 2014
    Posts:
    5
    you have to visit this video to understand keystore :

     
    Tryyton likes this.
  40. Lenvanthis012

    Lenvanthis012

    Joined:
    Aug 24, 2013
    Posts:
    21
    Hi, I have signed with my own keystore and build it within Unity. Google store still complains it is a debug build. Where should I start.
     
  41. orvedal

    orvedal

    Joined:
    Nov 10, 2015
    Posts:
    47
    Thanks, the editor is a little cryptic on this part.
     
  42. kkbk58901

    kkbk58901

    Joined:
    Sep 17, 2016
    Posts:
    3
    Unable to create key in keystore. Please make sure the location and password of the keystore is correct. See the Console for more details.

    UnityEditor.Android.CommandInvokationFailure: Unable to create key in keystore. Please make sure the location and password of the keystore is correct. See the Console for more details.
    C:/Program Files (x86)/Java/jdk1.8.0_111\bin\java.exe -Xmx1024M -Dcom.android.sdkmanager.toolsdir="C:/Users/HP/AppData/Local/Android/sdk\tools" -Dfile.encoding=UTF8 -jar "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" -

    stderr[
    Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at SDKMain.main(SDKMain.java:129)
    Caused by: java.lang.IllegalArgumentException: invalid date string: Unparseable date: "glghflgfjmgiGMT+00:00"
    at org.bouncycastle.asn1.DERUTCTime.<init>(Unknown Source)
    at org.bouncycastle.asn1.x509.Time.<init>(Unknown Source)
    at org.bouncycastle.x509.X509V3CertificateGenerator.setNotBefore(Unknown Source)
    at UnityKeyToolGenKey.<init>(UnityKeyToolGenKey.java:87)
    at UnityKeyToolGenKey.main(UnityKeyToolGenKey.java:29)
    ... 5 more
    ]
    stdout[

    ]
    at UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) [0x00000] in <filename unknown>:0
    at UnityEditor.Android.AndroidSDKTools.RunCommandInternal (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) [0x00000] in <filename unknown>:0
    at UnityEditor.Android.AndroidSDKTools.RunCommandSafe (System.String javaExe, System.String sdkToolsDir, System.String[] sdkToolCommand, Int32 memoryMB, System.String workingdir, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) [0x00000] in <filename unknown>:0
    UnityEditor.HostView:OnGUI()




    Pls help..i tried everything mentioned above.
    I am using Unity 5.3.4f1 on Windows 8.1(64bit)
     
  43. nurhan

    nurhan

    Joined:
    Mar 9, 2017
    Posts:
    1
    hello everyone , i add my keystore in unity and everything is oki but it still gave me error (My apk is not signed) please can you gave me an answer?
     
  44. YoavGodelnik

    YoavGodelnik

    Joined:
    May 18, 2018
    Posts:
    1
    Thanks so much
     
  45. unity_AcEqGGPJjmnHuQ

    unity_AcEqGGPJjmnHuQ

    Joined:
    Aug 8, 2018
    Posts:
    2
    hi i am having this error in google play console
    "You uploaded an APK with an invalid signature (learn more about signing). Error from apksigner: ERROR: JAR_SIG_NO_MANIFEST: Missing META-INF/MANIFEST.MF"
    i have a keystore already but when i moved my project to a new system and i browsed and reused the keystore i had moved with the project but google console seems not to recognize it, i need help on this, thanks
     
  46. IndrajithE

    IndrajithE

    Joined:
    Oct 21, 2019
    Posts:
    1
  47. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    835
  48. DevboxBrasil

    DevboxBrasil

    Joined:
    Dec 26, 2020
    Posts:
    3
    Hey! Sorry to dig an old post like this, but is anyone else having this issue of play store complaining the AAB is in debug mode even when it's NOT in debug mode?

    This is my build settings:
    upload_2021-5-25_23-47-42.png

    Publishing settings:
    upload_2021-5-25_23-48-5.png

    My other settings:
    upload_2021-5-25_23-48-53.png

    I have just created a new app in play console and right now I'm trying to upload the first version of the game to open test. I just don't stop getting this error...

    I created my key, registered my password, alias and so on... I have already published a game before to play store and I didn't have any problem... but right now I'm stuck in this for days trying, trying, trying....

    Anyone? Any light?

    (Unity 2020.3.6f here)

    [EDIT] -----------------------------------------------------------------------------

    I figured it out!
    I checked my AndroidManifest.xml in "Assets/Plugins/Android/" and I found this:
    Code (CSharp):
    1. <application android:theme="@style/UnityThemeSelector" android:icon="@drawable/app_icon" android:label="@string/app_name" android:debuggable="true">
    I've just set this android:debuggable="true" to false. And that's it!
     
    Last edited: May 27, 2021
    NeatWolf likes this.