OneBigQuestion OneBigQuestion - 1 year ago 176
Android Question

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?

Answer Source

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"?>
  <string name="ApplicationName">ApplicationName</string>
  <string name="Hello">Hello</string>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download