private String getTooManyMembersMessage() { Map<String, AtomicInteger> membersByPackage = new TreeMap<String, AtomicInteger>(); for (Object member : items()) { String packageName = ((MemberIdItem) member).getDefiningClass().getPackageName(); AtomicInteger count = membersByPackage.get(packageName); if (count == null) { count = new AtomicInteger(); membersByPackage.put(packageName, count); } count.incrementAndGet(); } Formatter formatter = new Formatter(); try { String memberType = this instanceof MethodIdsSection ? "method" : "field"; formatter.format("Too many %1$s references to fit in one dex file: %2$d; max is %3$d.%n" + "You may try using multi-dex. If multi-dex is enabled then the list of " + "classes for the main dex list is too large.%n" + "References by package:", memberType, items().size(), DexFormat.MAX_MEMBER_IDX + 1); for (Map.Entry<String, AtomicInteger> entry : membersByPackage.entrySet()) { formatter.format("%n%6d %s", entry.getValue().get(), entry.getKey()); } return formatter.toString(); } finally { formatter.close(); } }
private String getTooManyMembersMessage() { Map<String, AtomicInteger> membersByPackage = new TreeMap<String, AtomicInteger>(); for (Object member : items()) { String packageName = ((MemberIdItem) member).getDefiningClass().getPackageName(); AtomicInteger count = membersByPackage.get(packageName); if (count == null) { count = new AtomicInteger(); membersByPackage.put(packageName, count); } count.incrementAndGet(); } Formatter formatter = new Formatter(); try { String memberType = this instanceof MethodIdsSection ? "method" : "field"; formatter.format("Too many %1$s references to fit in one dex file: %2$d; max is %3$d.%n" + "You may try using multi-dex. If multi-dex is enabled then the list of " + "classes for the main dex list is too large.%n" + "References by package:", memberType, items().size(), DexFormat.MAX_MEMBER_IDX + 1); for (Map.Entry<String, AtomicInteger> entry : membersByPackage.entrySet()) { formatter.format("%n%6d %s", entry.getValue().get(), entry.getKey()); } return formatter.toString(); } finally { formatter.close(); } }
private String getTooManyMembersMessage() { Map<String, AtomicInteger> membersByPackage = new TreeMap<String, AtomicInteger>(); for (Object member : items()) { String packageName = ((MemberIdItem) member).getDefiningClass().getPackageName(); AtomicInteger count = membersByPackage.get(packageName); if (count == null) { count = new AtomicInteger(); membersByPackage.put(packageName, count); } count.incrementAndGet(); } Formatter formatter = new Formatter(); try { String memberType = this instanceof MethodIdsSection ? "method" : "field"; formatter.format("Too many %s references: %d; max is %d.%n" + Main.getTooManyIdsErrorMessage() + "%n" + "References by package:", memberType, items().size(), DexFormat.MAX_MEMBER_IDX + 1); for (Map.Entry<String, AtomicInteger> entry : membersByPackage.entrySet()) { formatter.format("%n%6d %s", entry.getValue().get(), entry.getKey()); } return formatter.toString(); } finally { formatter.close(); } }
private String getTooManyMembersMessage() { Map<String, AtomicInteger> membersByPackage = new TreeMap<String, AtomicInteger>(); for (Object member : items()) { String packageName = ((MemberIdItem) member).getDefiningClass().getPackageName(); AtomicInteger count = membersByPackage.get(packageName); if (count == null) { count = new AtomicInteger(); membersByPackage.put(packageName, count); } count.incrementAndGet(); } Formatter formatter = new Formatter(); try { String memberType = this instanceof MethodIdsSection ? "method" : "field"; formatter.format("Too many %s references: %d; max is %d.%n" + Main.getTooManyIdsErrorMessage() + "%n" + "References by package:", memberType, items().size(), DexFormat.MAX_MEMBER_IDX + 1); for (Map.Entry<String, AtomicInteger> entry : membersByPackage.entrySet()) { formatter.format("%n%6d %s", entry.getValue().get(), entry.getKey()); } return formatter.toString(); } finally { formatter.close(); } }
/** {@inheritDoc} */ @Override public final void writeTo(DexFile file, AnnotatedOutput out) { TypeIdsSection typeIds = file.getTypeIds(); StringIdsSection stringIds = file.getStringIds(); CstNat nat = cst.getNat(); int classIdx = typeIds.indexOf(getDefiningClass()); int nameIdx = stringIds.indexOf(nat.getName()); int typoidIdx = getTypoidIdx(file); if (out.annotates()) { out.annotate(0, indexString() + ' ' + cst.toHuman()); out.annotate(2, " class_idx: " + Hex.u2(classIdx)); out.annotate(2, String.format(" %-10s %s", getTypoidName() + ':', Hex.u2(typoidIdx))); out.annotate(4, " name_idx: " + Hex.u4(nameIdx)); } out.writeShort(classIdx); out.writeShort(typoidIdx); out.writeInt(nameIdx); }
/** {@inheritDoc} */ @Override public final void writeTo(DexFile file, AnnotatedOutput out) { TypeIdsSection typeIds = file.getTypeIds(); StringIdsSection stringIds = file.getStringIds(); CstNat nat = cst.getNat(); int classIdx = typeIds.indexOf(getDefiningClass()); int nameIdx = stringIds.indexOf(nat.getName()); int typoidIdx = getTypoidIdx(file); if (out.annotates()) { out.annotate(0, indexString() + ' ' + cst.toHuman()); out.annotate(2, " class_idx: " + Hex.u2(classIdx)); out.annotate(2, String.format(" %-10s %s", getTypoidName() + ':', Hex.u2(typoidIdx))); out.annotate(4, " name_idx: " + Hex.u4(nameIdx)); } out.writeShort(classIdx); out.writeShort(typoidIdx); out.writeInt(nameIdx); }
/** {@inheritDoc} */ @Override public final void writeTo(DexFile file, AnnotatedOutput out) { TypeIdsSection typeIds = file.getTypeIds(); StringIdsSection stringIds = file.getStringIds(); CstNat nat = cst.getNat(); int classIdx = typeIds.indexOf(getDefiningClass()); int nameIdx = stringIds.indexOf(nat.getName()); int typoidIdx = getTypoidIdx(file); if (out.annotates()) { out.annotate(0, indexString() + ' ' + cst.toHuman()); out.annotate(2, " class_idx: " + Hex.u2(classIdx)); out.annotate(2, String.format(" %-10s %s", getTypoidName() + ':', Hex.u2(typoidIdx))); out.annotate(4, " name_idx: " + Hex.u4(nameIdx)); } out.writeShort(classIdx); out.writeShort(typoidIdx); out.writeInt(nameIdx); }
/** {@inheritDoc} */ @Override public final void writeTo(DexFile file, AnnotatedOutput out) { TypeIdsSection typeIds = file.getTypeIds(); StringIdsSection stringIds = file.getStringIds(); CstNat nat = cst.getNat(); int classIdx = typeIds.indexOf(getDefiningClass()); int nameIdx = stringIds.indexOf(nat.getName()); int typoidIdx = getTypoidIdx(file); if (out.annotates()) { out.annotate(0, indexString() + ' ' + cst.toHuman()); out.annotate(2, " class_idx: " + Hex.u2(classIdx)); out.annotate(2, String.format(" %-10s %s", getTypoidName() + ':', Hex.u2(typoidIdx))); out.annotate(4, " name_idx: " + Hex.u4(nameIdx)); } out.writeShort(classIdx); out.writeShort(typoidIdx); out.writeInt(nameIdx); }
/** {@inheritDoc} */ @Override public final void writeTo(DexFile file, AnnotatedOutput out) { TypeIdsSection typeIds = file.getTypeIds(); StringIdsSection stringIds = file.getStringIds(); CstNat nat = cst.getNat(); int classIdx = typeIds.indexOf(getDefiningClass()); int nameIdx = stringIds.indexOf(nat.getName()); int typoidIdx = getTypoidIdx(file); if (out.annotates()) { out.annotate(0, indexString() + ' ' + cst.toHuman()); out.annotate(2, " class_idx: " + Hex.u2(classIdx)); out.annotate(2, String.format(" %-10s %s", getTypoidName() + ':', Hex.u2(typoidIdx))); out.annotate(4, " name_idx: " + Hex.u4(nameIdx)); } out.writeShort(classIdx); out.writeShort(typoidIdx); out.writeInt(nameIdx); }
/** {@inheritDoc} */ @Override public final void writeTo(DexFile file, AnnotatedOutput out) { TypeIdsSection typeIds = file.getTypeIds(); StringIdsSection stringIds = file.getStringIds(); CstNat nat = cst.getNat(); int classIdx = typeIds.indexOf(getDefiningClass()); int nameIdx = stringIds.indexOf(nat.getName()); int typoidIdx = getTypoidIdx(file); if (out.annotates()) { out.annotate(0, indexString() + ' ' + cst.toHuman()); out.annotate(2, " class_idx: " + Hex.u2(classIdx)); out.annotate(2, String.format(" %-10s %s", getTypoidName() + ':', Hex.u2(typoidIdx))); out.annotate(4, " name_idx: " + Hex.u4(nameIdx)); } out.writeShort(classIdx); out.writeShort(typoidIdx); out.writeInt(nameIdx); }
/** {@inheritDoc} */ @Override public final void writeTo(DexFile file, AnnotatedOutput out) { TypeIdsSection typeIds = file.getTypeIds(); StringIdsSection stringIds = file.getStringIds(); CstNat nat = cst.getNat(); int classIdx = typeIds.indexOf(getDefiningClass()); int nameIdx = stringIds.indexOf(nat.getName()); int typoidIdx = getTypoidIdx(file); if (out.annotates()) { out.annotate(0, indexString() + ' ' + cst.toHuman()); out.annotate(2, " class_idx: " + Hex.u2(classIdx)); out.annotate(2, String.format(" %-10s %s", getTypoidName() + ':', Hex.u2(typoidIdx))); out.annotate(4, " name_idx: " + Hex.u4(nameIdx)); } out.writeShort(classIdx); out.writeShort(typoidIdx); out.writeInt(nameIdx); }
/** {@inheritDoc} */ @Override public final void writeTo(DexFile file, AnnotatedOutput out) { TypeIdsSection typeIds = file.getTypeIds(); StringIdsSection stringIds = file.getStringIds(); CstNat nat = cst.getNat(); int classIdx = typeIds.indexOf(getDefiningClass()); int nameIdx = stringIds.indexOf(nat.getName()); int typoidIdx = getTypoidIdx(file); if (out.annotates()) { out.annotate(0, indexString() + ' ' + cst.toHuman()); out.annotate(2, " class_idx: " + Hex.u2(classIdx)); out.annotate(2, String.format(" %-10s %s", getTypoidName() + ':', Hex.u2(typoidIdx))); out.annotate(4, " name_idx: " + Hex.u4(nameIdx)); } out.writeShort(classIdx); out.writeShort(typoidIdx); out.writeInt(nameIdx); }