2011-10-18 68 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

這看起來好像你正試圖在已經使用不同的鑰匙串鍵創建的相同應用程序的設備上運行該應用程序。請從設備/模擬器中卸載應用程序並重新運行。它會工作。