我正在写一些测试,我遇到了一个问题:
java.lang.NoSuchMethodError:没有虚方法 primeId(Ljava /郎/字符串;)/登机证/登机证$生成器;
我认为这是来自Proguard。我不知道如何让它发挥作用。 在我的proguard文件中,我说:
-keep class com.boardingpass.BoardingPass { *; }
-keepclassmembers class com.boardingpass.BoardingPass.Builder { *; }
以下是BoardingPass类的代码:
@SuppressWarnings({"PMD.ShortVariable", "checkstyle:finalclass"})
public class BoardingPass implements Parcelable, Serializable {
private static final long serialVersionUID = -687991496884005033L;
public static final Creator<BoardingPass> CREATOR = new Creator<BoardingPass>() {
@Override
public BoardingPass createFromParcel(Parcel in) {
return new BoardingPass(in);
}
@Override
public BoardingPass[] newArray(int size) {
return new BoardingPass[size];
}
};
public static final class Builder {
private String primeId;
private String qr;
private byte[] qrCode;
private String deck;
private String aircraftType;
private String airlineUse;
private String departureGate;
private String departureAirport;
private String cabin;
private String eTicketNumber;
private String seatNumber;
private String bookingReference;
private String departureDate;
private String scheduledArrivalTime;
private String departureTerminal;
private String offPoint;
private String fullName;
private String boardPoint;
private boolean isA380;
private String boardingDateTime;
private String membershipNo;
private String boardPointCode;
private String flightNumber;
private String boardingZone;
private String scheduledDepartureTime;
private String offPointCode;
private String arrivalAirport;
private String loungeText;
private String operatingAirline;
public Builder() {
}
public Builder primeId(String val) {
primeId = val;
return this;
}
@SuppressWarnings("PMD.ShortMethodName")
public Builder qr(String val) {
qr = val;
return this;
}
@SuppressWarnings("PMD.ArrayIsStoredDirectly")
public Builder qrCode(byte[] val) {
qrCode = val;
return this;
}
public Builder deck(String val) {
deck = val;
return this;
}
public Builder aircraftType(String val) {
aircraftType = val;
return this;
}
public Builder airlineUse(String val) {
airlineUse = val;
return this;
}
public Builder departureGate(String val) {
departureGate = val;
return this;
}
public Builder departureAirport(String val) {
departureAirport = val;
return this;
}
public Builder cabin(String val) {
cabin = val;
return this;
}
public Builder eTicketNumber(String val) {
eTicketNumber = val;
return this;
}
public Builder seatNumber(String val) {
seatNumber = val;
return this;
}
public Builder bookingReference(String val) {
bookingReference = val;
return this;
}
public Builder departureDate(String val) {
departureDate = val;
return this;
}
public Builder scheduledArrivalTime(String val) {
scheduledArrivalTime = val;
return this;
}
public Builder departureTerminal(String val) {
departureTerminal = val;
return this;
}
public Builder offPoint(String val) {
offPoint = val;
return this;
}
public Builder fullName(String val) {
fullName = val;
return this;
}
public Builder boardPoint(String val) {
boardPoint = val;
return this;
}
public Builder isA380(boolean val) {
isA380 = val;
return this;
}
public Builder boardingDateTime(String val) {
boardingDateTime = val;
return this;
}
public Builder membershipNo(String val) {
membershipNo = val;
return this;
}
public Builder boardPointCode(String val) {
boardPointCode = val;
return this;
}
public Builder flightNumber(String val) {
flightNumber = val;
return this;
}
public Builder boardingZone(String val) {
boardingZone = val;
return this;
}
public Builder scheduledDepartureTime(String val) {
scheduledDepartureTime = val;
return this;
}
public Builder offPointCode(String val) {
offPointCode = val;
return this;
}
public Builder arrivalAirport(String val) {
arrivalAirport = val;
return this;
}
public Builder loungeText(String val) {
loungeText = val;
return this;
}
public Builder operatingAirline(String val) {
operatingAirline = val;
return this;
}
public BoardingPass build() {
return new BoardingPass(this);
}
}
@SerializedName("primeId")
private String primeId;
@SerializedName("qrImage")
private String qr;
private transient byte[] qrCode;
@SerializedName("deck")
private String deck;
@SerializedName("aircraftType")
private String aircraftType;
@SerializedName("airlineUse")
private String airlineUse;
@SerializedName("departureGate")
private String departureGate;
@SerializedName("departureAirport")
private String departureAirport;
@SerializedName("cabin")
private String cabin;
@SerializedName("eTicketNumber")
private String eTicketNumber;
@SerializedName("seatNumber")
private String seatNumber;
@SerializedName("bookingReference")
private String bookingReference;
@SerializedName("departureDate")
private String departureDate;
@SerializedName("scheduledArrivalTime")
private String scheduledArrivalTime;
@SerializedName("departureTerminal")
private String departureTerminal;
@SerializedName("offPoint")
private String offPoint;
@SerializedName("fullName")
private String fullName;
@SerializedName("boardPoint")
private String boardPoint;
@SerializedName("isA380")
private boolean isA380;
@SerializedName("boardingDateTime")
private String boardingDateTime;
@SerializedName("membershipNo")
private String membershipNo;
@SerializedName("boardPointCode")
private String boardPointCode;
@SerializedName("flightNumber")
private String flightNumber;
@SerializedName("boardingZone")
private String boardingZone;
@SerializedName("scheduledDepartureTime")
private String scheduledDepartureTime;
@SerializedName("offPointCode")
private String offPointCode;
@SerializedName("arrivalAirport")
private String arrivalAirport;
@SerializedName("loungeText")
private String loungeText;
@SerializedName("operatingAirline")
private String operatingAirline;
private BoardingPass(Parcel in) {
primeId = in.readString();
qr = in.readString();
deck = in.readString();
aircraftType = in.readString();
airlineUse = in.readString();
departureGate = in.readString();
departureAirport = in.readString();
cabin = in.readString();
eTicketNumber = in.readString();
seatNumber = in.readString();
bookingReference = in.readString();
departureDate = in.readString();
scheduledArrivalTime = in.readString();
departureTerminal = in.readString();
offPoint = in.readString();
fullName = in.readString();
boardPoint = in.readString();
isA380 = in.readByte() != 0;
boardingDateTime = in.readString();
membershipNo = in.readString();
boardPointCode = in.readString();
flightNumber = in.readString();
boardingZone = in.readString();
scheduledDepartureTime = in.readString();
offPointCode = in.readString();
arrivalAirport = in.readString();
loungeText = in.readString();
operatingAirline = in.readString();
}
private BoardingPass(Builder builder) {
primeId = builder.primeId;
qr = builder.qr;
qrCode = builder.qrCode;
deck = builder.deck;
aircraftType = builder.aircraftType;
airlineUse = builder.airlineUse;
departureGate = builder.departureGate;
departureAirport = builder.departureAirport;
cabin = builder.cabin;
eTicketNumber = builder.eTicketNumber;
seatNumber = builder.seatNumber;
bookingReference = builder.bookingReference;
departureDate = builder.departureDate;
scheduledArrivalTime = builder.scheduledArrivalTime;
departureTerminal = builder.departureTerminal;
offPoint = builder.offPoint;
fullName = builder.fullName;
boardPoint = builder.boardPoint;
isA380 = builder.isA380;
boardingDateTime = builder.boardingDateTime;
membershipNo = builder.membershipNo;
boardPointCode = builder.boardPointCode;
flightNumber = builder.flightNumber;
boardingZone = builder.boardingZone;
scheduledDepartureTime = builder.scheduledDepartureTime;
offPointCode = builder.offPointCode;
arrivalAirport = builder.arrivalAirport;
loungeText = builder.loungeText;
operatingAirline = builder.operatingAirline;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(primeId);
dest.writeString(qr);
dest.writeString(deck);
dest.writeString(aircraftType);
dest.writeString(airlineUse);
dest.writeString(departureGate);
dest.writeString(departureAirport);
dest.writeString(cabin);
dest.writeString(eTicketNumber);
dest.writeString(seatNumber);
dest.writeString(bookingReference);
dest.writeString(departureDate);
dest.writeString(scheduledArrivalTime);
dest.writeString(departureTerminal);
dest.writeString(offPoint);
dest.writeString(fullName);
dest.writeString(boardPoint);
dest.writeByte((byte) (isA380 ? 1 : 0));
dest.writeString(boardingDateTime);
dest.writeString(membershipNo);
dest.writeString(boardPointCode);
dest.writeString(flightNumber);
dest.writeString(boardingZone);
dest.writeString(scheduledDepartureTime);
dest.writeString(offPointCode);
dest.writeString(arrivalAirport);
dest.writeString(loungeText);
dest.writeString(operatingAirline);
}
@Override
public int describeContents() {
return 0;
}
public byte[] getQrCode() {
if (qrCode == null) {
qrCode = Base64.decode(qr, Base64.DEFAULT);
}
return qrCode;
}
public String getPrimeId() {
return primeId;
}
public String getDeck() {
return deck;
}
public String getAircraftType() {
return aircraftType;
}
public String getAirlineUse() {
return airlineUse;
}
public String getDepartureGate() {
return departureGate;
}
public String getDepartureAirport() {
return departureAirport;
}
public String getCabin() {
return cabin;
}
public String geteTicketNumber() {
return eTicketNumber;
}
public String getSeatNumber() {
return seatNumber;
}
public String getBookingReference() {
return bookingReference;
}
public String getDepartureDate() {
return departureDate;
}
public String getScheduledArrivalTime() {
return scheduledArrivalTime;
}
public String getDepartureTerminal() {
return departureTerminal;
}
public String getOffPoint() {
return offPoint;
}
public String getFullName() {
return fullName;
}
public String getBoardPoint() {
return boardPoint;
}
public boolean isA380() {
return isA380;
}
public String getBoardingDateTime() {
return boardingDateTime;
}
public String getMembershipNo() {
return membershipNo;
}
public String getBoardPointCode() {
return boardPointCode;
}
public String getFlightNumber() {
return flightNumber;
}
public String getBoardingZone() {
return boardingZone;
}
public String getScheduledDepartureTime() {
return scheduledDepartureTime;
}
public String getOffPointCode() {
return offPointCode;
}
public String getArrivalAirport() {
return arrivalAirport;
}
public String getLoungeText() {
return loungeText;
}
public String getOperatingAirline() {
return operatingAirline;
}
}
我认为这会保留这些方法,因为我认为正在发生的事情是构建器中的primeId仅用于此处,所以Proguard可能会将其删除吗?
感谢任何帮助