0

I am porting a java project to android. It has a jar library that uses a config file (xml). For the java application, this xml has to be placed with the application jar or in the folder where the jar library is present.

When using it in Android Studio, I am unable to find where should I place the XML file. This xml is read by the jar library automatically, I don't have to write any code to specifically read any values from the jar.

I tried placing the jar with MainActivity.java file and also in the "libs" folder where the jar library is present. But it always shows the error:

Config file not found

I am using Android Studio 2.3.3

What am I doing wrong?

Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135
Ashish
  • 1
  • If I understand your question you have a jar lib along with xml file the jar lib uses the xml.That works with java in android project you want those method of jar in an Activity .right? – Abhijit Chakra Sep 14 '17 at 04:54
  • Yes Abhijit. Your understanding is correct. – Ashish Sep 14 '17 at 05:06
  • Can you put the xml file and jar in same lib folder and try to use it the jar methods in Activty class here is a link how to add jar in android studio https://stackoverflow.com/questions/25660166/how-to-add-a-jar-in-external-libraries-in-android-studio – Abhijit Chakra Sep 14 '17 at 05:10
  • I have already tried it. Added jar and xml both in libs folder. I can access the jar methods in Activity but it gives error for config xml at runtime. – Ashish Sep 14 '17 at 05:53
  • Can you post what the error you are exactly getting – Abhijit Chakra Sep 14 '17 at 06:17
  • The error is returned by the jar library "Config file not found" The library methods return this error when its unable to find the config xml – Ashish Sep 15 '17 at 06:28

0 Answers0