dpart dpart - 1 year ago 94
Android Question

getting assets not get the files of assets

I have a project in Android Studio with a lot of libraries. The main project has an assets folder (which contains two folders) and the libraries don't have any assets folders.

I have this code:

public static final Pattern LENGUAJES = Pattern.compile("html-(.+)");

public static List<String> getLenguajesHelp(Context oContext) {
ArrayList<String> oLens = new ArrayList<String>();
AssetManager assetManager = oContext.getAssets();
try {
String[] oFiles = assetManager.list("");
for (int i = 0; i < oFiles.length; i++) {
Log.v("probandoElMatcher", oFiles[i]);
Matcher oMat = LENGUAJES.matcher(oFiles[i]);
if (oMat.find()) {
} catch (IOException oEx) {
return oLens;

is from the main project (in the assets folder I have a folder named html-es, the idea is that the method matches with that folder) but the method
returns a list of files that I don't have in the assets folder, the most of them are
files. What would be the problem?

Answer Source

The problem was that i has a lot of flavors, when there are flavors the assets folder must be inside of the main folder (or the specific flavor folder), but i don't know why the get assets returns the .pak files (know returns the .pak files and my files)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download