I'm pretty desperate finding the solution for the problem stated below.

I have a cross platform solution which has 4 projects,

3 OS specifics 
    MyApp.android,
    MyApp.Winphone,
    MyApp.IOS
and a PCL project
    MyApp.BLL

inside the MyApp.BLLbll, I'm using the MyApp namespace and in the root I have the class TranslateExtension.cs

namespace MyApp
{
[ContentProperty("Text")]
public class TranslateExtension: IMarkupExtension {
readonly CultureInfo ci;
const string ResourceId = "MyApp.Resources.AppResource"; public TranslateExtension()
{
ci = DependencyService.Get<ILocalize>().GetCurrentCultureInfo();
} public string Text { get; set; } public object ProvideValue(IServiceProvider serviceProvider)
{
if (Text == null)
return ""; ResourceManager resmgr = new ResourceManager(ResourceId
, typeof(TranslateExtension).GetTypeInfo().Assembly); var translation = resmgr.GetString(Text, ci);
try
{
if (translation == null)
{
#if DEBUG
throw new ArgumentException(
String.Format("Key '{0}' was not found in resources '{1}' for culture '{2}'.", Text, ResourceId, ci.Name),
"Text");
#else
translation = Text; // HACK: returns the key, which GETS DISPLAYED TO THE USER
#endif
}
}
catch (Exception exp) {
}
return translation;
}
}

inside the Xamarin Forms I'm using the following to enable the translation for the labels, etc.

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="MyApp.Views.RegisterWebServiceXaml"
xmlns:trans="clr-namespace:MyApp;assembly=MyApp.BLL"
IsBusy="{Binding IsWorking}"
> <ContentPage.Content>
<StackLayout Orientation="Vertical" VerticalOptions="FillAndExpand" Padding="0,75,0,0">
<Entry Text="{Binding Path=OrganizationId, Mode=TwoWay}" Placeholder="{trans:Translate OrganizationId}" Style="{StaticResource LoginStyle}" />
...
<Label Text="{trans:TranslateUpper Next}" x:Name="LoginLabel" HorizontalOptions="Center" Style="{StaticResource BasicLabel}" />
</StackLayout>
</ContentPage.Content>
</ContentPage>

This is working like a charm using the debug modus, but when I try to compile the solution for Android in release mode, my application is suddenly stopping directly after loading the splashscreen stating 'MyApp is stopped'

looking in the Application output, I can find the following error message:

[Xamarin.Insights] Warning: Unhandled exception: Xamarin.Forms.Xaml.XamlParseException: MarkupExtension not found for trans:Translate
[Xamarin.Insights] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x00028>
[Xamarin.Insights] at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>m__0 (object) <0x0003f>
[Xamarin.Insights] at Android.App.SyncContext/<Post>c__AnonStorey0.<>m__0 () <0x00027>
[Xamarin.Insights] at Java.Lang.Thread/RunnableImplementor.Run () <0x0003f>
[Xamarin.Insights] at Java.Lang.IRunnableInvoker.n_Run (intptr,intptr) <0x0003b>
[Xamarin.Insights] at (wrapper dynamic-method) object.44dc0140-8f03-4bf1-a261-186aa2a7ef42 (intptr,intptr) <0x0003b>
[art] JNI RegisterNativeMethods: attempt to register 0 native methods for md52ce486a14f4bcd95899665e9d932190b.JavaProxyThrowable
[AndroidRuntime] Shutting down VM
[AndroidRuntime] FATAL EXCEPTION: main
[AndroidRuntime] Process: MyApp.MyApp, PID: 32091
[AndroidRuntime] java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
[AndroidRuntime] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1184)
[AndroidRuntime] Caused by: java.lang.reflect.InvocationTargetException
[AndroidRuntime] at java.lang.reflect.Method.invoke(Native Method)
[AndroidRuntime] at java.lang.reflect.Method.invoke(Method.java:372)
[AndroidRuntime] at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1389)
[AndroidRuntime] ... 1 more
[AndroidRuntime] Caused by: md52ce486a14f4bcd95899665e9d932190b.JavaProxyThrowable: Xamarin.Forms.Xaml.XamlParseException: MarkupExtension not found for trans:Translate
[AndroidRuntime] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x00028>
[AndroidRuntime] at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>m__0 (object) <0x0003f>
[AndroidRuntime] at Android.App.SyncContext/<Post>c__AnonStorey0.<>m__0 () <0x00027>
[AndroidRuntime] at Java.Lang.Thread/RunnableImplementor.Run () <0x0003f>
[AndroidRuntime] at Java.Lang.IRunnableInvoker.n_Run (intptr,intptr) <0x0003b>
[AndroidRuntime] at (wrapper dynamic-method) object.44dc0140-8f03-4bf1-a261-186aa2a7ef42 (intptr,intptr)<0x0003b>[AndroidRuntime][AndroidRuntime] at mono.java.lang.RunnableImplementor.n_run(NativeMethod)[AndroidRuntime] at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:29)[AndroidRuntime] at android.os.Handler.handleCallback(Handler.java:739)[AndroidRuntime] at android.os.Handler.dispatchMessage(Handler.java:95)[AndroidRuntime] at android.os.Looper.loop(Looper.java:145)[AndroidRuntime] at android.app.ActivityThread.main(ActivityThread.java:5944)[AndroidRuntime]...4 more

