BaseDexClassLoader中的JSONSerializer.toJSON ClassNotFoundException

时间:2014-01-19 14:46:26

标签: java json classnotfoundexception jsonserializer

我遇到了JSONSerializer的问题。 我有这个方法:

public List<BusinessObject> transferToDomain(String pJSON) {
        List<BusinessObject> lAllBusinessObject = new ArrayList<BusinessObject>();
        if (null == pJSON || pJSON.equals("")) {
            return lAllBusinessObject;
        }
        JSON lJSON = JSONSerializer.toJSON(pJSON);
        if (lJSON.isEmpty()) {
            return lAllBusinessObject;
        } else {
            if (lJSON.isArray()) {
                JSONArray lJSONArray = (JSONArray) lJSON;
                for (Object lObject : lJSONArray) {
                    JSONObject lJSONObject = (JSONObject) lObject;
                    lAllBusinessObject.add(doTransfer(lJSONObject));
                }
            } else {
                JSONObject json = (JSONObject) lJSON;
                BusinessObject lBusinessObject = doTransfer(json);
                if (null != lBusinessObject) {
                    lAllBusinessObject.add(lBusinessObject);
                }
            }
        }
        return lAllBusinessObject;
    }

它将JSON-String转换为相关的Business对象。 行JSONSerializer.toJSON(pJSon);运行得非常好,例如Json-Code:

[{"user":{"uid":51,"ustempel":0,"uname":"Stefan47"
    ,"model":"USER"},"points":882,"level":27,"scomment":"Wuhuuuu"
    ,"sid":51,"rank":1,"sstempel":0,"model":"SCORE"},
{"user":{"uid":65,"ustempel":0,"uname":"Stefan61"
    ,"model":"USER"},"points":882,"level":27,"scomment":"Wuhuuuu"
    ,"sid":65,"rank":2,"sstempel":0,"model":"SCORE"},
{"user":{"uid":66,"ustempel":0,"uname":"Stefan62"
    ,"model":"USER"},"points":882,"level":27,"scomment":"Wuhuuuu"
    ,"sid":66,"rank":3,"sstempel":0,"model":"SCORE"},
{"user":{"uid":67,"ustempel":0,"uname":"Stefan63"
    ,"model":"USER"},"points":882,"level":27,"scomment":"Wuhuuuu"
    ,"sid":67,"rank":4,"sstempel":0,"model":"SCORE"},
{"user":{"uid":68,"ustempel":0,"uname":"Stefan64"
    ,"model":"USER"},"points":882,"level":27,"scomment":"Wuhuuuu"
    ,"sid":68,"rank":5,"sstempel":0,"model":"SCORE"},
{"user":{"uid":69,"ustempel":0,"uname":"Stefan65"
    ,"model":"USER"},"points":882,"level":27,"scomment":"Wuhuuuu"
    ,"sid":69,"rank":6,"sstempel":0,"model":"SCORE"},
{"user":{"uid":70,"ustempel":0,"uname":"Stefan66"
    ,"model":"USER"},"points":882,"level":27,"scomment":"Wuhuuuu"
    ,"sid":70,"rank":7,"sstempel":0,"model":"SCORE"},
{"user":{"uid":71,"ustempel":0,"uname":"Stefan67"
    ,"model":"USER"},"points":882,"level":27,"scomment":"Wuhuuuu"
    ,"sid":71,"rank":8,"sstempel":0,"model":"SCORE"},
{"user":{"uid":72,"ustempel":0,"uname":"Stefan68"
    ,"model":"USER"},"points":882,"level":27,"scomment":"Wuhuuuu"
    ,"sid":72,"rank":9,"sstempel":0,"model":"SCORE"},
{"user":{"uid":73,"ustempel":0,"uname":"Stefan69"
    ,"model":"USER"},"points":882,"level":27,"scomment":"Wuhuuuu"
    ,"sid":73,"rank":10,"sstempel":0,"model":"SCORE"}]

但是使用JSON代码:

