Forum General

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Trying to compile Android NDK sample in Visual Studio

PeadarOPeadarO Member

Hello all, I am trying to get an NDK sample to compile.

I want to develop Android software on Visual Studio and to do so I want to clone a project from one of the samples provided in the NDK. To keep things simple I am starting with hello-neon.

I am using Visual Studio 2019 and Windows 10.

I have already gone into Control Panel>System>Advanced System Settings>Environment Variables.

I have JAVA_HOME, ANT_HOME and NDK_HOME correctly set up.

I type File->New->VisualGDB Project . Then I choose “Android Project Wizard” and give the Project its name. Then I type “Add”.

I go into Configure NDK/SDK Locations. I give it Android NDK Path as “C:\ADev\android-ndk-r21”.

I believe I have the JDK and SDK path set up correctly too. I hit OK

I choose the third option “Clone a sample from NDK”. Then I hit ‘Next>’

I am given the screen called “New Android Project”. This is where I am expecting to see a list of the NDK projects but they do not appear. I get the error message “Missing NDK Samples”.

I have tried moving the hello-neon sample project around but no matter where I put it Visual Studio can’t find it. Similarly there is no way to find out where Visual Studio is actually looking for the NDK samples.

Any help much appreciated.

Peadar

Best Answer

  • PeadarOPeadarO Member
    Accepted Answer

    Hello, Peadar here again. I worked it out so I'm going to answer my own question.
    If you are using Visual Studio to create Android software and you want to start by compiling the samples then this is what you must do.
    You can't install the samples yourself, you have to download them with 'git' and of course to do that you must first download and install 'git' itself.
    You go into a dos box and you MUST change directory into whatever directory you specified for NDK when you configured NDK/SDK directories in the 'New Android Project' Screen. THEN you can run the git command which you have been given on the screen. Visual Studio will then find the samples.

Answers

  • PeadarOPeadarO Member
    Accepted Answer

    Hello, Peadar here again. I worked it out so I'm going to answer my own question.
    If you are using Visual Studio to create Android software and you want to start by compiling the samples then this is what you must do.
    You can't install the samples yourself, you have to download them with 'git' and of course to do that you must first download and install 'git' itself.
    You go into a dos box and you MUST change directory into whatever directory you specified for NDK when you configured NDK/SDK directories in the 'New Android Project' Screen. THEN you can run the git command which you have been given on the screen. Visual Studio will then find the samples.

Sign In or Register to comment.