在发布模式下抛出异常

时间:2016-06-28 05:53:05

标签: android

`enter code here`    06-28 11:13:00.586 13226-14416/com.example.android_javed.plp_calculator2 D/HDFC: GCM ID: 
    06-28 11:13:00.726 13226-14416/com.example.android_javed.plp_calculator2 I/art: Verification error in c.a.a.j.f c.a.a.f.b.a.I()
    06-28 11:13:00.726 13226-14416/com.example.android_javed.plp_calculator2 I/art: 'this' argument 'Unresolved And Uninitialized Reference: org.apache.http.protocol.ImmutableHttpProcessor Allocation PC: 45' not instance of 'Unresolved Reference: org.apache.http.protocol.ImmutableHttpProcessor'
    06-28 11:13:00.726 13226-14416/com.example.android_javed.plp_calculator2 I/art: c.a.a.j.f c.a.a.f.b.a.I() failed to verify: register v4 has type Precise Reference: c.a.a.p[] but expected Reference: org.apache.http.HttpRequestInterceptor[]
    06-28 11:13:00.736 13226-14416/com.example.android_javed.plp_calculator2 E/art: Verification failed on class c.a.a.f.b.a in /data/app/com.example.android_javed.plp_calculator2-2/base.apk because: Verifier rejected class c.a.a.f.b.a due to bad method c.a.a.j.f c.a.a.f.b.a.I()
    06-28 11:13:00.736 13226-14416/com.example.android_javed.plp_calculator2 E/art: Rejecting class c.a.a.f.b.i that attempts to sub-class erroneous class c.a.a.f.b.a in /data/app/com.example.android_javed.plp_calculator2-2/base.apk
    06-28 11:13:00.736 13226-14416/com.example.android_javed.plp_calculator2 E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #4
                                                                                               Process: com.example.android_javed.plp_calculator2, PID: 13226
                                                                                               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:818)
                                                                                                Caused by: java.lang.VerifyError: Rejecting class c.a.a.f.b.i that attempts to sub-class erroneous class c.a.a.f.b.a (declaration of 'c.a.a.f.b.i' appears in /data/app/com.example.android_javed.plp_calculator2-2/base.apk)
                                                                                                   at d.f.a(Unknown Source)
                                                                                                   at com.example.android_javed.plp_calculator2.fm.a(Unknown Source)
                                                                                                   at com.example.android_javed.plp_calculator2.fm.doInBackground(Unknown Source)
                                                                                                   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:818) 
                                                                                                Caused by: java.lang.VerifyError: Verifier rejected class c.a.a.f.b.a due to bad method c.a.a.j.f c.a.a.f.b.a.I() (declaration of 'c.a.a.f.b.a' appears in /data/app/com.example.android_javed.plp_calculator2-2/base.apk)
                                                                                                   at d.f.a(Unknown Source) 
                                                                                                   at com.example.android_javed.plp_calculator2.fm.a(Unknown Source) 
                                                                                                   at com.example.android_javed.plp_calculator2.fm.doInBackground(Unknown Source) 
                                                                                                   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:818) 
    06-28 11:13:04.246 13226-13226/com.example.android_javed.plp_calculator2 V/GCMBroadcastReceiver: onReceive: com.google.android.c2dm.intent.REGISTRATION
    06-28 11:13:04.246 13226-13226/com.example.android_javed.plp_calculator2 V/GCMBroadcastReceiver: GCM IntentService class: com.example.android_javed.plp_calculator2.GCMIntentService
    06-28 11:13:04.256 13226-13226/com.example.android_javed.plp_calculator2 V/GCMBaseIntentService: Acquiring wakelock
    06-28 11:13:04.266 13226-13226/com.example.android_javed.plp_calculator2 V/GCMBaseIntentService: Intent service name: GCMIntentService-543353393141 -1
    06-28 11:13:04.266 13226-14630/com.example.android_javed.plp_calculator2 E/GCMRegistrar: internal error: retry receiver class not set yet
    06-28 11:13:04.266 13226-14630/com.example.android_javed.plp_calculator2 V/GCMRegistrar: Registering receiver
    06-28 11:13:04.276 13226-14630/com.example.android_javed.plp_calculator2 D/GCMBaseIntentService: handleRegistration: registrationId = null, error = SERVICE_NOT_AVAILABLE, unregistered = null
    06-28 11:13:04.276 13226-14630/com.example.android_javed.plp_calculator2 D/GCMBaseIntentService: Registration error: SERVICE_NOT_AVAILABLE
    06-28 11:13:04.276 13226-14630/com.example.android_javed.plp_calculator2 D/GCMBaseIntentService: Scheduling registration retry, backoff = 3231 (3000)
    06-28 11:13:04.306 13226-14630/com.example.android_javed.plp_calculator2 V/GCMBaseIntentService: Releasing wakelock
    06-28 11:15:54.916 13226-13226/com.example.android_javed.plp_calculator2 W/IInputConnectionWrapper: beginBatchEdit on inactive InputConnection
    06-28 11:15:54.916 13226-13226/com.example.android_javed.plp_calculator2 W/IInputConnectionWrapper: finishComposingText on inactive InputConnection
    06-28 11:15:54.916 13226-13226/com.example.android_javed.plp_calculator2 W/IInputConnectionWrapper: endBatchEdit on inactive InputConnection
    06-28 11:18:00.776 13226-14416/com.example.android_javed.plp_calculator2 I/Process: Sending signal. PID: 13226 SIG: 9




