When I try to make a screenshot in Android Studio from some of my projects (by pressing the camera icon), I get the following message:
"Unexpected error while obtaining screenshot from device: EOF"
I can make a screenshot of the same image if I click the camera icon after opening a totally different project. Is there some corrupted file associated with the project that needs to be deleted and replaced?
If the unexpected EOF error occurs when running a Python program, this is usually a sign that some code is missing. This is a syntax error that shows that a specific Python statement doesn’t follow the syntax expected by the Python interpreter. For example, when you use a for loop you have to specify one or more lines of code inside the loop.
If you have getActivity ().getWindow ().addFlags (LayoutParams.FLAG_SECURE); set (normally used to avoid screenshots), it will also prevent you from taking screenshots from Android Studio, generating the same error Unexpected Error while obtaining screenshot. Show activity on this post.
SyntaxError: Unexpected EOF While Parsing with a For Loop Let’s see the syntax error that occurs when you write a for loopto go through the elements of a listbut you don’t complete the body of the loop. In a Python file called eof_for.py define the following list: animals = ['lion', 'tiger', 'elephant'] Then write the line below:
The end of file is unexpected because the interpreter expects to find the body of the for loop before encountering the end of the Python code. To get rid of the unexpected EOF while parsingerror you have to add a body to the for loop. For example a single line that prints the elements of the list: for animal in animals: print(animal)
I ran into this problem recently - everything had been working fine previously. Apparently it started when I migrated to SDK 26 a few weeks ago. This fixed it for me: - shut down Studio - rename adb.exe in Android\sdk\platform-tools to .saf - copy the older adb.exe from Android\android-sdk\platform-tools to Android\sdk\platform-tools - restart Studio
So basically replace the SDK 26 adb.exe with an older version...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With