-1

これが私が受け取ったエラーです。

05-16 04:42:07.579: E/dalvikvm(548): Could not find class 'com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext$MyConstraintViolation', referenced from method com.google.web.bindery.requestfactory.shared.impl.AbstractRequestContext$StandardPayloadDialect.processPayload
05-16 04:42:08.209: E/dalvikvm(548): Could not find class 'javax.validation.ConstraintViolation', referenced from method com.google.web.bindery.requestfactory.shared.Receiver.onConstraintViolation

これがメインクラスのコードです。実験用に作成し たHello Toastメッセージの後、動作しなくなります。

package com.ncwitmobileapp;
import com.ncwitmobileapp.R;
import com.ncwitmobileapp.client.MyRequestFactory;
import com.ncwitmobileapp.client.MyRequestFactory.HelloWorldRequest;
import com.ncwitmobileapp.client.MyRequestFactory.NCWITMOBILEAPPRequest;


import com.google.gwt.core.client.GWT;
import com.google.web.bindery.requestfactory.shared.Receiver;
import com.google.web.bindery.requestfactory.shared.ServerFailure;

import android.R.color;
import android.app.Activity;
import android.content.Context;
import android.os.AsyncTask;
import android.os.Bundle;
import android.text.Editable;
import android.util.Log;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;


public class Login_Screen extends Activity
{
    private static final String TAG = "Techchicks";

    /**
     * The current context.
     */
    private Context mContext = this;

    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        requestWindowFeature(Window.FEATURE_NO_TITLE); 
        super.onCreate(savedInstanceState);      
        setContentView(R.layout.logins);

        final Button login = (Button)findViewById(R.id.login);
        login.setOnClickListener(new View.OnClickListener() {
            public void onClick(View lb) {
                //communicate with App Engine
                //goes to the Menu Page

                //gets username and password from user(Editables)

                EditText un=(EditText)findViewById(R.id.username);
                EditText ps=(EditText)findViewById(R.id.password);

                final String username = un.getText().toString();
                final String password = ps.getText().toString();
                final Context context = getApplicationContext();
                CharSequence text = "Hello toast!";
                int duration = Toast.LENGTH_SHORT;


                Toast toast = Toast.makeText(context, text, duration);
                toast.show();



                login.setEnabled(false);
                Log.i(TAG, "preparing request to send to server");
                login.setEnabled(false);
                Log.i(TAG, "preparing request to send to server");

                // Use an AsyncTask to avoid blocking the UI thread
                new AsyncTask<Void, Void, String>() {
                    private String message;

                    @Override
                    protected String doInBackground(Void... arg0) {

                        MyRequestFactory requestFactory = Util.getRequestFactory(mContext, MyRequestFactory.class);

                        final NCWITMOBILEAPPRequest request = requestFactory.nCWITMOBILEAPPRequest();
                        Log.i(TAG, "Sending request to server");
                        request.getAuthenticatedTechicksmember(username, password).fire(new Receiver<String>() {
                            @Override
                            public void onFailure(ServerFailure error) {
                                message = "Failure: " + error.getMessage();
                            }

                            @Override
                            public void onSuccess(String result) {
                                message = result;
                                Log.i(TAG,"got back a hello world message");
                            }
                        });
                        CharSequence tet = message;
                        int duration = Toast.LENGTH_SHORT;


                        Toast toast = Toast.makeText(context, tet, duration);
                        toast.show();
                        return message; 
                    }

                }.execute();

            }
        });

        Button register = (Button)findViewById(R.id.register);
        register.setOnClickListener(new View.OnClickListener() {
            public void onClick(View lb) {
                //goes to the Registration Page
            }
        });

        Button forgotpassword = (Button)findViewById(R.id.forgotpassword);
        forgotpassword.setOnClickListener(new View.OnClickListener() {
            public void onClick(View lb) {
                //goes to the Forgot Password Page
            }
        });
    }
}

サービス クラスのコードは次のとおりです。

package com.ncwitmobileapp.server;

import java.util.List;
import java.util.logging.Logger;

import com.ncwitmobileapp.annotation.ServiceMethod;

public class NCWITMOBILEAPPService {

     private static final Logger log = Logger.getLogger(NCWITMOBILEAPPService.class.getName());

      public NCWITMOBILEAPPService() {
      }

    @ServiceMethod
    public Techicksmember createTechicksmember() {
        // TODO Auto-generated method stub
        return null;
    }

    @ServiceMethod
    public static String getAuthenticatedTechicksmember(String userName, String password) {
         log.info("Called authenticateTechicksmember");
         log.info("userName = " + userName + " password = " + password);
        // return ("Success");

        Datastore db = new  Datastore();
        Techicksmember member = db.find(userName);
        if (member==null){
            return "Member not existant";
        }
        if (member.getPassword()==password){
            return "Identity validated!";
        }

        return "Identity Invalidated";

    }

    @ServiceMethod
    public Techicksmember readTechicksmember(Long id) {
        // TODO Auto-generated method stub
        return null;
    }

    @ServiceMethod
    public Techicksmember updateTechicksmember(Techicksmember techicksmember) {
        // TODO Auto-generated method stub
        return null;
    }

    @ServiceMethod
    public void deleteTechicksmember(Techicksmember techicksmember) {
        // TODO Auto-generated method stub

    }

    @ServiceMethod
    public List<Techicksmember> queryTechicksmembers() {
        // TODO Auto-generated method stub
        return null;
    }

}
4

2 に答える 2

0

ええ、上で述べたように、ビルドパスに必要なjarファイルを含めるだけです。

于 2012-05-16T06:34:05.723 に答える
0

コンパイラは、インポートしようとしているファイルの場所を特定できないようです。ここに見られるようにcom.google.web、Android の標準パッケージではありません。これらのファイルが別の場所にある場合は、ビルド パスを調整してその場所を含める必要がある場合があります。

于 2012-05-16T05:50:21.450 に答える