2011-10-18 58 views
0

我的代码...得到错误尝试发送电子邮件

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! 
+0

可能重复此[thread] [1]。 [1]:http://stackoverflow.com/questions/2887436/re-installation-failed-due-to-different-application-signatures – Saurabh

+0

这只是说,你的应用程序已经安装在手机上。只需卸载您的应用程序,然后重新安装它。 或您手机上的其他应用程序已经使用了您使用的软件包名称。 –

+0

您是否尝试过所提供的解决方案? –

回答

2

我想是因为,应用程序已经在安装时会出现此错误设备从另一台计算机。要首先解决这个问题,你需要卸载应用程序,然后尝试安装新的应用程序。

+0

好的..谢谢..我会试试.. – user977808

0

这看起来好像你正试图在已经使用不同的钥匙串键创建的相同应用程序的设备上运行该应用程序。请从设备/模拟器中卸载应用程序并重新运行。它会工作。