Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xamarin forms error Droid.Resource does not contain a definition for string

This is where the problem is - red lines under "String".

I´m developing a xamarin forms application, and i'm using the PCL Storage plugin.. I think this is whats causing the problem somehow, and i don't know how to fix it. The problem occurs in my Android solution.

public static void UpdateIdValues()
{
    global::PCLStorage.Resource.String.ApplicationName = global::XamarinClients.Droid.Resource.String.ApplicationName;
    global::PCLStorage.Resource.String.Hello = global::XamarinClients.Droid.Resource.String.Hello;
}

I get this error :

Error 6 'XamarinClients.Droid.Resource' does not contain a definition for 'String' pathtomyapplication\Resources\Resource.Designer.cs

Anyone had this problem?

like image 767
OneBigQuestion Avatar asked Dec 02 '15 12:12

OneBigQuestion


1 Answers

If you look in the android documentation for localization it mentions storing application resource string in an xml file. Apparently there are some hard coded values in the android Xamarin.Forms Resource.Designer.cs. To fix it in the resources folder under values add an XML file named String.xml and in it put:

<?xml version="1.0" encoding="utf-8"?>
<resources>
  <string name="ApplicationName">ApplicationName</string>
  <string name="Hello">Hello</string>
</resources>
like image 113
Adawg Avatar answered Oct 15 '22 20:10

Adawg