Search in sources :

Example 1 with FieldIdItem

use of com.android.dx.dex.file.FieldIdItem in project buck by facebook.

the class Main method computeReferencedResources.

private void computeReferencedResources() {
    for (Item genericItem : outputDex.getFieldIds().items()) {
        FieldIdItem item = (FieldIdItem) genericItem;
        CstType fieldClass = item.getDefiningClass();
        CstString fieldName = item.getRef().getNat().getName();
        if (fieldClass.getClassType().getDescriptor().contains("/R$")) {
            // Add the packageName of the class for better accuracy.
            resourceNames.add(fieldClass.getPackageName() + "." + fieldName.getString());
        }
    }
}
Also used : Item(com.android.dx.dex.file.Item) FieldIdItem(com.android.dx.dex.file.FieldIdItem) ClassDefItem(com.android.dx.dex.file.ClassDefItem) FieldIdItem(com.android.dx.dex.file.FieldIdItem) CstType(com.android.dx.rop.cst.CstType) CstString(com.android.dx.rop.cst.CstString)

Aggregations

ClassDefItem (com.android.dx.dex.file.ClassDefItem)1 FieldIdItem (com.android.dx.dex.file.FieldIdItem)1 Item (com.android.dx.dex.file.Item)1 CstString (com.android.dx.rop.cst.CstString)1 CstType (com.android.dx.rop.cst.CstType)1