android xml language issue

hi guys i am tryin to make multilanguage. it work well on unity but not working on android device.

	LMan = new Lang(Path.Combine(Application.dataPath, "Resources/lang.xml"), currentLang, false);
	LMan = new Lang(Path.Combine(Application.persistentDataPath, "lang.xml"), currentLang, false);

//i tried other ways too, without ifelse etc.;

LMan = new Lang(Path.Combine(Application.dataPath, "Resources/lang.xml"), currentLang, false);

and here is xml load part of code.

public function setLanguage ( path : String, language : String) {
		var xml : XmlDocument = new XmlDocument();
		Strings = new Hashtable();
		var element : XmlElement = xml.DocumentElement.Item[language];
		if (element) {
			var elemEnum : IEnumerator = element.GetEnumerator();
			while (elemEnum.MoveNext()) {
				var xmlItem : XmlElement = elemEnum.Current;
				Strings.Add(xmlItem.GetAttribute("name"), xmlItem.InnerText);
		} else {
			Debug.LogError("The specified language does not exist: " + language);

Assets that are in your project can’t be reached via file IO as all assets are packed into asset files inside the apk. Application.persistentDataPath is a location where your app can store data. This location is initially empty. You won’t find there anthing you didn’t put there first.

You can use Streaming Assets by placing your files inside a folder called “StreamingAssets”. That way those files are just packed into the apk (which is just a zip file) instead of getting packed as asset.

Though if the language files should be packed into the project as assets, you have two options:

  • Place them in a “Resources” folder and use Resources.Load to get back a TextAsset.
  • Directly use the asset by declaring a public variable of type “TextAsset” (could be an array) and just assign your xml file(s) in the inspector to this(those) variable(s)

The public variable approach is usually the prefered one. Using the Resources folder has some disadvantages as all assets in Resources folders are fetched right at start. StreamingAssets would work as well, but it’s easier to gather / manipulate by endusers as they are directly inside the apk.