Search Unity

Unity 2017.1 Android build error

Discussion in 'Android' started by John-Lisenby, Jul 11, 2017.

  1. John-Lisenby

    John-Lisenby

    Joined:
    Nov 8, 2013
    Posts:
    122
    Hello,

    I just updated to Unity 2017.1.0f3 and when I try to build my APK using Internal (default) I'm getting error messages. I read that Android signing process was updated, and is there any thing new I need to do to make it build in Unity 2017? I had no issues build the same APK in Unity 5.6.

    I have attached screen shots.

    Thanks,

    John

     
  2. John-Lisenby

    John-Lisenby

    Joined:
    Nov 8, 2013
    Posts:
    122
    Screenshots
     

    Attached Files:

  3. nguyenthanhliemfc

    nguyenthanhliemfc

    Joined:
    Dec 28, 2016
    Posts:
    21
    Me too, I have try with new empty project. It's still error!
     
  4. John-Lisenby

    John-Lisenby

    Joined:
    Nov 8, 2013
    Posts:
    122
    Are you using Google Play Game Services? I have attached my editor log.
     

    Attached Files:

    Last edited: Jul 12, 2017
  5. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    @John-Lisenby please submit a bug report and post the case # here. Thanks!
     
  6. John-Lisenby

    John-Lisenby

    Joined:
    Nov 8, 2013
    Posts:
    122
    @Yury-Habets

    have uploaded a bug report and the number is 930255
    I have tested and it seems if a keystore is used it errors out. If no keystore is used it build the apk without issues.

    Thanks,

    John
     
  7. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    341
    I'm having the same error. Can't build APK.
     
  8. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    Looks like Android SDK Build Tools v.26.0.0 are missing the apksigner https://issuetracker.google.com/issues/62696222

    Please remove them and download and use the earlier version of the build tools for the meanwhile, for example by using Android Studio SDK Manager UI.

    We are getting in touch with Google about it.
     
    Last edited: Jul 17, 2017
    ilmario, MortePCAndVR and jyzgo0125 like this.
  9. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    Update: Google is planning to release a fixed version of build tools on 24th July. Until that, please use older tools.
     
  10. John-Lisenby

    John-Lisenby

    Joined:
    Nov 8, 2013
    Posts:
    122
    Okay thanks for the update!
     
    Omer_Developer likes this.
  11. Dannark

    Dannark

    Joined:
    Jul 24, 2016
    Posts:
    14
    Ohh Finally i found an anwser, thanks!
     
    Omer_Developer likes this.
  12. IgorDemchuk

    IgorDemchuk

    Joined:
    Mar 9, 2015
    Posts:
    21
    Yury-Habets' workaround didn't work for me.
    But this one worked
    Changing tools folder wasn't necessary for me, I'm using tools v.26.0.2.


    UDP
    Ok, now I see that Yury-Habets didn't mean to change tools folder, he was talking about build-tools folder, but mistakenly gave download links to older tools folder.
    All you need is to download a previous version of build-tools using Android Studio SDK Manager and do as quoted.
     
    Last edited: Jul 16, 2017
    itsharshdeep and MortePCAndVR like this.
  13. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    Oh I posted wrong download links! Fixing that - thanks for the heads up!
     
  14. gamepower7

    gamepower7

    Joined:
    May 16, 2017
    Posts:
    27
    hi ,
    I've applied the workaround , and got this error

    CommandInvokationFailure: Failed to sign APK package.
    D:\Android\sdk\build-tools\25.0.3\apksigner.bat sign --ks "D:/Work/GamePower7.keystore" --ks-pass pass:"V,Tmqm5DXJ$j/&%,:Dsz" --ks-key-alias "damar on lin" --key-pass pass:"~w#FV3ua;fCeGIE~3zIh" "C:\Users\h.safa\Source\Workspaces\BagoonV5\BagoonV5\Temp/StagingArea/Package.apk"

    stderr[
    Failed to load signer "signer #1"
    java.io.IOException: Keystore was tampered with, or password was incorrect
    at sun.security.provider.JavaKeyStore.engineLoad(Unknown Source)
    at sun.security.provider.JavaKeyStore$JKS.engineLoad(Unknown Source)
    at sun.security.provider.KeyStoreDelegator.engineLoad(Unknown Source)
    at sun.security.provider.JavaKeyStore$DualFormatJKS.engineLoad(Unknown Source)
    at java.security.KeyStore.load(Unknown Source)
    at com.android.apksigner.ApkSignerTool$SignerParams.loadKeyStoreFromFile(ApkSignerTool.java:734)
    at com.android.apksigner.ApkSignerTool$SignerParams.loadPrivateKeyAndCertsFromKeyStore(ApkSignerTool.java:636)
    at com.android.apksigner.ApkSignerTool$SignerParams.loadPrivateKeyAndCerts(ApkSignerTool.java:580)
    at com.android.apksigner.ApkSignerTool$SignerParams.access$200(ApkSignerTool.java:534)
    at com.android.apksigner.ApkSignerTool.sign(ApkSignerTool.java:229)
    at com.android.apksigner.ApkSignerTool.main(ApkSignerTool.java:87)
    Caused by: java.security.UnrecoverableKeyException: Password verification failed
    ... 11 more
    ]
    stdout[

    ]
    exit code: 2
    UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
    UnityEditor.Android.PostProcessor.Tasks.TasksCommon.Exec (System.String command, System.String args, System.String workingdir, System.String errorMsg, Int32 retriesOnFailure)
    UnityEditor.HostView:OnGUI()


    ---


    UnityEditor.BuildPlayerWindow+BuildMethodException: Build failed with errors.
    at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) [0x001b9] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:162
    at UnityEditor.BuildPlayerWindow.CallBuildMethods (Boolean askForBuildLocation, BuildOptions defaultBuildOptions) [0x00050] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:83
    UnityEditor.HostView:OnGUI()
     
    Last edited: Jul 17, 2017
  15. gamepower7

    gamepower7

    Joined:
    May 16, 2017
    Posts:
    27
    after some test , i found that if i signed apk with keystore with long password , this error happed ,
    if the password was simple , no error found

    create keystore with this password -> got error

    HZjW3D_Nz7ClF$~lJfU$fSUuH\adGR
    q!E"?*0nrvV'/mA#Bn3l0|_W=$eFxk


    create keystore with this password -> worked
    Pass@Word123
    Pass@word123

    can any one confirm ?

    bug

    CommandInvokationFailure: Failed to sign APK package.
    D:\Android\sdk\build-tools\25.0.3\apksigner.bat sign --ks "D:/user.keystore" --ks-pass pass:"HZjW3D_Nz7ClF$~lJfU$fSUuH\adGR" --ks-key-alias "meme" --key-pass pass:"q!E"?*0nrvV'/mA#Bn3l0|_W=$eFxk" "C:\Users\h.safa\Source\Workspaces\BagoonV5\BagoonV5\Temp/StagingArea/Package.apk"

    stderr[
    '_W' is not recognized as an internal or external command,
    operable program or batch file.
    ]
    stdout[

    ]
    exit code: 255
    UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
    UnityEditor.Android.PostProcessor.Tasks.TasksCommon.Exec (System.String command, System.String args, System.String workingdir, System.String errorMsg, Int32 retriesOnFailure)
    UnityEditor.HostView:OnGUI()
     
    Bralgs likes this.
  16. hero87

    hero87

    Joined:
    Dec 12, 2016
    Posts:
    3
    same that happen with me plz any help
     
  17. KyleHatch85

    KyleHatch85

    Joined:
    Dec 13, 2011
    Posts:
    99
    I can confirm that the build tool 26.0.1 fixes the issue.
     
    Last edited: Jul 26, 2017
  18. guneyozsan

    guneyozsan

    Joined:
    Feb 1, 2012
    Posts:
    99
    Unfortunately still having the issue with 2017.1.0f3 + 26.0.1, 25.0.0, 25.0.2, 25.0.3.
    Copying apksigners didn't work either.
     
  19. guneyozsan

    guneyozsan

    Joined:
    Feb 1, 2012
    Posts:
    99
    If I build the same project with 2017.2.0b4 this time I get two errors that are different from the ones mentioned above.

    Maybe it helps, the project is VR enabled and uses Google VR 1.60.

    ---------------------------------------
    Error: Duplicate file(s) in apk: 'D:\PROJECT_PATH\Temp\StagingArea\android-libraries\gvr\libs'

    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)
    ----------------------------------------
    CommandInvokationFailure: Failed to build apk.
    C:/Program Files/Java/jdk1.8.0_131\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="C:/Users/Guney/AppData/Local/Android/sdk\tools" -Dfile.encoding=UTF8 -jar "C:\Program Files\Unity 2017.2.0b4\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" -

    stderr[
    Error: Duplicate file(s) in apk: 'D:\PROJECT_PATH\Temp\StagingArea\android-libraries\gvr\libs'
    ]
    stdout[

    ]
    exit code: 255
    UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
    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)
    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)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)
     
  20. guneyozsan

    guneyozsan

    Joined:
    Feb 1, 2012
    Posts:
    99
    Thanks a lot @gamepower7. You saved our release which was almost stuck dead end:)

    New Android build tools and Unity beta didn't work but removing the special characters from both the keystore and key store resolved the issue.
     
    gamepower7 likes this.
  21. Parikollo

    Parikollo

    Joined:
    Oct 5, 2016
    Posts:
    1
  22. BeardedSynergy

    BeardedSynergy

    Joined:
    Jul 29, 2017
    Posts:
    1
    This fixed mine I had alpha numeric with symbals and it would not build. Built new key with less complex password and it build fine
     
    Tiebo, Bralgs and gamepower7 like this.
  23. mustafatokat

    mustafatokat

    Joined:
    Jul 30, 2017
    Posts:
    6
    Hi,

    I'm working on an augmented reality project with a GPS base. I get the error later. Can you help me...

    UnityEditor.BuildPlayerWindow + BuildMethodException: Yapı hatalarla başarısız oldu.
    UnityEditor.BuildPlayerWindow + DefaultBuildMethods.BuildPlayer'da (BuildPlayerOptions seçenekleri) [0x001b9] C: \ buildslave \ birlik \ yapı \ Düzenleyici \ Mono \ BuildPlayerWindowBuildMethods.cs: 162
    UnityEditor.BuildPlayerWindow.CallBuildMethods (Boolean askForBuildLocation, BuildOptions defaultBuildOptions) [0x00050] C de: \ buildslave birlik \ oluşturmak \ Editör \ Mono \ BuildPlayerWindowBuildMethods.cs \: 83
    UnityEditor.HostView: OnGUI ()
     
    Last edited: Jul 30, 2017
  24. mustafatokat

    mustafatokat

    Joined:
    Jul 30, 2017
    Posts:
    6
  25. jonathan84clark

    jonathan84clark

    Joined:
    Aug 29, 2015
    Posts:
    4
    The solution of updating the Tools folder did not solve my problem ether. I am having the same issue. Please take a look at the error message:

    CommandInvokationFailure: Failed to sign APK package.
    C:\Users\Jonathan\AppData\Local\Android\sdk2\build-tools\25.0.3\apksigner.bat sign --ks

    Notice how the folder that the error is happening in is from "build-tools" not "Tools." Updating the "Tools" folder is not a valid solution to the problem because it is not affecting the correct folder.

    I have tried the following:
    1. Update the tools folder
    2. Installing the latest version of Android Studio
    3. Changed the key password to something simple (this actually worked but does me no good if I want to update existing apps)

    I think what I need to do is update build-tools\25.0.3 to build-tools\26.0.1 but I can't figure out how to do that. There is no download for build-tools\26.01 so I am stuck since Android Studio doesn't come with it.

    I really don't want to have to ditch all my apps that I already have on the play store. Any ideas?
     
  26. NinjaCat

    NinjaCat

    R&D Minion

    Joined:
    Aug 22, 2013
    Posts:
    69
    If you're using Android Studio, open up the SDK manager, under "Tools > Android > SDK Manager". Select the SDK Tools tab. Make sure you've got "Android SDK Build-Tools". You can also see the versions you have by trying to uninstall it, so make sure you've got 26.0.1.
     
    jonathan84clark likes this.
  27. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    341
    I still can't build the APK's.

    I got the 26.0.1 and Unity 2017.1.0p2



    But I get this error:



    My Unity Preferences:



    And the SDK folder content:



    My log says:

    Code (csharp):
    1.  
    2. Error:Invalid command android
    3.  
    4. UnityEditor.HostView:OnGUI()
    Code (csharp):
    1. CommandInvokationFailure: Unable to list target platforms. Please make sure the android sdk path is correct. See the Console for more details.
    2. C:/Program Files/Java/jdk1.8.0_112\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="C:/Users/Pao/AppData/Local/Android/sdk\tools" -Dfile.encoding=UTF8 -jar "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" -
    3.  
    4. stderr[
    5. Error:Invalid command android
    6. ]
    7. stdout[
    8.  
    9. ]
    10. exit code: 64
    11. UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
    12. 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)
    13. 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)
    14. UnityEditor.HostView:OnGUI()
    Code (csharp):
    1.  
    2. Error building Player: CommandInvokationFailure: Unable to list target platforms. Please make sure the android sdk path is correct. See the Console for more details.
    3. C:/Program Files/Java/jdk1.8.0_112\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="C:/Users/Pao/AppData/Local/Android/sdk\tools" -Dfile.encoding=UTF8 -jar "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" -
    4.  
    5. stderr[
    6. Error:Invalid command android
    7. ]
    8. stdout[
    9.  
    10. ]
    11. exit code: 64
    Code (csharp):
    1.  
    2. UnityEditor.BuildPlayerWindow+BuildMethodException: Build failed with errors.
    3.   at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) [0x001b9] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:162
    4.   at UnityEditor.BuildPlayerWindow.CallBuildMethods (Boolean askForBuildLocation, BuildOptions defaultBuildOptions) [0x00050] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:83
    5. UnityEditor.HostView:OnGUI()
    What can I do?
     
  28. jonathan84clark

    jonathan84clark

    Joined:
    Aug 29, 2015
    Posts:
    4
    Thanks for the help. This was part of the solution. I also had to change the build system to Gradle.
     
  29. NinjaCat

    NinjaCat

    R&D Minion

    Joined:
    Aug 22, 2013
    Posts:
    69
    Hi, @Nadan !

    The error you're getting is related to the 'tools' folder that comes from 'Android SDK Tools'. There has been a similar issues in the past: https://issuetracker.unity3d.com/is...-android-sdk-tools-25-dot-3-1-version-is-used

    This is not the same issue the author of this thread is having.

    However, according to your screenshots, you've got the latest version of the android sdk tools installed already (which shouldn't have the problem). Not sure why it's still happening, but I'd recommend uninstalling and reinstalling the 'Android SDK Tools'.

    @jonathan84clark - building with the internal build system should work - did it still fail with internal? If so, what was the error?
     
  30. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    341
    Hi, I installed latest Unity, Android Studio and Java Platform from clean slate to my other PC and made new test project with just text and one scene. Still same error "Unable to list target platforms". I also tried replace the tools folder like in the link you mentioned. I have Windows 7 in both machines. I quess I just have to wait for new versions and hope it will work later. I've never had this problem before.
     
  31. necrodarks

    necrodarks

    Joined:
    Mar 4, 2015
    Posts:
    1
    Hi I got the same error I did everything on this page and still not working. I saw pages of this bug since July 12. They taking to long.

    UnityEditor.BuildPlayerWindow+BuildMethodException: Build failed with errors.
    at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) [0x001b9] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:162
    at UnityEditor.BuildPlayerWindow.CallBuildMethods (Boolean askForBuildLocation, BuildOptions defaultBuildOptions) [0x00050] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:83
    UnityEditor.HostView:OnGUI()
     
  32. NinjaCat

    NinjaCat

    R&D Minion

    Joined:
    Aug 22, 2013
    Posts:
    69
    Could you please send us a bug report? (A screenshot with the contents of the tools folder "C:/Users/Pao/AppData/Local/Android/sdk\tools" could also be beneficial.
     
  33. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    341
    To my great surprise I got build working with the second PC where I installed everything from scratch. I think it just needed one restart from the PC after everything was installed and because of that it worked when I tried other day.

    But my main PC that I use to make games is still not working. At least now I know that the problems is in my end and I can compare folders, settings etc. from the other PC that works. I'm now trying to remove Unity, Java and Android Studio completely and reinstall everyting altough I tried it already once.

    Anyway, now I can build games with the "working PC", I also have Mac (mainly used for my iOS builds) that would have been one option too. So I think I'll manage on my own here. Thank you.
     
  34. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    @Nadan my guess is that your Tools version is outdated or corrupted - try removing it and installing the latest in Android Studio SDK Manager. The whole naming is a bit confusing - Tools vs. Build Tools.

    On the complex password issue - we are looking into it, fix will be coming soon.
     
  35. gamepower7

    gamepower7

    Joined:
    May 16, 2017
    Posts:
    27
    Hi all ,
    i found another solution , by changing the build system from "internal Default " to "Gradle new " , the complex password worked , but we stuck with the "Gradle" manifest conflict with google and Facebook packages

    regards
     
  36. gamepower7

    gamepower7

    Joined:
    May 16, 2017
    Posts:
    27
    if you which to use complex password , you could try changing the build system from internal to Gridle , the sign wont complain but there are some issues to fix when changing to the new build system , regarding manifest
     
  37. Joheil

    Joheil

    Joined:
    Jul 27, 2014
    Posts:
    1
    Hi all,
    I'm using Unity 2017.1.0f3 and I have tried to sign my APK using the keystore generated when I created the project in Unity 5.5.0 but it fails (the passwords are correct), but if I create a new keystore using Unity 2017.0.1f3 and I use the same passwords for the keystore password and the alias password it works! This is a bit weird but I hope this issue can be fixed and we can use keystores generated with previous Unity versions.
     
    ilmario and chuck666 like this.
  38. NinjaCat

    NinjaCat

    R&D Minion

    Joined:
    Aug 22, 2013
    Posts:
    69
    We're addressing the complex password issues.

    @Joheil I've tried to recreate your issue locally, but I was not able to do so. Does this happen with any alias/password or only in some specific cases? Could you please send us a bug report?
     
  39. marcV2g

    marcV2g

    Joined:
    Jan 11, 2016
    Posts:
    115
    How do you resolve this issue on cloudbuild?
     
  40. bluebeardit

    bluebeardit

    Joined:
    Jun 13, 2017
    Posts:
    10
    That did it for me also... thx
     
  41. arun_shikhar

    arun_shikhar

    Joined:
    Apr 23, 2017
    Posts:
    1
    Hello,

    I am facing the same issue upgrading build tools to 26.0.1 didn't solve the problem for me, I also tried using 25.0.1, 25.0.2, 25.0.3 and 26.0.0 None of them seems to work for me. I am using Unity version 2017.1.0p2.

    I am using simple password as stated above, also were working fine with Unity version 5.6.1. I have been stuck on the issue from last 2 weeks. Can someone help me in this?

    Thanks,
     
    chuck666 likes this.
  42. daotuanvp

    daotuanvp

    Joined:
    Aug 20, 2017
    Posts:
    3
    Hello john
    I am using unity 2017.1.0f3 and i have same same error when i build to apk, my windown is win7 64 bit, please fix error for me.
    Please check picture i upload @@

    Thanks,

    John
     

    Attached Files:

  43. tyroro

    tyroro

    Joined:
    Jan 10, 2014
    Posts:
    3
    I'm using unity 2017.1.03f , I alway got build failed in sign apk with wrong password error
    as gunpower7 mention change keystore password is help
    with
    "keytool -storepasswd -keystore my.keystore"

    ex. my old password aabb^1122
    to aabb1122 it work!
     
  44. stalker_shin

    stalker_shin

    Joined:
    Jun 25, 2016
    Posts:
    17
    Hi guys, I had the same issue on Unity 2017.1.0f3.
    I updated my Android SDK Build-tools from 23.0.3 to revision 26 and it didn't work.

    Then I read this thread mentioning that rev 26 didn't include the apksigner and updated this to 26.0.1.
    After rebooting unity it finally worked!

    Thanks for the help.
     
  45. jdscogin

    jdscogin

    Joined:
    Oct 26, 2014
    Posts:
    88
    Thanks for this thread. I had been banging my head, trying to figure this out. Getting the new SDK 26.1 worked. Now I can update my game on Play Store.
     
    ilmario likes this.
  46. gas_katou

    gas_katou

    Joined:
    Jul 31, 2017
    Posts:
    1
    An error occurred when the keystore password contained%, but no error occurred in the case of a keystore that does not contain%, apk could be created.
     
  47. dustinkerstein

    dustinkerstein

    Joined:
    Jan 26, 2017
    Posts:
    16
    Has anyone found any solution to this that doesn't require switching to the Gradle build system when using complex passwords? The Gradle workaround doesn't work for me due to errors with my Firebase installation.

    [Update] - I was able to resolve the above issue with the Gradle build system by manually removing the duplicate fields in the Firebase google-services.json file.
     
    Last edited: Sep 12, 2017
  48. chuck666

    chuck666

    Joined:
    Sep 29, 2016
    Posts:
    6
    The Problem still exists! Not only with complex Passwords.

    Using Unity 2017.1.1f1 on Windows 10.

    Tried all above solutions with no success:
    Tried to reinstalling everything (several times with several Unity Versions) with no success.
    Tried update and downgrade to several build-tools and jdk versions with no success.
    Tried replacing tools folder with older/newer ones with no success.

    I'm not using any complex password! Also tried with gradle build (without and with proguard) NO SUCCESS!
    Tried export Android Studio Project -> corrupt!

    Please I need a Fix ASAP.

    Errors:

    Code (CSharp):
    1. CommandInvokationFailure: Unable to list target platforms. Please make sure the android sdk path is correct. See the Console for more details.
    2. C:/Program Files/Java/jdk1.8.0_131\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="C:/Users/MrX/AppData/Local/Android/sdk\tools" -Dfile.encoding=UTF8 -jar "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" -
    3.  
    4. stderr[
    5. Error:Invalid command android
    6. ]
    7. stdout[
    8.  
    9. ]
    10. exit code: 64
    11. UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
    12. 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)
    13. 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)
    14. UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()
    15.  
    16.  
    17. Error building Player: CommandInvokationFailure: Unable to list target platforms. Please make sure the android sdk path is correct. See the Console for more details.
    18. C:/Program Files/Java/jdk1.8.0_131\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="C:/Users/MrX/AppData/Local/Android/sdk\tools" -Dfile.encoding=UTF8 -jar "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" -
    19.  
    20. stderr[
    21. Error:Invalid command android
    22. ]
    23. stdout[
    24.  
    25. ]
    26. exit code: 64
    27.  
    28.  
    29. UnityEditor.BuildPlayerWindow+BuildMethodException: Build failed with errors.
    30.   at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) [0x001b9] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:162
    31.   at UnityEditor.BuildPlayerWindow.CallBuildMethods (Boolean askForBuildLocation, BuildOptions defaultBuildOptions) [0x00050] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:83
    32. UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()
    When using your suggested tools version 25.2.3 or 25.2.5 (with build-tools 26.0.1 as well as with 26.0.2) this occures:

    Code (CSharp):
    1.  
    2.  
    3. UnityEditor.BuildPlayerWindow+BuildMethodException: Build failed with errors.
    4.   at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) [0x001b9] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:162
    5.   at UnityEditor.BuildPlayerWindow.CallBuildMethods (Boolean askForBuildLocation, BuildOptions defaultBuildOptions) [0x00050] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:83
    6. UnityEditor.HostView:OnGUI()
    7.  
    8. CommandInvokationFailure: Failed to sign APK package.
    9. C:\Users\MrX\AppData\Local\Android\sdk\build-tools\26.0.2\apksigner.bat sign --ks "C:/Users/MrX/Documents/MEGA/Projects/UnityProjects/xxxx_Keystore/xxxx_keystore.keystore" --ks-pass pass:"android" --ks-key-alias "xxxx" --key-pass pass:"android" "C:\Users\MrX\Documents\MEGA\Projects\UnityProjects\xxxxxxx\xxxxxxx\Temp/StagingArea/Package.apk"
    10.  
    11. stderr[
    12. Failed to load signer "signer #1"
    13. java.io.IOException: Failed to obtain key with alias "xxxxx" from C:/Users/MrX/Documents/MEGA/Projects/UnityProjectsxxxxxx_Keystore/xxxx_keystore.keystore. Wrong password?
    14.     at com.android.apksigner.ApkSignerTool$SignerParams.loadPrivateKeyAndCertsFromKeyStore(ApkSignerTool.java:799)
    15.     at com.android.apksigner.ApkSignerTool$SignerParams.loadPrivateKeyAndCerts(ApkSignerTool.java:659)
    16.     at com.android.apksigner.ApkSignerTool$SignerParams.access$500(ApkSignerTool.java:611)
    17.     at com.android.apksigner.ApkSignerTool.sign(ApkSignerTool.java:266)
    18.     at com.android.apksigner.ApkSignerTool.main(ApkSignerTool.java:89)
    19. Caused by: java.security.UnrecoverableKeyException: Cannot recover key
    20.     at sun.security.provider.KeyProtector.recover(Unknown Source)
    21.     at sun.security.provider.JavaKeyStore.engineGetKey(Unknown Source)
    22.     at sun.security.provider.JavaKeyStore$JKS.engineGetKey(Unknown Source)
    23.     at sun.security.provider.KeyStoreDelegator.engineGetKey(Unknown Source)
    24.     at sun.security.provider.JavaKeyStore$DualFormatJKS.engineGetKey(Unknown Source)
    25.     at java.security.KeyStore.getKey(Unknown Source)
    26.     at com.android.apksigner.ApkSignerTool$SignerParams.getKeyStoreKey(ApkSignerTool.java:851)
    27.     at com.android.apksigner.ApkSignerTool$SignerParams.loadPrivateKeyAndCertsFromKeyStore(ApkSignerTool.java:770)
    28.     ... 4 more
    29. ]
    30. stdout[
    31.  
    32. ]
    33. exit code: 2
    34. UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
    35. UnityEditor.Android.PostProcessor.Tasks.TasksCommon.Exec (System.String command, System.String args, System.String workingdir, System.String errorMsg)
    36. UnityEditor.Android.PostProcessor.Tasks.BuildAPK.SignPackage (UnityEditor.Android.PostProcessor.PostProcessorContext context)
    37. UnityEditor.Android.PostProcessor.Tasks.BuildAPK.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context)
    38. UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context)
    39. UnityEditor.HostView:OnGUI()
    Below you'll find the tools folder.

    For further Information, pls conact me.
     

    Attached Files:

    Last edited: Sep 26, 2017
    Exustus likes this.
  49. daxiongmao

    daxiongmao

    Joined:
    Feb 2, 2016
    Posts:
    412
    Today I went through the same problems. Tried both 2017 versions. Tried lots of tools versions the only thing that let me build was installing the mentioned 25.3 download. I was getting the unable to find target platforms error.

    I didn't try it and just thought of it now. Could it have anything to do with just selecting arm vs x86 and arm together?
    Is that the same platforms the error might be referring too?
     
  50. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
    Please use latest android sdk tools and latest Unity version (within you target major version).