Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android studio: Error: Activity not started, unknown error code 5

Currently developing an Android app for my company.

Everything was fine, till my last debugging session on my test-device (tablet attached to android via adb). When I try to run or debug my app, the "Run App" log simply shows:

Error: Activity not started, unknown error code 5

There is no further information, no stack trace, no nothing...

I tried to figure out, what I changed since the last time, but nothing seems to fix this.

Has anybody else had this error code 5 before and can help me?

like image 388
M.Horn Avatar asked Jun 09 '16 22:06

M.Horn


2 Answers

Long story short: Unknown error 5 means (at least in my case), there is a lock (meaning a pinned app) on the device, so no other app can be started.

After a bunch of things I tried, I finally figured this out.

My app uses startLockTask() to pin it (so you can't accidentally press one of the navigation buttons).

The problem was, that this lock seemed to be active, even though the app wasn't running. I only realized that, after I tried to push the home button on my tablet (it already showed the android home screen, so it didn't occur to me, to try that...).

Once I released the lock (pressing both Back and Overview at the same time), I could start the debugging again, with no problem.

like image 190
M.Horn Avatar answered Oct 11 '22 07:10

M.Horn


Restarting the device fixed the problem

like image 44
HimalayanCoder Avatar answered Oct 11 '22 08:10

HimalayanCoder