[{"question":"Wer bist Du?"
    ,"answer1":"Jens"
    ,"answer2":"Anja"
    ,"answer3":"Stefan"
    ,"answer4":"Willi"
    ,"correctAnswer":3,"difficulty":1,"active":true,"deleted":false,"language":"DE"
    ,"key":"DE_QZ"
    ,"cat":"Die Bundesliga"
    ,"qid":1303,"qstempel":1390138057765,"model":"QUESTION"},
{"question":"Wer bist Du?"
    ,"answer1":"Jens"
    ,"answer2":"Anja"
    ,"answer3":"Stefan"
    ,"answer4":"Willi"
    ,"correctAnswer":3,"difficulty":1,"active":true,"deleted":false,"language":"DE"
    ,"key":"DE_QZ"
    ,"cat":"Premiure League"
    ,"qid":1636,"qstempel":1390138059690,"model":"QUESTION"},
{"question":"Wer bist Du?"
    ,"answer1":"Jens"
    ,"answer2":"Anja"
    ,"answer3":"Stefan"
    ,"answer4":"Willi"
    ,"correctAnswer":3,"difficulty":3,"active":true,"deleted":false,"language":"DE"
    ,"key":"DE_QZ"
    ,"cat":"WM"
    ,"qid":1582,"qstempel":1390138059395,"model":"QUESTION"},
{"question":"Wer bist Du?"
    ,"answer1":"Jens"
    ,"answer2":"Anja"
    ,"answer3":"Stefan"
    ,"answer4":"Willi"
    ,"correctAnswer":3,"difficulty":3,"active":true,"deleted":false,"language":"DE"
    ,"key":"DE_QZ"
    ,"cat":"Die Bundesliga"
    ,"qid":1421,"qstempel":1390138058497,"model":"QUESTION"},
{"question":"Wer bist Du?"
    ,"answer1":"Jens"
    ,"answer2":"Anja"
    ,"answer3":"Stefan"
    ,"answer4":"Willi"
    ,"correctAnswer":3,"difficulty":3,"active":true,"deleted":false,"language":"DE"
    ,"key":"DE_QZ"
    ,"cat":"Premiure League"
    ,"qid":1708,"qstempel":1390138060083,"model":"QUESTION"},
{"question":"Wer bist Du?"
    ,"answer1":"Jens"
    ,"answer2":"Anja"
    ,"answer3":"Stefan"
    ,"answer4":"Willi"
    ,"correctAnswer":3,"difficulty":1,"active":true,"deleted":false,"language":"DE"
    ,"key":"DE_QZ"
    ,"cat":"WM"
    ,"qid":1470,"qstempel":1390138058774,"model":"QUESTION"},
{"question":"Wer bist Du?"
    ,"answer1":"Jens"
    ,"answer2":"Anja"
    ,"answer3":"Stefan"
    ,"answer4":"Willi"
    ,"correctAnswer":3,"difficulty":2,"active":true,"deleted":false,"language":"DE"
    ,"key":"DE_QZ"
    ,"cat":"Premiure League"
    ,"qid":1667,"qstempel":1390138059857,"model":"QUESTION"},
{"question":"Wer bist Du?"
    ,"answer1":"Jens"
    ,"answer2":"Anja"
    ,"answer3":"Stefan"
    ,"answer4":"Willi"
    ,"correctAnswer":3,"difficulty":2,"active":true,"deleted":false,"language":"DE"
    ,"key":"DE_QZ"
    ,"cat":"WM"
    ,"qid":1539,"qstempel":1390138059158,"model":"QUESTION"},
{"question":"Wer bist Du?"
    ,"answer1":"Jens"
    ,"answer2":"Anja"
    ,"answer3":"Stefan"
    ,"answer4":"Willi"
    ,"correctAnswer":3,"difficulty":2,"active":true,"deleted":false,"language":"DE"
    ,"key":"DE_QZ"
    ,"cat":"Die Bundesliga"
    ,"qid":1381,"qstempel":1390138058267,"model":"QUESTION"}]

这个例外被抛出,我绝对没有想法为什么???

  

java.lang.ClassNotFoundException:在路径上找不到类“java.beans.PropertyDescriptor”:DexPathList [[zip file“/data/app/bc.qz.client.android-2.apk"],nativeLibraryDirectories = [/ data / app-lib / bc.qz.client.android-2,/ system / lib]]

有人可以给我一些建议吗?为什么会这样?

提前致谢

的Stefan

1 个答案:

答案 0 :(得分:1)

  

java.lang.ClassNotFoundException:在路径上找不到类“java.beans.PropertyDescriptor”:DexPathList [[zip file“/data/app/bc.qz.client.android-2.apk"],nativeLibraryDirectories = [/ data / app-lib / bc.qz.client.android-2,/ system / lib]]

某些内容具有未在一个代码路径中加载但在另一个代码路径中的依赖项。 Android API仅提供Java 6 API的子集:

未提供

PropertyDescriptor。如果您自己的代码不使用此类型,那么很可能您的某个库需要它。