// this is my class

package com.example.android_javed.plp_calculator2;

import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.os.AsyncTask;
import android.os.Build;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.telephony.TelephonyManager;
import android.util.Log;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.google.android.gcm.GCMRegistrar;

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.List;

import services.AESHelper;
import services.Application_Constants;
import services.JWTToken;
import services.MCrypt;
import services.ServiceHandler;
import services.Shared_Preferences_Class;
import services.Utility;

public class RegisterActivity extends AppCompatActivity
{

    private EditText edt_emp_id;
    private RelativeLayout lay_continue;
    private ProgressDialog regDialog;
    private List<NameValuePair> list_param;
    private String strRegistrUrl = Application_Constants.Main_URL+"xAction=userSignUp";
    private String strEmpCode="",str_user_gcm_reg_no="123",forgot_pass="";
    private Button btn_login;
    private Utility utility;
    private TextView tv_register,tv_bottom_text,tv_action_title;
    private String master_key="1081882EF91SC6045F3B";
    private JWTToken jwtToken;
   private  MCrypt  mcrypt;

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_register);

       /* getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
        getSupportActionBar().setCustomView(R.layout.action_bar_text);*/

        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);


        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setDisplayShowHomeEnabled(true);

        setSupportActionBar(toolbar);
        getSupportActionBar().setTitle("");

        tv_action_title = (TextView) toolbar.findViewById(R.id.tv_action_title);
        tv_action_title.setText("Registration");


        init_views();
        strEmpCode = Shared_Preferences_Class.readString(getApplicationContext(),Shared_Preferences_Class.EMPLOYEE_CODE,"");

        master_key = md5(master_key);

        try {
            if(!strEmpCode.equals("")&&!strEmpCode.equals(null))
            {
                strEmpCode = AESHelper.decrypt(Application_Constants.SEEDVALUE, strEmpCode);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

        toolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onBackPressed();
            }
        });

       /* if(!strEmpCode.equals("")&&!strEmpCode.equals(null))
        {
            Intent intent = new Intent(RegisterActivity.this,MainActivity.class);
            startActivity(intent);
            finish();
        }
        else
        {
            GCMRegistrar.checkDevice(this);
            GCMRegistrar.checkManifest(this);

            GCMRegistrar.register(RegisterActivity.this,
                    GCMIntentService.SENDER_ID);


            str_user_gcm_reg_no = GCMIntentService.REGISTRAION_ID;
            String gcmreg = str_user_gcm_reg_no;

            String imeistring= utility.getDeviceId();
        }*/

        toolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onBackPressed();
            }
        });



        Intent intent = getIntent();

        if(intent.getExtras()!=null)
        {
            forgot_pass = intent.getStringExtra("forgot_pass");
           // tv_register.setText(forgot_pass);
            tv_action_title.setText(forgot_pass);
            tv_bottom_text.setText("Your Employee ID is be your  Username");

        }

        // status bar color change
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
        {
            Window window = getWindow();
            window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
            window.setStatusBarColor(getResources().getColor(R.color.colorPrimaryDark));
        }

        lay_continue.setOnClickListener(new View.OnClickListener()
        {
            @Override
            public void onClick(View v)
            {

                    strEmpCode = edt_emp_id.getText().toString().trim();
                    if(!strEmpCode.equals("")&&!strEmpCode.equals(null))
                    {
                        if(utility.checkInternet())
                        {


                            new Register(strEmpCode,master_key).execute();
                        }
                        else
                        {
                            Toast.makeText(RegisterActivity.this, "Please connect to internet", Toast.LENGTH_SHORT).show();
                        }

                    }
                    else
                    {
                        edt_emp_id.setError("Enter employee code");
                    }
                }



               /* Intent intent = new Intent(RegisterActivity.this,OTPActivity.class);
                startActivity(intent);*/


        });
        btn_login.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                Intent intent = new Intent(RegisterActivity.this, LoginActivity.class);
                startActivity(intent);
            }
        });
    }

    public static final String md5(final String s)
    {
        final String MD5 = "MD5";
        try {
            // Create MD5 Hash
            MessageDigest digest = java.security.MessageDigest
                    .getInstance(MD5);
            digest.update(s.getBytes());
            byte messageDigest[] = digest.digest();

            // Create Hex String
            StringBuilder hexString = new StringBuilder();
            for (byte aMessageDigest : messageDigest) {
                String h = Integer.toHexString(0xFF & aMessageDigest);
                while (h.length() < 2)
                    h = "0" + h;
                hexString.append(h);
            }
            return hexString.toString();

        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        }
        return "";
    }



    public void init_views()
    {
        edt_emp_id = (EditText) findViewById(R.id.edt_emp_id);

        // change underline color of editext
        edt_emp_id.getBackground().setColorFilter(Color.parseColor("#7DB8F3"), PorterDuff.Mode.SRC_IN);
        lay_continue = (RelativeLayout) findViewById(R.id.lay_continue);
        btn_login = (Button) findViewById(R.id.btn_login);
        tv_register = (TextView) findViewById(R.id.tv_register);
        tv_bottom_text= (TextView) findViewById(R.id.tv_bottom_text);

        // array list initialization

        list_param = new ArrayList<>();
        utility = new Utility(getApplicationContext());
        jwtToken = new JWTToken(getApplicationContext());
        mcrypt= new MCrypt();

        GCMRegistrar.checkDevice(RegisterActivity.this);
        GCMRegistrar.checkManifest(RegisterActivity.this);

        GCMRegistrar.register(RegisterActivity.this,
                GCMIntentService.SENDER_ID);

        str_user_gcm_reg_no = GCMIntentService.REGISTRAION_ID;
        String gcmreg = str_user_gcm_reg_no;

        Log.d("HDFC", "GCM ID: " + str_user_gcm_reg_no);




        String imeistring= utility.getDeviceId();

    }



    class Register extends AsyncTask<String, String, String>
    {
        String str_json,strStatus="",strMsg="",server_jwt_token;
        String strEmpCode="",user_mobile,employee_name,employee_email,employee_code,master_key;


        public Register(String strEmpCode,String master_key)
        {
            this.strEmpCode = strEmpCode;
            this.master_key=master_key;

        }


        @Override
        protected void onPreExecute()
        {
            // TODO Auto-generated method stub
            super.onPreExecute();
            /*pDialog = new ProgressDialog(LoginActivity.this);
            pDialog.setTitle("Loading");
            pDialog.setMessage("Loading Please Wait...");
            pDialog.setCancelable(false);
            pDialog.show();*/

            regDialog = new ProgressDialog(RegisterActivity.this, R.style.MyTheme);
            regDialog.setCancelable(false);
            regDialog.setProgressStyle(android.R.style.Widget_ProgressBar_Small);
            regDialog.show();

        }

        @Override
        protected String doInBackground(String... params)
        {
            // TODO Auto-generated method stub

//我在本节中收到错误

                ServiceHandler sh = new ServiceHandler(getApplicationContext());
                //String str = Shared_Preferences_Class.USER_ID;
                str_user_gcm_reg_no = Shared_Preferences_Class.readString(RegisterActivity.this,Shared_Preferences_Class.GCM_REG_ID,"");
                Log.d("HDFC", "GCM ID: " + str_user_gcm_reg_no);

                String strJwtToken = jwtToken.getJWTToken();

                list_param.add(new BasicNameValuePair("employe_code", strEmpCode));
                list_param.add(new BasicNameValuePair("gcm_id", str_user_gcm_reg_no));
                list_param.add(new BasicNameValuePair("master_key", master_key));
                list_param.add(new BasicNameValuePair("jwtToken", strJwtToken));


                try {
                    str_json = sh.makeServiceCall(strRegistrUrl, ServiceHandler.POST, list_param);
                    JSONObject jobject = new JSONObject(str_json);
                    server_jwt_token= jobject.getString("server_jwt_token");
                    strStatus = jobject.getString("status");

                    // decrypt
                    try {

                        strStatus = new String( mcrypt.decrypt( strStatus ), "UTF-8" );
                /*  String  str_strStatus = new String(mcrypt.decrypt(strStatus));
                    System.out.print(str_strStatus);*/

                    }
                    catch (Exception e)
                    {
                        e.printStackTrace();
                    }




                    if(jwtToken.decryptJWTToken(server_jwt_token))
                    {

                        if (strStatus.equalsIgnoreCase("success"))
                        {

                            employee_code = jobject.getString("employee_code");
                            user_mobile = jobject.getString("mobile_no");

                            strMsg = jobject.getString("msg");

                            // decrypt
                            try {

                                employee_code = new String( mcrypt.decrypt(employee_code) );
                                user_mobile = new String( mcrypt.decrypt(user_mobile) );

                                strMsg = new String( mcrypt.decrypt(strMsg) );

                            } catch (Exception e) {
                                e.printStackTrace();
                            }


                        } else if (strStatus.equalsIgnoreCase("fail"))
                        {
                            strMsg = jobject.getString("msg");
                            // decrypt
                            try {



                                strMsg = new String( mcrypt.decrypt(strMsg) );

                            } catch (Exception e) {
                                e.printStackTrace();
                            }

                        }
                    }
                    else
                    {
                        strStatus = "fail";
                    }

                } catch (JSONException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }





            return null;
        }

        @Override
        protected void onPostExecute(String result)
        {
            // TODO Auto-generated method stub
            //pDialog.dismiss();
            //System.out.println(str_json);
            regDialog.dismiss();
            super.onPostExecute(result);

            try
            {

                if (strStatus.equalsIgnoreCase("success"))
                {

                    try {
                        if(!employee_code.equals("")&&!employee_code.equals(null))
                        {
                            //employee_code = utility.convertStringToBase64(employee_code);
                           // user_mobile= AESHelper.encrypt(Application_Constants.SEEDVALUE, user_mobile);
                            employee_code = AESHelper.encrypt(Application_Constants.SEEDVALUE, employee_code);

                        }
                    }
                    catch (Exception e)
                    {
                        e.printStackTrace();
                    }

                    Shared_Preferences_Class.writeString(RegisterActivity.this,Shared_Preferences_Class.EMPLOYEE_CODE,employee_code);

                    Intent intent = new Intent(RegisterActivity.this,OTPActivity.class);
                    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
                    intent.putExtra("userMobile",user_mobile);
                    startActivity(intent);
                    finish();

                }
                else if (strStatus.equalsIgnoreCase("fail"))
                {

                    Toast.makeText(getApplicationContext(), strMsg, Toast.LENGTH_SHORT).show();

                }
                else
                {
                    //Toast.makeText(getApplicationContext(), str_msg,Toast.LENGTH_SHORT).show();
                }

                if (str_json == null)
                {
                    Toast.makeText(getApplicationContext(), "This may be server issue", Toast.LENGTH_SHORT).show();
                }

            }
            catch(Exception e)
            {
                e.printStackTrace();
            }




        }

    }

}

// aftre编译此代码后出现以下错误 E / art:拒绝类c.a.a.f.b.i尝试在/data/app/com.example.android_javed.plp_calculator2-2/base.apk

中对错误的类c.a.a.f.b.a进行子类化

1 个答案:

答案 0 :(得分:1)

您的代码存在的问题是,当您使用

时,您使用的类不会包含在您的apk中
  

缩小为真

因此将其更改为false但如果您需要以下课程,则只需在proguard设置中保持相同的参数