I used Android Studio to manage my Android code. In the project structure, I created the assets folder which saves some emoticons in different folders.
But somehow, when I switch between 2 branches which using different folders and emoticons, and use these codes as below to load all images in those folders:
public static boolean initialize(Context context) {
if(tapEmoticonNameMap!=null)
return true;
tapEmoticonNameMap = new HashMap<>();
try {
for(String tabDir : tabStringList) {
String[] list = context.getAssets().list(tabDir);
if (list.length > 0) {
ArrayList<String> pngList = new ArrayList<>();
for(String name : list) {
if(name.endsWith(".png")) {
pngList.add(name);
}
}
tapEmoticonNameMap.put(tabDir, pngList);
}
}
} catch (IOException e) {
return false;
}
return true;
}
In fact, It loaded not only every actual images in those folders but also including ones in the previous branch. Any suggestions to solve this problem? How can I remove the cache folder in this case? Any help would be appreciated.
After taking a half-day to struggle with a bunch of ways:
But the problem is still there. Eventually, I found how to deal with this terrible problem.
The solution is we should REMOVE hidden .gradle folder in project folder.
I hope this helps, especially for those who are facing the same problem like me.