Build APK with several architectures.

Is it possible to create an APK using NSight Tegra VS plugin with both amreabi and armeabi-v7a architectures included, like when you specify both architectures in Application.mk? If not, can you suggest any workarounds, short of building my project without plugin’s help? I would really like my project to work on both types of devices without having to build separate packages for each architecture…

Hello Max,

You can try the following:

  1. Move all your native code to a new project. Set its Configuration Type to Dynamic Library.
  2. Create two new VS configurations in that project: Debug_v5te and Debug_v7a.
  3. In each of the configs set the target architecture.
  4. Set the output path of each config to the main project’s libs folder, architecture-dependent subfolder.
  5. Create a build_libs.bat file which will build the library project in two configs.
  6. Set build_libs.bat as a main project’s Pre-Ant Event.
  7. Using VS’s configuration manager turn off library’s building.

I did these steps with HelloJni project and it worked for me, I was able to debug the native code. Here’s a sample build_libs.bat file contents to get you started:

@echo off

set MSBUILD_PATH=C:\Windows\Microsoft.NET\Framework\v4.0.30319

%MSBUILD_PATH%\MSBuild.exe lib\lib.vcxproj /p:Configuration=Debug_v5te;Platform=Android
%MSBUILD_PATH%\MSBuild.exe lib\lib.vcxproj /p:Configuration=Debug_v7a;Platform=Android

OK, I see. It’s a pity plugin can’t do it itself. I hope the feature will be added in future versions.