code: private static Class resolveRClass(String packageName) {
          do {
              try {
                  return Class.forName(packageName + ".R$string");
              } catch (ClassNotFoundException e) {
                  packageName = packageName.contains(".") ? packageName.substring(0, packageName.lastIndexOf('.')) : "";
              }
          } while (!TextUtils.isEmpty(packageName));
  
          return null;
      }
docs: a helper class to resolve the correct R Class for the package