locked
Is it always such a struggle to get .Android projects building? RRS feed

  • Question

  • User294005 posted

    We are considering using Xamarin.Forms for our new mobile object but I can't even get the sample apps to build.

    I'm using a completely fresh install, and the only solution to the errors that I can find:

    • Delete all from C:\Users\AppData\Local\xamarin and rebuild
    • Close visual studio and rebuild
    • Redownload xyz
    • Check target, compile etc match (they do)

    And various combinations of the steps above none of which are quick. Especially since our internet connection is not warp speed. It's coming close to 3 days now and my question is - is this an abnormal amount of struggling? Because at this point I'm about to give up on Xamarin for good.

    Tuesday, January 31, 2017 10:21 AM

All replies

  • User76049 posted

    @NicolevonLorne

    Not in my experience. Android is usually the least painful to get up and running.

    It's worth checking the Android SDK manager to ensure you have the latest updates and the latest SDK, You should be building against Android 7.0.

    try the following:

    • Create a black PCL app (from the cross platform option)
    • Use package manage to get the latest version of Forms (Forms only, do not update the Android dependencies)
    • Clean the solution
    • Rebuild the PCL (it should build fine)
    • Try deploying to a sim or a physical device

    I've copied in one of Xamarin team, maybe they'll be able to assist further but I wouldn't give up yet :smile:

    @JohnMiller

    Tuesday, January 31, 2017 11:09 AM
  • User180523 posted

    @NMackay Is right. The Android platform is always the 'baseline' platform I tell people to develop in because its generally the LEAST troublesome. Then when the time comes you can adjust a bit to the left for iOS and a bit to the right for UWP.

    I do a walk-thru of getting set up along these lines on my blog. Maybe it can help. www.RedPillXamarin.com

    Tuesday, January 31, 2017 11:41 AM
  • User294005 posted

    Thanks @NMackay and @ClintStLaurent that gives me some hope. It is exactly why I chose Android to start. Now if I could just actually get to some development it would be great.

    Action: New project - Cross platform -> Blank App (I actually tried all base app options)

    • I have Android 7.0 SDK installed
    • Xamarin.Forms version 2.3.3.180 (latest stable at time of post) no need to upgrade
    • Compile using: latest platform(Android 7.9)
    • Min: android 4.0.3 (SDK is installed)
    • Target: Use Compile using SDK version

    Action: Build solution

    Result: various - error XA5207: Please install package: 'Xamarin.Android.Support.v4' available in SDK installer

    Now I have Googled, I have deleted everything in the Xamarin appdata folder I have manually downloaded zips from somewhere (I seem to have closed the tab again). I have reinstalled Xamarin. I have cleaned and built and again. Any other ideas??

    Edit to add: I'm going to start working through the RedPill series now and see if something pops up

    Tuesday, January 31, 2017 1:35 PM
  • User169828 posted

    Sounds like you need to run the Android SDK manager and install/update all the components.

    Tuesday, January 31, 2017 1:51 PM
  • User294005 posted

    @JulienRosen said: Sounds like you need to run the Android SDK manager and install/update all the components.

    Look that's A LOT of components and our internet is shared and slow. I have run the updates and the SDK's for 7.0, 6.0 ++ are installed as well as all the latest Android SDK Tools, Platform Tools and Build-tools. Is there something more specific than all the components you could recommend I look for?

    Tuesday, January 31, 2017 1:59 PM
  • User76049 posted

    I think part of the issue is your slow connection (like ours is today), when compiling Visual Studio (via the Xamarin pluggin I think) will attempt to download the libs (about 200MB I think), it may well be timing out but you get no indication via the VS UI what's going on in the background.

    The issue is discussed on this thread.

    https://forums.xamarin.com/discussion/42982/android-build-failure-unzipping-failed

    Apart from that I can only think you have the wrong java sdk installed!

    Tuesday, January 31, 2017 2:05 PM
  • User37696 posted

    @NicolevonLorne,

    Unfortunately, this issue can creep up on slow connections. We are investigating better ways to handle this scenario.

    In the meantime, the only other thing I can think of that was not mentioned on this thread already is to make sure you have the Support Library installed. It's an option in the Android SDK Manager at the very bottom in the "Extras" section.

    Let me know if you further issues and we can connect to get it resolved. Make sure to ping me with @johnmiller so I get a notification.

    Tuesday, January 31, 2017 3:07 PM
  • User294005 posted

    Thanks @JohnMiller, I've relocated home where the internet is far stable and fast and on first go got the same errors but I tried again and it worked! Now it's not very practical if every time we try to set up a dev environment we struggle so much. If I give my Xamarin folder to someone else can they use it? Alternatively is there a place to download it seperately and just place it there?

    I'm now getting a Java error! But at least it's progress! java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0

    Tuesday, January 31, 2017 4:08 PM
  • User37696 posted

    @NicolevonLorne,

    Excellent!

    java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0

    This error is because of the installed Java JDK version. Install version 1.8 and remove any other versions (1.7, 1.6, etc). The 1.8 update can be downloaded here: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

    Tuesday, January 31, 2017 4:13 PM
  • User251799 posted

    My machine died yesterday and I had to reinstall Win, and when attempting to build, I ran into the same issues I had during my first attempt with Xamarin. As in the threads above, those two steps fixed things for me:

    • updated JDK and adjusted the version used by Xamarin in VS
    • then killed the Xamarin cache after having updated the Android SDKs and JDK (they weren't up-to-date when I did my first failing build attempt), and that got me going again: C:\Users\USERNAME\AppData\Local\Xamarin (deleted failing projects plus the zips folder)

    @JohnMiller Given that I ran into that issue on two fresh installs, and don't seem to be alone on this, I would suggest to have better guidance/cleanup and maybe warnings issued by the Xamarin installer. It's not exactly a nice entry into working with the platform ;)

    Tuesday, January 31, 2017 9:55 PM
  • User294005 posted

    Thank you everyone for your help. I was finally able to actually run the base app on an emulator!

    @JohnMiller is there any answer to my question above about whether all this can be downloaded separately? We will run into this issue everytime there is an update and once we are more devs than just me it's not practical.

    Very excited to start playing now!

    Wednesday, February 1, 2017 7:13 AM
  • User37696 posted

    @NicolevonLorne,

    It's possible that this gist by Jon Douglas could help work around the issue. The top sections are a lengthy manual work around. The bottom "New" fix may work out faster.

    I'll poke around and see what details I can get on what other solutions we might have available and what's being done for future, more robust, solutions.

    Wednesday, February 1, 2017 1:34 PM
  • User294005 posted

    Thanks @JohnMiller I'll check it out :)

    Wednesday, February 1, 2017 1:38 PM