0

I have been getting this error in my application for quite a sometime now at few client devices. I have posted a related question Here but found not useful answer.

After weeks of research and testing, i reproduce this error at development machine.

On login activity, after user insert required credentials and click Login button, I am running a AsyncTask to validate the credentials over the server. In between i am showing ProgressDialog to the user. In case if am locked the device during doInBackground execution using device hardware lock key or it dims by own and lock, PostExecute method throws exception. Following is code snippet of PostExecute. Normally without Locking the device it works well

if(EveryThing Goes Well) 
{                     
    progressDialogUtil.Dismiss();
    Intent selectBikeActivity = new Intent(getApplicationContext(), SelectBike.class);
    startActivity(selectBikeActivity); // Here Raised Exception
    finish();
}
......

StackTrace is

 android.content.ActivityNotFoundException: Unable to find explicit activity class {com.yego.motodriver/com.yego.motodriver.SelectBike}; have you declared this activity in your AndroidManifest.xml?
                                                 at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1805)
                                                 at android.app.Instrumentation.execStartActivity(Instrumentation.java:1523)
                                                 at android.app.Activity.startActivityForResult(Activity.java:3968)
                                                 at android.support.v4.app.BaseFragmentActivityJB.startActivityForResult(BaseFragmentActivityJB.java:50)
                                                 at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:79)
                                                 at android.app.Activity.startActivityForResult(Activity.java:3920)
                                                 at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:859)
                                                 at android.app.Activity.startActivity(Activity.java:4259)
                                                 at android.app.Activity.startActivity(Activity.java:4227)
                                                 at com.yego.motodriver.Login.HandleLoginResponse(Login.java:502)
                                                 at com.yego.motodriver.Login.access$300(Login.java:61)
                                                 at com.yego.motodriver.Login$4.onGRPCTaskCompleted(Login.java:233)
                                                 at com.yego.util.GrpcTask.onPostExecute(GrpcTask.java:297)
                                                 at com.yego.util.GrpcTask.onPostExecute(GrpcTask.java:38)
                                                 at android.os.AsyncTask.finish(AsyncTask.java:651)
                                                 at android.os.AsyncTask.-wrap1(AsyncTask.java)
                                                 at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:668)
                                                 at android.os.Handler.dispatchMessage(Handler.java:111)
                                                 at android.os.Looper.loop(Looper.java:207)
                                                 at android.app.ActivityThread.main(ActivityThread.java:5742)
                                                 at java.lang.reflect.Method.invoke(Native Method)
                                                 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
                                                 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)

How to avoid this Exception ?

Rajeev Kumar
  • 4,901
  • 8
  • 48
  • 83
  • your package is mismatch for com.yego.motodriver.SelectBike . just control and click over this class .if it will redirect to your original package then it is correct .otherwise you have to change the package. – Radhey Jun 08 '17 at 10:31
  • @Radhey In my case, If device is locked in between async task, then only exception throws. Otherwise it works well. So i think PackageMismatch will not be the issue here.. – Rajeev Kumar Jun 08 '17 at 10:34
  • post your Asynctask code . – Radhey Jun 08 '17 at 10:38
  • Are you calling any library activity from your main project? – Andy Developer Jun 08 '17 at 10:39

1 Answers1

0

You have not declare your activity in AndroidManifest.xml like :

<activity
        android:name=".SelectBike"
        android:screenOrientation="portrait"
        android:windowSoftInputMode="adjustPan"/>
ashish
  • 848
  • 6
  • 16