score:0

Accepted answer

I found out that the only way for me to do that is to determine which classes and methods are being used in my compiled classes.

I mapped them via Map[String, Set[String]] data structure, where the key is the class name and the corresponding Set value contains all the methods used from that class.

After that, it's just a matter of creating lots of -keep argumetns:

def getProGuardKeepArgs(allDeps: MMap[String, MSet[String]]): String = {
    var sb = new StringBuilder()
    for ((clazz, methods) <- allDeps) {
        sb.append("-keep class " + clazz + " {\n")

        for (method <- methods) {
            sb.append(" *** " + method + "(...);\n")
        }

        sb.append("}\n\n")
    }

    sb.toString
}

Related Query

More Query from same tag