Search Unity

Apk won't build and run

Discussion in 'Android' started by caleb_chaos, Jun 1, 2015.

  1. caleb_chaos

    caleb_chaos

    Joined:
    Jun 1, 2015
    Posts:
    12


    I know this problem has occurred many times before, but all of the solutions that I have come across aren't working and i've just about lost hope. I've installed all of the necessities which seem to be working perfectly fine. I can even connect to Unity Remote, yet when I attempt to build and run it, it goes through the process then ends with an odd sound that im assuming either means completed or an error. There are however no error messages and my .apk file has not been built onto my android device.
     
    Last edited: Jun 1, 2015
  2. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    No error in the console? (window->console or Ctrl+Shift+C).

    Failing that check the Editor Log (Open Editor Log from the Console window).
     
  3. MD_Reptile

    MD_Reptile

    Joined:
    Jan 19, 2012
    Posts:
    2,664
    Instead of doing build and run (I'm assuming) try doing just build - then copy the apk over to your device and install there using a file explorer. If that doesn't work, perhaps you don't have everything you need in the ADK?
     
  4. caleb_chaos

    caleb_chaos

    Joined:
    Jun 1, 2015
    Posts:
    12
    No errors whatsoever :\ So that can't be the issue :(

    I have tried that as well, but it does the same thing while trying to build the .apk file. and I i've tried reinstalling everything as well. The problem still occurs though :\
     
  5. MD_Reptile

    MD_Reptile

    Joined:
    Jan 19, 2012
    Posts:
    2,664
    If it fails to build the APK file it should almost certainly display some kind of error message. Are you sure your android SDK is set up to have all the necessary packages? And your java install seems to be ok? I have had lots of problems before which ended up being just an issue with the android sdk or the java installation. Those are the two biggest problem causes, but if those seem to be fine, you should check your build settings, and make sure your building to the right platform version, and that no other settings seem strange in there.
     
    Samarth05 and caleb_chaos like this.
  6. caleb_chaos

    caleb_chaos

    Joined:
    Jun 1, 2015
    Posts:
    12
    There are definitely no error messages which is really confusing me. It just makes a sound after its done building with no error messages displayed and nothing built :\ I'm currently trying to reinstall everything to see if that is the issue, but I really doubt it because everything had been installed that needed to be installed. Both the JDK and ADK directories are both properly linked to Unity3d, Unity remote works well, and no errors are displayed. Everything in the build and run settings are set up correctly as well. I'm so perplexed at the moment.
     
    angganaro3 likes this.
  7. MD_Reptile

    MD_Reptile

    Joined:
    Jan 19, 2012
    Posts:
    2,664
    Well, just to make sure, whatever you named the file (the APK file) - do you see it in windows explorer when you go to where it should have built the APK to? Or is there just nothing there?
     
    tom99ato and caleb_chaos like this.
  8. Jarbi-James

    Jarbi-James

    Joined:
    Jun 15, 2013
    Posts:
    54
    I had a similar problem the other day. Fixed it by opening Android Studio and building the Hello World example to my phone, it seemed to 'kick start' my phones connection although it was already being read as connected. It could have been a coincidence or completely random but thought it was worth mentioning!

    Make sure you have re-named the Bundle Identifier to match the Company Name and Project Name. Pretty sure this comes up as an error though.

    Also did you open the SDK Manager and install the update packages?
     
    caleb_chaos likes this.
  9. caleb_chaos

    caleb_chaos

    Joined:
    Jun 1, 2015
    Posts:
    12
    I've linked a video at the top as to what happens. I checked my windows explorer and there does happen to be the Test.apk file, but I don't think its the correct one. I try dragging it to my device and nothing is put on to there.
     
  10. MD_Reptile

    MD_Reptile

    Joined:
    Jan 19, 2012
    Posts:
    2,664
    Hmmm strange. I couldn't say what's going wrong but if you haven't already, create a blank project, switch to android, change package name, then try building out with everything else default. Also what device are you testing on?
     
    caleb_chaos likes this.
  11. caleb_chaos

    caleb_chaos

    Joined:
    Jun 1, 2015
    Posts:
    12
    http://postimg.org/image/grxr7v28z/
    http://postimg.org/image/lbyfn7ed3/
    http://postimg.org/image/lbz7f8rrz/

    Here are images of me trying to setup in Android Studio. This is confusing to me as well...but perhaps this proves that I may be missing something seeing as there are rendering issues?
     
  12. MD_Reptile

    MD_Reptile

    Joined:
    Jan 19, 2012
    Posts:
    2,664
    I never use android studio so I can't help on that front - but in the SDK Manager you should check which packages you've downloaded and installed, because that always gets me messed up when I reinstall windows or get a new pc.

    And incase you missed it:

     
    caleb_chaos likes this.
  13. caleb_chaos

    caleb_chaos

    Joined:
    Jun 1, 2015
    Posts:
    12
    Hey thank you for mentioning this. Im currently trying to see if I can find the source of the problem is Android Studio now. Perhaps you could take a look at the images and see if you notice anything peculiar that might be the issue?
     
  14. caleb_chaos

    caleb_chaos

    Joined:
    Jun 1, 2015
    Posts:
    12

    http://postimg.org/image/ncitaf9l9/
    http://postimg.org/image/f1y5kgysn/

    Heres what I have installed from the SDK manager...I'm pretty sure I have everything that is needed if not more?
     
  15. MD_Reptile

    MD_Reptile

    Joined:
    Jan 19, 2012
    Posts:
    2,664
    Yeah you've got more than enough it looks like (I think lol) so let's rule that out.

    Now give a shot at an empty project, and see if it let's you build an apk - and if it does, try to copy it over to your device and try to install. Of course that will just be a blank screen, but if it works were getting somewhere!
     
  16. caleb_chaos

    caleb_chaos

    Joined:
    Jun 1, 2015
    Posts:
    12
    Haha, Unfortunately the same exact issue is occurring. :confused:
     
  17. Jarbi-James

    Jarbi-James

    Joined:
    Jun 15, 2013
    Posts:
    54
    I haven't really used Android Studio for anything other than testing the phones connection so I may not be the best person to ask! I don't recognize the errors but it does look like your phone is being picked up. Did the Hello World example from Android Studio build to your phone?

    https://developer.android.com/tools/building/building-studio.html

    Here's a link to getting Android Studio set up properly and building to your device. But like I said it's just a suggestion, it could have nothing to do with why Unity is not building the APK. It won't be Android Studio that is directly messing it up for Unity but it may help you source the problem......maybe?! o_O
     
  18. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    If you can't build the APK then it has nothing to do with a device being connected or not.

    Only running and deploying to the device would fail in that case.

    Unity can build the APK without any device connected.
     
    angganaro3 likes this.
  19. caleb_chaos

    caleb_chaos

    Joined:
    Jun 1, 2015
    Posts:
    12
    True....Then what could it possibly be then? I just don't understand what the issue is.
     
  20. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    Have you followed the steps here: http://docs.unity3d.com/Manual/android-sdksetup.html

    Specifically make sure you have (quote, with emphasis mine):

    Follow the instructions under Installing the SDK (although you can freely skip the optional parts relating to Eclipse). In step 4 of Installing the SDK be sure to add at least one Android platform with API level equal to or higher than 9 (Platform 2.3 or greater), the Platform Tools, and the USB drivers if you’re using Windows.
     
  21. or113

    or113

    Joined:
    Nov 5, 2016
    Posts:
    41
    Have you ever solved this issue ?
     
  22. Trys10Studios

    Trys10Studios

    Joined:
    Jun 24, 2013
    Posts:
    45
  23. dineshsirvee31

    dineshsirvee31

    Joined:
    Dec 16, 2017
    Posts:
    1
    I got Solution, See ScreenShot the highlighted options are not checked before<after checking options my game run sucessfully> Capture.JPG
     
  24. behindname

    behindname

    Joined:
    Mar 21, 2018
    Posts:
    1
    Have you Solved this problem? I'm facing the same problem, but tutorial project in Unity or HelloWorld Project in Android Studio works fine. So I'm guessing that this app crash is casing by the memory exceed problem.
     
  25. ireth_86

    ireth_86

    Joined:
    May 18, 2016
    Posts:
    23
    I was experiencing this behaviour too, and I found out that I already had the same application on my mobile, but it was signed with another certificate. Maybe it was the problem. I uninstalled the application from the phone, and then the Build and run worked correctly.
     
  26. med9bob

    med9bob

    Joined:
    Jan 21, 2019
    Posts:
    1
    I don't know if you solved the problem or not I'm posting just in case if someone else had the same probleme in the future and came here for an answer .
    I solved the same exact problem by correcting all my compilator errors .
    so the basic cause for this probleme is having a script (open or not) in your project with copilator errors so you have to search for errors in every script in the project or check out the consol (ctrl+maj+c) if you are not desplaying the errors check on the red button in the right of the consol to display the errors
     
  27. FyodorKrasniy

    FyodorKrasniy

    Joined:
    Jul 9, 2019
    Posts:
    2
    My issue was a faulty cable of all things.. The thing would charge the phone but nothing would connect. So theres also that.
     
  28. Mint7563

    Mint7563

    Joined:
    Apr 15, 2020
    Posts:
    3
    IU am having the same issure, I tried the devleopment build thing, didnt work. But it isnt even saying its building, no box no nothing.
     
  29. Mint7563

    Mint7563

    Joined:
    Apr 15, 2020
    Posts:
    3
    I got a solution, you go bck to build settings, for some reason, it checks off your SDK for the build, so just recheck that, and set you minimum API level.
     
  30. Mint7563

    Mint7563

    Joined:
    Apr 15, 2020
    Posts:
    3
    nvm doesnt work
     
  31. spuchals

    spuchals

    Joined:
    Sep 29, 2018
    Posts:
    8
    If anyone still has the issue, changing the Package name in Player settings > Other settings fixed it for me.
    Weird issue, updated Windows in between, maybe some dir got lost on the way.
     
    jethrogillgren likes this.
  32. lovenshij

    lovenshij

    Joined:
    Apr 23, 2022
    Posts:
    2
    I'm facing same problem, if you got solution please share
     
  33. faizpatel81528

    faizpatel81528

    Joined:
    Dec 10, 2022
    Posts:
    14
    How?
    In my case it says Android Environment not found if I dont plug in the phone.
     
  34. Piyush_Khanduri

    Piyush_Khanduri

    Joined:
    Jan 28, 2023
    Posts:
    1
    I am facing this error and I really cannot solve it I have to solve it as fast possible please help me.
     

    Attached Files:

  35. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,905
    Please attach Editor.log
     
  36. NamelessDeveloper777

    NamelessDeveloper777

    Joined:
    May 9, 2021
    Posts:
    10
    whenever I tried to build apk then instead of getting pop up for saving apk with name i got this pop up which wont let me write any name it just let me select path and thats it

    and when i build apk like that it says installer package not exist upon installing in real device

    do anyone have idea about this
    please let me know Screenshot (21).png
     
  37. Celdur

    Celdur

    Joined:
    Apr 6, 2013
    Posts:
    1
    This was basically what helped me. I removed the game and installed the test version I had from Google Play. Funny thing, it did not install the release version from the Play store, but it enabled the debug version I had tried to install through Unity.