Java – Find the total number of APIs used in the source code of an Android application?

Find the total number of APIs used in the source code of an Android application?… here is a solution to the problem.

Find the total number of APIs used in the source code of an Android application?

I want to find out the total number of android APIs (classes and methods) used in my android application source code. But I want to do it programmatically. Can anyone advise me on what to do?

Thanks in advance

Solution

You can use Reflections API

You can get the list of classes using the following code:

Reflections ref = new Reflections("package_name");
Set<Class<?>> classes = ref.getSubTypesOf(Object.class);

Then use Class.getDeclaredMethods() or Class.getMethods() You can get a list of methods.

Related Problems and Solutions