开发者

java.lang.VerifyError occurs on some devices

I have written an Android App for my Company, and as it runs well for me, there are some crash-reports with errors I never had myself. One I don't know how to fix is a java.lang.verifyError in a Service.

the开发者_如何学Python line which is crashing is:

String post_request = ConnectionHelper.getTicketRequestJsonString(true, ticketIdsToDownload);

ConnectionHelper is a class containing only static functions returning Strings. What can I do to fix the problem?

Edit: if helpfull i'll post some Code while not thinking I'm running into "Security Problems"

public static String getTicketRequestJsonString(boolean details, List<String> ticketIds){
    String ticketString = "tickets:[";
    int count = ticketIds.size() - 1;
    for (int i = 0; i <= count; i++){
        String s = ticketIds.get(i);
        ticketString += s
        ticketString += i != count ? "," : "]";
    }
    return ticketString;
}


A VerifyError occurs when Android tries to load a class that refers to things that are not available. An example would be loading a class that refers to Android 3.0 classes, when running on an Android 2.1 device.

What can I do to fix the problem?

Identify what specifically it cannot load, then determine how to deal with that. For example, there are tricks to be able to avoid loading Android 3.0 classes on an Android 2.1 device, while still using the Android 3.0 classes on an Android 3.x device.


i had the same issue here; and finally found that the affected class uses

try {
localIP = InetAddress.getLocalHost().getHostAddress();
} catch (NetworkOnMainThreadException ex) {         
}

This failed with VerifyError on Android 2.3.

removing the use of NetworkOnMainThreadException, it works on 2.3 again.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