Xamarin表单生成错误的资源 [英] Xamarin Forms generates wrong ressources
问题描述
我有一个带有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:
- 右键单击Android项目,然后选择
Unload Project
.如果项目从IDE中消失,请确保解决方案显示了所有文件,而不仅仅是项目中的文件. - 右键单击已卸载的Android项目,然后选择
Edit Project
打开.csproj文件. - 在第一个
PropertyGroup
标签中,添加以下内容:
- 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. - Right-click on the unloaded Android project and select
Edit Project
to open the .csproj file. - In the first
PropertyGroup
tag, add in the following:
<AndroidUseManagedDesignTimeResourceGenerator>
False
</AndroidUseManagedDesignTimeResourceGenerator>
- 保存更改,然后右键单击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屋!