Before attempting to explain, please notice that the message is displaying a Warning and not an Error.
Warning: File repositories.cfg could not be loaded.
The reason this is just a warning is because this file is intended for users (developers) to add a list of sdk-repository sources.
Note that this file is a Properties file that contains one property per line in form of: KEY=VALUE
So sdkmanager has its own list of sdk-repository sources and lets you add yours in this file as a user level list.
Answers:
In some threads, I saw that answer to this question suggest to just create the repositories.cfg
file:
mkdir -p ~/.android && touch ~/.android/repositories.cfg
like here.
where other answer suggest to add the following lines after creating the file:
### User Sources for Android SDK Manager
count=0
like here, and both solutions work.
Why:
To better understand what's happening we need to have a look at the source file that handles this part.
Here is a link to the RepoSources.java at the commit that introduces this behaviour.
The file and behaviour might have changed over time but this will help understand what's happening.
// Line 35-39
String KEY_COUNT = "count";
String KEY_SRC = "src";
String SRC_FILENAME = "repositories.cfg";
ArrayList<RepoSource> mSources = new ArrayList<RepoSource>();
We will deal with the file repositories.cfg
looking for keys count
and src
and add found sources to mSources
array.
// Lines 71 - 120
public void loadUserSources()
Here (line 86-92) if the file exist, we load it as a Properties instance, then we look for the key count
and if not found we return 0 otherwise later in code we look for src
key to add found sources to the array.
So having or not a count
key when the file is empty doesn't matter as it defaults to count=0
.
You can notice that when this repositories.cfg
file does not exit it does nothing, it doesn't even display the warning.
This means that at that time, developers were using this solution without even noticing that they could use repositories.cfg
as nothing was displayed.
I hope this gives you the information you need.