Search code examples
c#xamarinxamarin.androidxamarin.formscocossharp

'ApplicationName' and 'Hello' strings missing in 'Resource.String' in Xamarin.Forms


I had fully working Xamarin.Forms (Android and iOS). HAXM is running. Then I installed CocosSharp from nuget in my PCL project and both Android and iOS projects. iOS project works great but Android... not.

I have:

'Resource.String' does not contain a definition for `ApplicationName' 
'Resource.String' does not contain a definition for `Hello'

I looked for a solution, but all I found is that I have to Clean the solution. I did. It didn't work. I even closed the Visual Studio, removed packages folder, removed all bin/obj projects. Opened VS, again cleaned solution (just in case), rebuilt. The same error.

How can I fix this? Should I manually add String.xml to the project? Really?!

Thanks for help


Solution

  • How can I fix this? Should I manually add String.xml to the project? Really?!

    I made a demo and reproduced your problem. By opening the Resource.Designer.cs file I found that the following codes are automatically added to UpdateIdValues():

    global::CocosSharp.Forms.Android.Resource.String.ApplicationName = global::CocosSharpDemo.Droid.Resource.String.ApplicationName;
    global::CocosSharp.Forms.Android.Resource.String.Hello = global::CocosSharpDemo.Droid.Resource.String.Hello;
    

    By commenting out/deleting these two lines of codes, the application builds and runs correctly.

    Or, of course adding a strings.xml file with following codes to values folder also fix the problem:

    <resources>
        <string name="ApplicationName">your project name</string>
        <string name="Hello">hello</string>
    </resources>
    

    I have opened an issue on the project's Github.