Xamarin Forms generates wrong ressources

前端 未结 2 1961
猫巷女王i
猫巷女王i 2021-01-02 10:04

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:

         


        
相关标签:
2条回答
  • 2021-01-02 10:30

    Follow these steps every time you update Xamarin Forms

    • Delete bin and obj as it has data of previous versions
    • restart vs
    • Clean build and run
    0 讨论(0)
  • 2021-01-02 10:37

    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

    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. 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. Save the changes, then right-click on the Android project and select Reload Project.

    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.

    0 讨论(0)
提交回复
热议问题