There are 2 big differences between Debug and Release:

- In Debug, we automatically add the INTERNET permission so we can talk 
to the debugger.  For release, if you use the internet, you need to add 
that permission (Project Properties -> Android Manifest).

- In Release, we link (remove unused stuff) from the framework 
assemblies so your .apk isn't 27 MB.

You can try turning off linking in Project Properties -> Mono Android 
Options.  If this fixes it, there are several things you can do to 
control what is kept and what is removed.  These are documented here:

http://android.xamarin.com/Documentation/Linking

Hope this helps!
Jonathan


On 9/16/2011 10:03 AM, mcgear wrote:
> Hello,
>
> Thank you for the response.
>
> The Problem does not occur when i run in the emulator and I can successfully
> run the app on the devices as well.
>
> For a little more information about what i am doing.
>
> 1)  Developed application using Mono API and no third party Java code
> 2)  I can deploy this app to the emulator and all works great (Minus the
> fact that I can't invoke a service running on localhost...  Which is an
> issue with the Android Emulator I believe)
> 3)  I can deploy from Visual Studio to the device as well and the App works
> splendidly.  This deployment and the one to the emulator are in debug mode
> and therefore the Mono Android-7 Support APK is installed along with the
> Mono Shared Runtime APK.  Again these both work
> 4)  When I uninstall these shared Mono APKs, my app APK, and switch the
> build to a "Release" configuration I can then deploy my APP to the device
> again.  When I try to launch the App, it immediately fails on the device,
> and i see no exception...
>
> I am trying to pinpoint what makes this fail...  As of right now, it appears
> to be failing at this line:
> DroidContext.Instance.LanguageID = 1;
>
> DroidContext is a singleton that is implemented this way:
>
>      public class DroidContext : ActivatorSingleton<DroidContext>
>      {
>          public virtual string DistributionPoint { get; set; }
>
>          public virtual long LanguageID { get; set; }
>
>          public virtual int PageSize { get; set; }
>
>          public virtual string PhoneNumber { get; set; }
>
>          public virtual TelephonyManager TelephonyManager { get; set; }
>
>          public virtual string UserAgent { get; set; }
>      }
>
> When i implement the DroidContext singleton as something simple like this:
>      public class DroidContext
>      {
>          public static readonly DroidContext Instance = new DroidContext();
>          ...
>
> Everything works as expected.  The activator singleton looks like this:
>      public class ActivatorSingleton<TInstance>
>          where TInstance : class
>      {
>          #region Fields
>          private readonly static IFactory<TInstance>  factory = new
> ActivatorFactory<TInstance>();
>
>          public static TInstance Instance
>          {
>              get
>              {
>                  //  Get instance from the singleton creator
>                  return SingletonCreator.instance;
>              }
>          }
>
>          #region Constructors
>          protected ActivatorSingleton()
>          { }
>
>          class SingletonCreator
>          {
>              static SingletonCreator() { }
>
>              internal static readonly TInstance instance = factory.Create();
>          }
>      }
>
> The ActivatorFactory.Create method simply returns the following:
> return Activator.CreateInstance<TInstance>();
>
> Why does this code execute fine on my devices when built in debug mode?  And
> why does it fail when i use it in Release mode?
>
> Thank you for any input!
>
> Regards,
> Michael Gearhardt
>
> --
> View this message in context: 
> http://mono-for-android.1047100.n5.nabble.com/How-to-deploy-App-To-Market-tp4774508p4810981.html
> Sent from the Mono for Android mailing list archive at Nabble.com.
> _______________________________________________
> Monodroid mailing list
> [email protected]
>
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid
>
>

_______________________________________________
Monodroid mailing list
[email protected]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to