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?
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.
Restarting the device fixed the problem
Related
As long as I saw in a YouTube video that an android device tends to launch and show activities that are launched in my test, I think there is a problem here, since mine doesn't react at all (the screen is always on though, animations are turned off).
When I was trying to test the activity which runs first in the app (logically), I tried to open the app by myself while testing and somehow it worked. Now I'm testing another one and this trick doesn't work anymore.
Anyways I always get the error:
java.lang.AssertionError: Activity never becomes requested state "[RESUMED, STARTED, CREATED, DESTROYED]"
My test code uncludes:
val scenario = ActivityScenario.launch(HomeActivity::class.java)
And then I just check the presence of a layout element (textview or anything)
Any ideas why it may occur?
Thanks in advance
UPD: android emulator works fine.
this also happening to my test when following codelab from google kotlin unit test
when im trying to run the test via emulator, it run perfectly, but when i run into my device, which is xiaomi redmi note 5, the error showed up like yours,
i found an answer in this question and it directed to this github
i try to enable app permission "Display pop-up windows while running in the background", and when i run the test again, it passes
I'm currently having an issue with certain Samsung devices where starting an activity with an intro animation sometimes causes the whole device to crash.
The app essentially transitions from an Activity with a VideoView to another activity with a VideoView. The video of the activity that just started stutters in a loop for about 10 seconds before the whole device crashes and restarts.
It's not crashing the device all the time, but is limited to a couple Samsung devices from what I've tested.
I've looked at crash logs of the device which currently seem to be inconclusive from what I can see.
Important but relevant note, I am finishing the activity once starting the next.
You could try to attach the debugger manually through Android Studio if your process is alive long enough after the boot sequence.
Source:
https://developer.android.com/studio/debug/index.html
One more thing you could try is to put the 'wait for debugger' instruction in your code, using the Debug.waitForDebugger() method.
Source: https://developer.android.com/reference/android/os/Debug.html#waitForDebugger()
Other than that, you could put a lot of logs in your code, then fetch them using adb logcat > crash-log.txt command from your CMD/Terminal.
i am new here, but i checked the site, it does not contain my question, hence not duplicate. Actually, in my android studio v 1.1.0, emulator does not launch default activity automatically when started in android studio. What i mean is that when i click the green (play) button to run my project, my emulator is launched. When it loads and is ready to be unlocked, after unlocking my default activity should run automatically but it does not. Just The Home screen is shown no matter how much i keep waiting. No error reported in LogCat, neither any exception or anything wrong with code. So to run, I have to right click on my activity and click run MainActivity from the available options. So, how do i make the emulator automatically launch my default activity?
I have no idea what happened. I was using it normally just yesterday, today every time I turn on a VM, it keeps going on with the loading animation (upwards of 10 minutes). The VMs were never slow on my pc (Core i7). In under two minutes, it would completely load with all the applications installed. I don't have any errors because it either ends up crashing completely or the VM loads but is immensely slow` ,such that I would get messages similar to :
Virtual Machine has stopped responding.
EDIT: I tried turning it on again. After 30 minutes the VM loaded with a blank screen. Then when I tried to click on a button in the keypad, it went back to the loading screen.
EDIT: It turned on now but it is slower than anything I have ever experienced before. My AVM was NEVER this slow. I unlocked the phone and this message popped up: "Process system is not responding." I have two options "wait" or "ok". After I clicked Wait, I could interact a bit with it, but then a second message popped up "Unfortunately the launcher has stopped." and I'm back on the main screen.
I found the answer. I accidentally deactivated the high-performance mode on my laptop. I re-activated it and now it seems to be back to normal.
The log tab is visible in DDMS and I have been logging data using Log.v(...) for many a week now without any problems.
Today, the log data is now longer being displayed in the Log window. Worked, then did a programming change to track a bug and now the log data is no longer showing.
Have tried running the app on an external Android phone, on the Android Simulator and it makes no difference.
Have closed down Eclipse, reloaded and still no change.
The console displays activity but only to the point of starting the activity.
The external phone is set up for debugging - not that this could be a problem since I have the same problem with the simulator
It looks like I have inadvertantly set something incorrectly but can't remember changing anything :-(
Anyone come across this problem before - have looked at previous posts but none seem relevant.
Regards,
Oliver
I had the same problem a while back. I was using the emulator and device for debugging. Apparently you have to select the device listed in the DDMS view whose logs you want to see. My logs were blank because the device that I was expecting logs from was not the one selected.
Hope that helps
Tried this:
https://stackoverflow.com/a/9826502/1238317
Check in your logcat window - TOP RIGHT corner PAUSE button || (Pause
receiving new logcat messages)
Few clicks + eventually restart eclipse (usually works in my case)
Check your LogCat window to see if you are filtering and make sure to set the debug level to Verbose.
There are possible reasons and solutions:
LogCat might have to much in cache, clear the log and see if it fixed the issue
You might need to select the device in the device view (even if it is already selected, try to click on it)
adb is not correctly working anymore, try to kill and start it again
Check if you see output if you use the command line adb logcat
Just go to DDMS perspective and click on the device's name in upper left corner and done your log cat will Start with a BOOm :P
In Android Studio, which I have found to be much more reliable and intuitive than Eclipse, I found this to be a common issue. For me what solves it (device is automatically set when running your app) besides checking code, is to Quit and restart the emulator or Quit Android Studio and Emulator and reopen/restart