How to build Android Application natively in Visual Studio

Mohammad Mohsin Siddiqui 175 Reputation points
2023-09-09T12:26:33.0966667+00:00

We are building a cross-platform application using Visual Studio 2022. C++ is our primary programming language as bulk of the application logic is in C++. We use other native languages too for different platforms - like Kotlin for Android, Swift for iOS etc.

 

We want to understand if VS 2022 supports native Android projects i.e. projects that DO NOT USE Xamarin/MAUI, and is built using C++ and Kotlin/Java ? Can such a project be natively built and run in VS ?

 

We desire to be able to use a common IDE for all our development and have been using VS since many years. To felicitate usage of VS and cross-platform builds, we use CMake for our build for cross-platform. For Apple family, we use the Xcode generator and things work well for us. For Windows, we use MSBuild. However, for Android, we dont see any standard way of doing things. What should be the right way to go ahead for building for Android in the right manner using Visual Studio ?

Developer technologies Visual Studio Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Zhengye Xu-MSFT 95 Reputation points Microsoft External Staff
    2023-09-11T09:23:01.2233333+00:00

    Hello @Mohammad Mohsin Siddiqui ,

    Welcome to Microsoft Q&A forum.

    We want to understand if VS 2022 supports native Android projects i.e. projects that DO NOT USE Xamarin/MAUI, and is built using C++ and Kotlin/Java ? Can such a project be natively built and run in VS ?

     

    Yes, we can build Android projects in Visual Studio that use C++ and Java. You need to install mobile development with C++ in Visual Studio. (Open Visual Studio Installer and click Modify, find Mobile Development with C++ in Workload and select it, click Modify to install)

    9.11 workload

    After installation, you can open Visual Studio to create a project.

    9.11 project template

    Then You can then add .java files to your project

    9.11 java file

    Have a nice day.

    Best Regards,

    Zhengye


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.