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. (windows下)安装mysql

    一.先从mysql的官网上下载对应版本的mysql zip包(适用于windows下的) 二.解压zip包放到自定义的文件夹下(我放的是e盘,路径为E:\mysql-5.6.40-winx64) 三. ...

  2. Python 3之str类型、string模块学习笔记

    Windows 10家庭中文版,Python 3.6.4, Python 3.7官文: Text Sequence Type — str string — Common string operatio ...

  3. ssh隐藏的sftp功能的使用

    sftp是Secure File Transfer Protocol的缩写,安全文件传送协议.可以为传输文件提供一种安全的加密方法.sftp 与 ftp 有着几乎一样的语法和功能.SFTP 为 SSH ...

  4. On the Bias/Variance tradeoff in Machine Learning

    参考:https://codesachin.wordpress.com/2015/08/05/on-the-biasvariance-tradeoff-in-machine-learning/ 之前一 ...

  5. kafka脚本

    为了便于使用,kafka提供了比较强大的Tools,把经常需要使用的整理一下 开关kafka Server bin/kafka-server-start.sh config/server.proper ...

  6. goodrain云平台 mysql主从同步应用创建

    mysql 主从同步原理 1)在Slave 服务器上执行sart slave命令开启主从复制开关,开始进行主从复制. 2)此时,Slave服务器的IO线程会通过在master上已经授权的复制用户权限请 ...

  7. wpf 查找children的方法

    var newValue = (bool)args.NewValue; HZWaitLoadingEx source = (HZWaitLoadingEx)sender; ControlTemplat ...

  8. IDEA下利用Jrebel插件实现JFinal项目main方法【热加载】

    IDEA下利用Jrebel插件实现JFinal项目main方法[热加载] Jrebel破解办法 https://github.com/ilanyu/ReverseProxy/releases/tag/ ...

  9. 注解实现json序列化的时候自动进行数据脱敏

    https://blog.csdn.net/liufei198613/article/details/79009015

  10. linux 安装redis4.0

    1.安装redis 第一步:下载redis安装包 wget http://download.redis.io/releases/redis-4.0.6.tar.gz 1 2 3 4 5 6 7 8 9 ...