2016-09-25 20 views
0

は、なぜ私はこのエラー私は間違っなぜこのエラーが発生するのですかdoInBackground()を実行中にエラーが発生しました。私は間違っていますか?

An error occured while executing doInBackground()

を取得していますか? LogCatは、ここで私はdoInBackGround機能で任意のUIの仕事をしていないが、私はまだ、このエラーが出る

public class LoginActivity extends AppCompatActivity { 
    private static EditText username_edit_text; 
    private static Button login_button; 
    private static RadioGroup lang_group; 
    RadioButton mar_radio_button; 
    RadioButton eng_radio_button; 
    TextView tv; 
    String lang = "en"; 
    private Locale myLocale; 
    Resources res; 
    private final String NAMESPACE = "http://tempuri.org/"; 
    private final String URL = "http://My_server_ip/MobileLDAP/Service.asmx"; 
    private final String SOAP_ACTION = "http://tempuri.org/OMS_Authenticate_Crew"; 
    private final String METHOD_NAME = "OMS_Authenticate_Crew"; 
    private static String username; 
    private static String resultm; 

    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.activity_login); 
     final ConnectionDetector cd = new ConnectionDetector(); 
     username_edit_text = (EditText) findViewById(R.id.ET_UserName); 
     login_button = (Button) findViewById(R.id.Button_login); 
     lang_group = (RadioGroup) findViewById(R.id.radioType); 
     mar_radio_button = (RadioButton) findViewById(R.id.radioMar); 
     eng_radio_button = (RadioButton) findViewById(R.id.radioEng); 
     tv = (TextView) findViewById(R.id.tv); 
     setTitle(getResources().getString(R.string.app_name)); 
     res = getResources(); 
     final Locale locale = res.getConfiguration().locale; 
     lang_group.setOnCheckedChangeListener(
       new RadioGroup.OnCheckedChangeListener() { 
        @Override 
        public void onCheckedChanged(RadioGroup group, int checkedId) { 
         if (locale.getLanguage().equals("mr")) { 
          mar_radio_button.setEnabled(false); 
          if (eng_radio_button.isChecked()) { 
           lang = "en"; 
           setLocale(lang); 
          } 
         } else { 
          eng_radio_button.setEnabled(false); 
          if (mar_radio_button.isChecked()) { 
           lang = "mr"; 
           setLocale(lang); 
          } 
         } 
        } 
       }); 

     login_button.setOnClickListener(new View.OnClickListener() { 
      @Override 
      public void onClick(View v) { 
       username = username_edit_text.getText().toString(); 
       AsyncCallWS task = new AsyncCallWS(); 
       task.execute(); 
      } 
     }); 
    } 

    protected void isAuthenticate(String Payroll_no) { 
     SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); 
     PropertyInfo Payroll_info = new PropertyInfo(); 
     Payroll_info.setName("Payroll_no"); 
     Payroll_info.setValue(Payroll_no); 
     Payroll_info.setType(double.class); 
     request.addProperty(Payroll_info); 
     SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); 
     envelope.dotNet = true; 
     envelope.setOutputSoapObject(request); 
     HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); 
     try { 
      androidHttpTransport.call(SOAP_ACTION, envelope); 
      SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); 
      resultm = response.toString(); 
     } catch (Exception e) { 
      resultm = e.toString(); 
     } 
    } 

    private class AsyncCallWS extends AsyncTask<String, Void, Void> { 
     @Override 
     protected Void doInBackground(String... params) { 
      isAuthenticate(username); 
      return null; 
     } 

     @Override 
     protected void onPostExecute(Void result) { 
      tv.setText(resultm); 
     } 

     @Override 
     protected void onPreExecute() { 
     } 

     @Override 
     protected void onProgressUpdate(Void... values) { 
     } 
    } 

    public void setLocale(String lang) { 
     myLocale = new Locale(lang); 
     res = getResources(); 
     DisplayMetrics dm = res.getDisplayMetrics(); 
     Configuration conf = res.getConfiguration(); 
     conf.locale = myLocale; 
     res.updateConfiguration(conf, dm); 
     sharedPreferences = getSharedPreferences("CommonPref", Activity.MODE_PRIVATE); 
     Intent refresh = new Intent(getApplicationContext(), LoginActivity.class); 
     startActivity(refresh); 
     finish(); 
    } 
} 

LoginActivity.javaだ

下に表示されます。

LogCat:

09-26 02:20:32.209 27677-27897/com.gis.reliance.customercomplaintreports E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1 
Process: com.gis.reliance.customercomplaintreports, PID: 27677 
java.lang.RuntimeException: An error occured while executing doInBackground() 
at android.os.AsyncTask$3.done(AsyncTask.java:300) 
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355) 
at java.util.concurrent.FutureTask.setException(FutureTask.java:222) 
at java.util.concurrent.FutureTask.run(FutureTask.java:242) 
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 
at java.lang.Thread.run(Thread.java:841) 
Caused by: java.lang.VerifyError: org/ksoap2/SoapEnvelope 
at com.gis.reliance.customercomplaintreports.activity.LoginActivity.isAuthenticate(LoginActivity.java:141) 
at com.gis.reliance.customercomplaintreports.activity.LoginActivity$AsyncCallWS.doInBackground(LoginActivity.java:160) 
at com.gis.reliance.customercomplaintreports.activity.LoginActivity$AsyncCallWS.doInBackground(LoginActivity.java:157) 
at android.os.AsyncTask$2.call(AsyncTask.java:288) 
at java.util.concurrent.FutureTask.run(FutureTask.java:237) 
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)  
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)  
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)  
at java.lang.Thread.run(Thread.java:841)                 
+0

"オフトピック"として閉じる3つの票?本当に?おそらく、これは完全に良い質問であるため投票を閉じる権限を持たない人もいます。 – ShadowGod

+0

@ ShadowGod - それは[mcve]ではありません。エラーは 'isAuthenticate'メソッドにあります。メソッドの呼び出しに関する設定は完全には必要ではありません –

+0

@YogeshKadamは 'isAuthenticate'の' catch'に 'resultm'に代入する代わりに例外のスタックトレースを出力してください –

答えて

1

アプリケーションの実行時にJVMと依存libのJVMのバージョンは異なるべきではありません。

+0

私はボタンのメソッドのユーザー名の値を設定していますそれでもエラーが発生します –

+0

AsyncTaskが実行される前にその変数がクリックリスナーに設定されています –

+0

@ cricket_007まだエラー –

関連する問題