Does any body has a solution for this problem? I can't find it. I have tried using the several namespaces ( MyApp.android, MyApp, MyApp.BLL, MyApp.MyApp ), but until now I haven't found the right one.

Why is this working in Debug mode and not in Release/App store mode?

Check the project settings, make sure linking is turned off or SDK-ony

.

If it was "Link all assemblies" and without it your code becomes too big you may want to instead use the [Preserve] attribute on your class.

See this page for more info on Xamarin Linker

Xamarin.Forms.Xaml.XamlParseException: MarkupExtension not found for trans:Translate using a PCL in Release Mode的更多相关文章

  1. Xamarin.Forms XAML的辅助功能Code Snippet

    Xamarin.Forms XAML的辅助功能Code Snippet   在Visual Studio中,使用Code Snippet(代码片段)功能可以减少基础代码的编写量,如常见的标签.循环语句 ...

  2. Xamarin.Forms XAML控件的公共属性

    Xamarin.Forms XAML控件的公共属性   Xamarin.Forms XAML控件有很多.通过官网API,可以查看每个控件的属性.但是官网只给出了控件的特有属性,而公共属性没有列出.所以 ...

  3. Creating Reusable XAML User Controls with Xamarin Forms

    In the previous post on making fancy layouts with Xamarin Forms we saw how you can design a Dashboar ...

  4. Xamarin.Forms之XAML

    官网参考 XAML基础知识 XAML(eXtensible Application Markup Language)可扩展应用程序标记语言,允许开发者在Xamarin.Forms应用中采用标记而不是代 ...

  5. 老司机学新平台 - Xamarin Forms开发框架之MvvmCross插件精选

    在前两篇老司机学Xamarin系列中,简单介绍了Xamarin开发环境的搭建以及Prism和MvvmCross这两个开发框架.不同的框架,往往不仅仅使用不同的架构风格,同时社区活跃度不同,各种功能模块 ...

  6. Xamarin.Forms介绍

    On May 28, 2014, Xamarin introduced Xamarin.Forms, which allows you to write user-interface code tha ...

  7. Xamarin.Forms入门学习路线

    Xamarin 介绍 Xamarin是一套跨平台解决方案,目的是使用C#语言创造原生的iOS,Android,Mac和Windows应用. Xamarin的三个优势: Xamarin App拥有原生A ...

  8. Xamarin.Forms 开发资源集合(复制)

    复制:https://www.cnblogs.com/mschen/p/10199997.html 收集整理了下 Xamarin.Forms 的学习参考资料,分享给大家,稍后会不断补充: UI样式 S ...

  9. Xamarin.Forms 自定义 TapGestureRecognizer 附加属性

    While creating Xamarin.Forms applications, definitely you are going to need TapGestureRecognizer oft ...

随机推荐

  1. 转:Citrix虚拟化--转自CSDN

    http://blog.csdn.net/kkfloat/article/category/1430751/3

  2. 通过图片获取gps地理位置

    别人说通过一张照片就可以定位你的位置,看来个视频,仔细研究了一下自己的照片没想到真的可以做到,想想真的有点可怕. 如何通过一张照片去定位这张照片的经纬度下面我以我手机中的照片为例. 我们通过pytho ...

  3. 解读Android LOG机制的实现【转】

    转自:http://www.cnblogs.com/hoys/archive/2011/09/30/2196199.html http://armboard.taobao.com/ Android提供 ...

  4. React-Native 之 生命周期

    前言 学习本系列内容需要具备一定 HTML 开发基础,没有基础的朋友可以先转至 HTML快速入门(一) 学习 本人接触 React Native 时间并不是特别长,所以对其中的内容和性质了解可能会有所 ...

  5. pip --version问题

    安装pip之后,在cmd下输入 pip --version始终提示: Unknown option:versionDid not provide a command自己安装步骤没错,怎么想也不明白,无 ...

  6. tomcat报错:java.net.SocketException: Permission denied["http-nio-80"]

    tomcat报错:java.net.SocketException: Permission denied["http-nio-80"] 问题:使用非root账户tomcat启动to ...

  7. 读写分离MYSQL类

    2014年4月27日 12:34:08 概述: 1. 根据sql语句判断是连接读库还是写库 2. 链式调用$this->where()->get() 3. 不同的主机对应不同的实例, 不再 ...

  8. 08 Go 1.8 Release Notes

    Go 1.8 Release Notes Introduction to Go 1.8 Changes to the language Ports Known Issues Tools Assembl ...

  9. java采用zip方式实现String的压缩和解压缩CompressStringUtil类

    CompressStringUtil类:不多说,直接贴代码: /** * 压缩 * * @param paramString * @return */ public static final byte ...

  10. java 内部类使用 .this 和 .new

    如果需要生成对外部类对象的引用,可以使用外部类的名字后面紧跟圆点和this,这样产生的引用自动地具有正确的类型,这一点在编译器就被知晓并受到检查,因此并没有运行时开销 //: innerclasses ...