尝试发送电子邮件时收到错误

时间:2011-10-18 07:11:34

标签: java android

我的代码是......

public class AndroidEmailActivity extends Activity {

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        final EditText edittextEmailAddress = (EditText) findViewById(R.id.email_address);
        final EditText edittextEmailSubject = (EditText) findViewById(R.id.email_subject);
        final EditText edittextEmailText = (EditText) findViewById(R.id.email_text);
        Button buttonSendEmail_intent = (Button) findViewById(R.id.sendemail_intent);

        buttonSendEmail_intent.setOnClickListener(new Button.OnClickListener() {

            @Override
            public void onClick(View arg0) {
                // TODO Auto-generated method stub

                String emailAddress = edittextEmailAddress.getText().toString();
                String emailSubject = edittextEmailSubject.getText().toString();
                String emailText = edittextEmailText.getText().toString();

                String emailAddressList[] = { emailAddress };

                Intent intent = new Intent(Intent.ACTION_SEND);
                intent.setType("plain/text");
                intent.putExtra(Intent.EXTRA_EMAIL, emailAddressList);
                intent.putExtra(Intent.EXTRA_SUBJECT, emailSubject);
                intent.putExtra(Intent.EXTRA_TEXT, emailText);
                startActivity(Intent.createChooser(intent,
                        "Choice App t send email:"));

            }
        });
    }
}

我在控制台窗口中收到错误

[2011-10-18 12:43:54 - AndroidEmail] Re-installation failed due to different application signatures.
[2011-10-18 12:43:54 - AndroidEmail] You must perform a full uninstall of the application. WARNING: This will remove the application data!
[2011-10-18 12:43:54 - AndroidEmail] Please execute 'adb uninstall com.android.email' in a shell.
[2011-10-18 12:43:54 - AndroidEmail] Launch canceled!

2 个答案:

答案 0 :(得分:2)

我认为发生此错误是因为应用程序已经从另一台计算机安装在设备中。要首先解决此问题,您需要卸载该应用程序,然后尝试安装新的应用程序。

答案 1 :(得分:0)

这似乎是您尝试在已使用不同钥匙串密钥创建相同应用程序的设备上运行该应用程序。请从设备/模拟器中卸载应用程序并再次运行。它会起作用。