我收到 transformClassesWithRealmTransformerForDebug 错误

I get an transformClassesWithRealmTransformerForDebug error

这是我得到的错误: 错误:

Execution failed for task ':passenger:transformClassesWithRealmTransformerForDebug'.
javassist.CannotCompileException: updateVehicle (Landroid/content/Context;Ljava/lang/Integer;Lnl/hgrams/passenger/model/Vehicle;Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/List;Lnl/hgrams/passenger/interfaces/JsonCallback;)V in nl.hgrams.passenger.model.UserVehicle: failed to resolve types

现在我看到最新版本的 Realm 确实支持在 realmObject 中包含函数。 我里面有这个函数导致崩溃:

    public void updateVehicle(Context context, Integer userID, Vehicle newVehicle, Integer vclass, String newCountry, String newLicense, String newImage, List<MileageRates> mileageRates, final JsonCallback jsonCallback) {
    try{
        JSONObject params = createJsonForUpdate(context,newVehicle, vclass, newCountry, newLicense, newImage, mileageRates);
        Log.i("","vehicle params is:" + params.toString());
        WSCalls.sendData(Request.Method.POST, Constants.API_ENDPOINT + "/users/" + userID + "/vehicles/" + id + "/update", params ,  context, null, true, new JsonCallback() {
            @Override
            public void onResponse(JSONObject jsonObject, VolleyError error, String errorMsg) {
                if(jsonCallback != null)
                    jsonCallback.onResponse(jsonObject,error,errorMsg);
            }
        });
    }catch (Exception e){
        Log.e("","error updating vehicle:" + e.getMessage());
    }
}

如果我注释掉 WScall.sendData,那么它将起作用。 这是方法:

 public static void sendData(final Integer type , final String url, final JSONObject params, final Context context, final  View loader, boolean hasAllURL , final JsonCallback listener){
    String URL = Constants.API_ENDPOINT + url;
    if(hasAllURL){
        URL = url;
    }
    final String URL2 = URL;
    Log.i(TAG, "test offline sendData - url:: " + URL);
    if(params != null) {
        Log.i(TAG, "test offline sendData - params: " + params.toString());
    }
    JsonObjectRequest jr = new JsonObjectRequest(type, URL, params, new Response.Listener<JSONObject>() {
        @Override
        public void onResponse(JSONObject response) {
            Log.i(TAG, "sendData Response: " + response.toString());
            Utils.logWSResponse("POST", URL2, 200, response.toString(), header);
            try{
                if(Utils.WSValidator(response)){
                    if(loader!= null)
                        loader.setVisibility(View.GONE);
                    if(listener != null)
                        listener.onResponse(response, null, null);
                }else{
                    if(listener != null)
                        listener.onResponse(response,null, null);
                    Log.i("","test offline data:" + response.toString());
                    Utils.appendLog("send data response not VALID",true);
                }
            }catch (Exception e){
                Utils.appendLog("send data error: " + e.getMessage(),true);
                Log.e(TAG, "JsonException: " + e.getMessage());
            }
        }
    }, new Response.ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {
            String json = null;
            if(loader!= null)
                loader.setVisibility(View.GONE);
            if(error != null && error.networkResponse != null) {
                Utils.appendLog("WSCALL send data done, ERROR stop STATUS CODE" + error.networkResponse.statusCode, true);
                json = new String(error.networkResponse.data);
                json = trimMessage(json, "message");
                if (json != null) {
                    Utils.logWSResponse("POST", URL2, error.networkResponse.statusCode, json, header);
                }
                Log.i(TAG, "checkout valid send data Volley error response: " + json);
                if(error.networkResponse.statusCode == 401 && PSLocationCenter.getInstance().pref.getAuthenticationToken() != null){
                    PSLocationCenter.getInstance().pref.setFbConnected(context, false);
                    if(PSSocialService.getInstance().fbSession != null){
                        PSSocialService.getInstance().fbSession.closeAndClearTokenInformation();
                    }
                    PSUserService.getInstance(context).finishLogOut();
                    return;
                }
            }
            if(listener != null)
                listener.onResponse(null, error, json);
        }
    }){
        @Override
        public Map<String, String> getHeaders() throws AuthFailureError {
            PassengerPreferencesManager pref = new PassengerPreferencesManager(context);
            if(pref.getAuthenticationToken() != null){
                return getHeaderData(pref, context);
            }else{
                return super.getHeaders();
            }
        }
    };
    if (Utils.networkIsAvailable( context)) {
        try{
            header = jr.getHeaders().toString();
            Utils.logWSRequest("POST", URL, params.toString() ,header);
        }catch (Exception e){
            Log.e("","error volley: " + e.getMessage());
        }
        jr.setRetryPolicy(new DefaultRetryPolicy(60 * 1000, 0, 1));
        PSLocationCenter.getInstance().mRequestQueue.add(jr);
    }
    else {
        if(loader!= null)
            loader.setVisibility(View.GONE);
        Log.i(TAG, "sendData - no internet");
        AlertDialog.show(context, "", context.getString(R.string.no_internet), context.getString(R.string.OK), null);
    }
}

这可以修复吗?或者它不支持非领域对象的方法原因?我试图在里面添加一个非领域对象并且它起作用了。 另外,另一个问题。我可以在我不想添加到数据库中的 realmObject 整数中添加吗?我在函数中使用的值,这样我就不需要在每次使用它们时都调用领域事务?

我有这样的URL:

  Constants.API_ENDPOINT + "/users/" + userID + "/vehicles/" + id + "/update"

如果我设置 getId() 而不是简单的变量,它就可以工作