Search Unity

Can no longer get Unity to Build for android

Discussion in 'Android' started by Thalv, Dec 30, 2017.

  1. Thalv

    Thalv

    Joined:
    May 18, 2016
    Posts:
    23
    I am having a major issue on my main machine after upgrading. I can no longer get Unity to build for android apps. I know the SDK and file paths are correct. I even replaced the tools folder in the Android SDK section as suggested after the upgrade. I am at a loss now and about to start using another editor all together.

    upload_2017-12-30_0-9-24.png
     

    Attached Files:

    Lev095 and shacharoz like this.
  2. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    From the screenshot it looks like you're using JDK 9. My suggestion is to try and set Unity to use JDK 8 and see if that works.
     
    Lev095 and Ryiah like this.
  3. Thalv

    Thalv

    Joined:
    May 18, 2016
    Posts:
    23
    I switched back to 8 and now get the following error:

    upload_2017-12-30_10-59-24.png
    upload_2017-12-30_11-0-34.png
     
    shacharoz likes this.
  4. Thalv

    Thalv

    Joined:
    May 18, 2016
    Posts:
    23
    I think I found the solution:


    upload_2017-12-30_11-24-27.png
     
  5. Thalv

    Thalv

    Joined:
    May 18, 2016
    Posts:
    23
    upload_2017-12-30_11-27-24.png
     

    Attached Files:

  6. Thalv

    Thalv

    Joined:
    May 18, 2016
    Posts:
    23
    upload_2017-12-30_11-27-51.png
     
    OxDEADFACE likes this.
  7. Thalv

    Thalv

    Joined:
    May 18, 2016
    Posts:
    23
    I did get Unity working again for Android. I will say that 2017.# is absolute garbage. If your upgraded version can't do the fundamentals, then don't release it. Do you guys even test build functionality before releasing?

    Anyways, I installed 5.6.3f1 with JDK 8. I found an old download of Android studio I had from 2016. I copied that over to my new systems and installed it. *I had installed the new versions and replaced the Tools folder. That no longer works. I had to do the install of the old version from 2016*.

    With that setup, Unity is stable, so far...

    With JDK 8 and even with the old version of Android, in 2017.# I was getting an error about the gradle or it was telling me there was a Keystore error. 2017.# is, again, garbage. I now have a lot of rebuilding of my projects to do now.

    On a positive note, I did download Unreal 4 and started going through the scripting processes, and it seems rather nice. I need to get these next couple projects out with Unity, but I am seriously thinking about moving the rest of our content over to Unreal.
     
    rahulk1991 likes this.
  8. Thalv

    Thalv

    Joined:
    May 18, 2016
    Posts:
    23
    I also double checked and keystore with gradle works as well.
     
  9. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,205
    If Q&A were capable of finding every single problem before release there wouldn't need to be a public beta. Unfortunately it's completely normal for errors to only exist on a relatively few computers because there are limitless combinations of hardware and software. For that matter the solutions are going to be very similar.

    I'm downloading the necessary files to see if I can't replicate the problem on my end and see what my solution would be.

    By the way a quick search of the Unreal 4 forums reveals a similar problem for some people there too.
     
  10. Thalv

    Thalv

    Joined:
    May 18, 2016
    Posts:
    23

    These are build errors. They would have found them if they just hit the build button.
     
  11. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,205
    Build errors are dependent on certain criteria. Some people are able to meet that criteria by simply downgrading their JDK installation. If a mere downgrade is able to handle it for some people then it stands to reason the people who already had the correct JDK may have never seen the bug.
     
    Last edited: Dec 31, 2017
  12. Thalv

    Thalv

    Joined:
    May 18, 2016
    Posts:
    23
    Are you telling me that it reasons, that the development team used downgraded components to test an upgraded component?
     
  13. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,205
    Just because there is a JDK 9 doesn't mean JDK 8 is no longer current. Oracle is continuing to release new updates for it with the latest release happening the very same day as the latest release of JDK 9. It's not a downgrade when everyone is still using it. JDK 9 is brand new and unproven.

    This isn't the only situation where a problem occurs due to JDK 9. There have been others and at least one of them is waiting on a solution by Google.

    https://forum.unity.com/threads/java-9-jdk-9-support-by-unity-android.499354/

    By the way, be prepared for disappointment if you like using the latest releases, UE4 uses JDK 8 too. :p

    https://docs.unrealengine.com/latest/INT/Platforms/Android/GettingStarted/1/index.html
     
    Last edited: Dec 31, 2017
  14. Thalv

    Thalv

    Joined:
    May 18, 2016
    Posts:
    23
    Please show me any successful Android build with 2017. I haven't seen one, with any combination of jdk and sdk
     
  15. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,205
  16. shacharoz

    shacharoz

    Joined:
    Jul 11, 2013
    Posts:
    98
    hey there,
    i would like to support Thalv with his claims.
    i also experience many issues with this. and only after 2 days of work, i understand its not my fault...

    i also have downgraded to jdk 8, android studio 3.0.1, unity 2017.3f3, api tools installed 27.
    but unity seems to not finding my android sdk folder.

    can anyone help with this or should i reinstall 5.6 for a while?

    Ryiah , can you explain how did you install the software in order for this to work?
     
    Lev095 likes this.
  17. shacharoz

    shacharoz

    Joined:
    Jul 11, 2013
    Posts:
    98
    did Nvidia CodeWorks really worked for you?
     
  18. shacharoz

    shacharoz

    Joined:
    Jul 11, 2013
    Posts:
    98
    this is what i get


    upload_2017-12-31_13-27-25.png
     
  19. shacharoz

    shacharoz

    Joined:
    Jul 11, 2013
    Posts:
    98
    android sdk location:

    upload_2017-12-31_13-29-56.png


    jdk location:
     
  20. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    Ryiah likes this.
  21. shacharoz

    shacharoz

    Joined:
    Jul 11, 2013
    Posts:
    98
    thanks @liortal , PMed you
     
  22. shacharoz

    shacharoz

    Joined:
    Jul 11, 2013
    Posts:
    98
    OK, my problems were solved by fixing up the JAVA_HOME environment variable .

    i had it pointing to the JDK bin folder instead of the main JDK folder.

    @Thalv , please check if that is your issue as well. if you dont see it i can make you a screenshot.
    i am now building in unity 2017.3 with JDK8, with api 27.
     
    MyEngineer and Ryiah like this.
  23. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,205
    Just for the record the SDK Manager of Android Studio, which I used to download the appropriate API level, specifies the folder (and let's you customize it if you want) for the SDK. I simply fed that to Unity. I don't have an environment variable.

    SDKLocation.jpg

    Just in case anyone has never used Android Studio, you reach the SDK Manager by clicking Configure when it starts.

    SDKManager.jpg
     
    Last edited: Dec 31, 2017
    Lev095 and JuliusM like this.
  24. corporationpop

    corporationpop

    Joined:
    Nov 13, 2012
    Posts:
    4
    Make sure you update your platform-tools and sdk-tools in Android Studio, that fixed it for me.

    C
     
  25. Lev095

    Lev095

    Joined:
    Nov 1, 2017
    Posts:
    3
    Could not build it with "Gradle", but with "Internal". Many thanks to all, could solve my problems as well.

    Edit: No, Gradle works. The problem seems to be the compression.
     

    Attached Files:

    Last edited: Jan 29, 2018
  26. MortalMan

    MortalMan

    Joined:
    Nov 6, 2012
    Posts:
    25
    I'm having similar problems. I can't not compile for android. I installed all the newest SDK and platform files, and pointed Unity to the correct folder were the SDK files are located.

    These are the errors I get.



    https://postimg.org/image/lg9ci4a65/
     
  27. parsagachkar

    parsagachkar

    Joined:
    Feb 7, 2018
    Posts:
    1
    OK these steps fixed my issue
    • Double checked my Unity Preferences > External Tools > Android SDK, JDK & NDK They all point to correct location (JDK points to my JDK 8 installation)
    • Updated my Android build tools from android studio since i can't launch SDK Manger from SDK folder (I hate this issue!!)
    • Retry to build to see if the problem is solved?? (Nope)
    • Checked my JAVA_HOME it was pointing to my JDK 9 Installation! Changing it from JDK 9 to JDK 8 fixed my issue! Unity Needs a restart to work with new Variable
    Looks like unity 2018 does not care where is my JDK External Tools Preference is pointing at as long as iv'e set JAVA_HOME!
     
  28. dandmixer

    dandmixer

    Joined:
    Jun 12, 2018
    Posts:
    7
    Tried this, nothing changes, still get a long list of 'type or namespace' errors. In fact, I've tried many different things on the web and nothing works. Has anyone... at all... EVER gotten a unity program to even download to an Android device, much less actually work?!?!
     
  29. kuria_mwangi

    kuria_mwangi

    Joined:
    Apr 28, 2017
    Posts:
    1
    Hey Everyone.
    I found an easy fix for unity 2017.4.1
    just change sdk path to a shorter path name.
    or rather download any sdk pack and set it to a root directory of your HDD. select the downloaded sdk in preferences tab and let unity update the API
    NB - open the sdk/tools folder and run the android.bat file.
    it will open the update page.
    install
    sdk platform tools
    and android sdk build tools

    and your good to go
     
    Last edited: Oct 26, 2018
  30. Aidan-Wolf

    Aidan-Wolf

    Joined:
    Jan 6, 2014
    Posts:
    59
    This is again a problem in 2018.2.20f

    "Failed to find java version" when selecting jdk.

    Can't build for Android.
     
  31. CoreyH

    CoreyH

    Joined:
    Dec 12, 2015
    Posts:
    3
    The easiest way I found to fix this is just uncheck all the Android SDK "Use unity" location in Edit > Preferences, try and build the game, (It will fail) then recheck the boxes. Has worked everytime for me.