Bug 39949 - Can't generate APKs for non-Release builds except by running on device
Summary: Can't generate APKs for non-Release builds except by running on device
Status: RESOLVED ANSWERED
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Android ()
Version: 4.0.0 (C6)
Hardware: PC Windows
: --- normal
Target Milestone: Future Cycle
Assignee: vsx
URL:
Depends on:
Blocks:
 
Reported: 2016-03-28 16:18 UTC by Matthew Orlando
Modified: 2017-08-09 10:17 UTC (History)
5 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED ANSWERED

Description Matthew Orlando 2016-03-28 16:18:31 UTC
We are using the Ad-Hoc build configuration as sort of an in-between for Debug & Release builds. It has all the same configuration options as Release (target architectures, optimization & linker settings, etc.) but with certain internal testing features enabled. This works fine for development, as I can build and run on any connected device. However, there doesn't seem to be any way to create packages to distribute to internal testers.

As soon as I choose any build configuration other than Release, Xamarin disables the "Export Android Package (apk)" option in the build menu (along with disabling AOT compilation and Proguard, but we aren't using those). As far as I can tell, every single setting I have access to for the Ad-Hoc configuration is identical to the release configuration except for a single conditional compilation variable, but Xamarin still insists on treating Release as a special case.

I have looked into other options for generating the APK files, but they all either say to use the Release configuration, or they are old enough that the suggested command lines no longer work:

http://forums.xamarin.com/discussion/4175/when-should-the-release-apk-be-generated
https://forums.xamarin.com/discussion/29505/confused-android-ad-hoc-testing-build
https://forums.xamarin.com/discussion/40324/create-apk-in-release-mode

The only way I can get an APK to generate is by trying to run the build on device.
Comment 1 Prashant [MSFT] 2017-08-09 10:17:49 UTC
You are now allowed to create an API in Debug configuration in latest version of Xamarin for VS.

Note that you have to disable `Use Shared Rintime` in project properties to generate an APK

If this issue is still occurring for you, please reopen this report and attach a reproduction, ideally starting with a new template project and then adding just the code necessary to demonstrate the issue.