Xamarin表单生成错误的资源 [英] Xamarin Forms generates wrong ressources

查看:57
本文介绍了Xamarin表单生成错误的资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有Xamarin Forms的Xamarin Android应用程序.从Xamarin Forms 3.4.0.1029999更新后,我在Resource.Designer中的条目如下:

I have a Xamarin Android application with Xamarin Forms. After the update from Xamarin Forms 3.4.0.1029999 I have entries in my Resource.Designer like this:

        // aapt resource value: 0x7F030220
        public const int bottomtab.navarea = 2130903584;

        // aapt resource value: 0x7F030221
        public const int bottomtab.tabbar = 2130903585;

有了这些,我会收到很多这样的错误:

With these I get a lot of errors like this:

我认为这是因为要点.有趣的是,构建是成功的. 我该如何解决这个错误?

I assume that this is because of the point. Funny enough the build is successful nonethless. How can I solve this errors?

项目链接: https://github.com/MoneyFox/MoneyFox

推荐答案

这似乎是一个最近引入的错误,它对BottomTabLayout.axml文件进行了更改,最终导致生成的设计文件改用.字符. _个字符.此处有更多详细信息: https://github.com/xamarin/xamarin- android/issues/3007#issuecomment-486622711

This appears to be a bug that was introduced recently with a change to the BottomTabLayout.axml file, ultimately causing the generated design file to use . characters instead of _ characters. More details here: https://github.com/xamarin/xamarin-android/issues/3007#issuecomment-486622711

Xamarin工程师已经意识到了这个问题,并且已经发布了一个修复程序,应该很快发布,但是与此同时,您可以按照以下步骤使用旧的aapt生成器来解决此问题:

The Xamarin engineers are aware of the problem and have a fix lined up that should be released soon, but in the meantime, you can fix this problem by falling back to the old aapt generator by following these steps:

  1. 右键单击Android项目,然后选择Unload Project.如果项目从IDE中消失,请确保解决方案显示了所有文件,而不仅仅是项目中的文件.
  2. 右键单击已卸载的Android项目,然后选择Edit Project打开.csproj文件.
  3. 在第一个PropertyGroup标签中,添加以下内容:
  1. Right-click on the Android project and select Unload Project. If the project disappears from the IDE, make sure that the solution is showing all files and not just files in the project.
  2. Right-click on the unloaded Android project and select Edit Project to open the .csproj file.
  3. In the first PropertyGroup tag, add in the following:

<AndroidUseManagedDesignTimeResourceGenerator>
    False
</AndroidUseManagedDesignTimeResourceGenerator>

  1. 保存更改,然后右键单击Android项目并选择Reload Project.

如果一切顺利,则错误应立即纠正.您可能需要清理和构建,但是根据我的经验,在重新加载Android项目后,立即进行了更正.请注意,根据错误报告,aapt生成器将变慢,如果对axml文件进行了更改并且正在运行设计时生成",则这可能会很明显.

If all goes well, the errors should correct themselves now. You may have to clean and build, but in my experience, the correction was immediate once the Android project was reloaded. Note that according to the bug report, the aapt generator will be slower, which might be noticeable if changes are made to axml files and the Design Time Build is running.

这篇关于Xamarin表单生成错误的资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