[GH-ISSUE #247] [Crash] Injecting to another application requires INJECT_EVENTS permission #207

Closed
opened 2026-03-02 23:38:46 +03:00 by kerem · 3 comments
Owner

Originally created by @mordekai91 on GitHub (Jan 14, 2021).
Original GitHub issue: https://github.com/alexal1/Insomniac/issues/247

I get this crash just when Instagram is show on my phone (Xiaomi redmi note 8 pro)

Crash-2021-01-14-14-19-12.zip

uiautomator2.exceptions.JSONRPCError: -32001 Jsonrpc error: <java.lang.SecurityException> data: java.lang.SecurityException: Injecting to another application requires INJECT_EVENTS permission
at android.os.Parcel.createException(Parcel.java:2074)
at android.os.Parcel.readException(Parcel.java:2042)
at android.os.Parcel.readException(Parcel.java:1990)
at android.app.IUiAutomationConnection$Stub$Proxy.injectInputEvent(IUiAutomationConnection.java:471)
at android.app.UiAutomation.injectInputEvent(UiAutomation.java:597)
at com.github.uiautomator.stub.TouchController.injectEventSync(TouchController.java:38)
at com.github.uiautomator.stub.TouchController.touchDown(TouchController.java:47)
at com.github.uiautomator.stub.AutomatorServiceImpl.click(AutomatorServiceImpl.java:206)
at java.lang.reflect.Method.invoke(Native Method)
at com.googlecode.jsonrpc4j.JsonRpcBasicServer.invoke(JsonRpcBasicServer.java:467)
at com.googlecode.jsonrpc4j.JsonRpcBasicServer.handleObject(JsonRpcBasicServer.java:352)
at com.googlecode.jsonrpc4j.JsonRpcBasicServer.handleJsonNodeRequest(JsonRpcBasicServer.java:283)
at com.googlecode.jsonrpc4j.JsonRpcBasicServer.handleRequest(JsonRpcBasicServer.java:251)
at com.github.uiautomator.stub.AutomatorHttpServer.serve(AutomatorHttpServer.java:100)
at fi.iki.elonen.NanoHTTPD.serve(NanoHTTPD.java:2244)
at fi.iki.elonen.NanoHTTPD$HTTPSession.execute(NanoHTTPD.java:945)
at fi.iki.elonen.NanoHTTPD$ClientHandler.run(NanoHTTPD.java:192)
at java.lang.Thread.run(Thread.java:919)
, method: click

Originally created by @mordekai91 on GitHub (Jan 14, 2021). Original GitHub issue: https://github.com/alexal1/Insomniac/issues/247 I get this crash just when Instagram is show on my phone (Xiaomi redmi note 8 pro) [Crash-2021-01-14-14-19-12.zip](https://github.com/alexal1/Insomniac/files/5814657/Crash-2021-01-14-14-19-12.zip) uiautomator2.exceptions.JSONRPCError: -32001 Jsonrpc error: <java.lang.SecurityException> data: java.lang.SecurityException: Injecting to another application requires INJECT_EVENTS permission at android.os.Parcel.createException(Parcel.java:2074) at android.os.Parcel.readException(Parcel.java:2042) at android.os.Parcel.readException(Parcel.java:1990) at android.app.IUiAutomationConnection$Stub$Proxy.injectInputEvent(IUiAutomationConnection.java:471) at android.app.UiAutomation.injectInputEvent(UiAutomation.java:597) at com.github.uiautomator.stub.TouchController.injectEventSync(TouchController.java:38) at com.github.uiautomator.stub.TouchController.touchDown(TouchController.java:47) at com.github.uiautomator.stub.AutomatorServiceImpl.click(AutomatorServiceImpl.java:206) at java.lang.reflect.Method.invoke(Native Method) at com.googlecode.jsonrpc4j.JsonRpcBasicServer.invoke(JsonRpcBasicServer.java:467) at com.googlecode.jsonrpc4j.JsonRpcBasicServer.handleObject(JsonRpcBasicServer.java:352) at com.googlecode.jsonrpc4j.JsonRpcBasicServer.handleJsonNodeRequest(JsonRpcBasicServer.java:283) at com.googlecode.jsonrpc4j.JsonRpcBasicServer.handleRequest(JsonRpcBasicServer.java:251) at com.github.uiautomator.stub.AutomatorHttpServer.serve(AutomatorHttpServer.java:100) at fi.iki.elonen.NanoHTTPD.serve(NanoHTTPD.java:2244) at fi.iki.elonen.NanoHTTPD$HTTPSession.execute(NanoHTTPD.java:945) at fi.iki.elonen.NanoHTTPD$ClientHandler.run(NanoHTTPD.java:192) at java.lang.Thread.run(Thread.java:919) , method: click
kerem closed this issue 2026-03-02 23:38:46 +03:00
Author
Owner

@alexal1 commented on GitHub (Jan 14, 2021):

Try with the --old flag please

<!-- gh-comment-id:760357150 --> @alexal1 commented on GitHub (Jan 14, 2021): Try with the `--old` flag please
Author
Owner

@mordekai91 commented on GitHub (Jan 20, 2021):

Try with the --old flag please

Hi @alexal1 , thanks for reply.
When I use --old flag im getting the next error

`C:\Users\borja\Desktop>py start.py --old --interact @natgeo


Insomniac v3.6.5

Hi! Since of v3.1.0 all core features in this project are free to use.
You may want to get more fine grained control over the bot via these features:
- Filtering - skip unwanted accounts by various parameters
- Scrapping - technique that makes interactions significantly safer and faster
- Working hours - the script will wait till specified hours before each session
- Removing mass followers - automate "cleaning" you account
- Analytics tool - build presentation that shows your growth
Activate by supporting our small team: https://insomniac-bot.com/activate/

Using insomniac session-manager without extra-features
[01/20 11:00:23] Checking your Internet speed to adjust the script speed, please wait for a minute...
[01/20 11:00:23] (use --no-speed-check to skip this check)
[01/20 11:00:44] Download speed 72.92 Mbit/s, upload speed 75.63 Mbit/s
[01/20 11:00:44] Sleep range will be from 1.00 to 3.00 seconds
Looking for ADB devices...
Connected devices via adb: 1. That's ok.
[01/20 11:00:44] Using uiautomator v1
[01/20 11:00:44] Instagram version: 170.2.0.30.474
[01/20 11:00:44] Running Insomniac with the "interact" action.
[01/20 11:00:44] Successful interactions limit per source: 70
[01/20 11:00:44] Interactions limit per source: 140
[01/20 11:00:44] Total likes limit: 1000
[01/20 11:00:44] Total comments limit: 50

Caught an exception:
alive attribute not found!
[01/20 11:00:47] Traceback (most recent call last):
File "C:\Users\borja\AppData\Local\Programs\Python\Python38\lib\site-packages\insomniac\session.py", line 232, in run
self.start_session(args, device_wrapper, app_version)
File "C:\Users\borja\AppData\Local\Programs\Python\Python38\lib\site-packages\insomniac\session.py", line 160, in start_session
device_wrapper.get().wake_up()
File "C:\Users\borja\AppData\Local\Programs\Python\Python38\lib\site-packages\insomniac\device_facade.py", line 124, in wake_up
while not self.is_alive() and attempts < 5:
File "C:\Users\borja\AppData\Local\Programs\Python\Python38\lib\site-packages\insomniac\device_facade.py", line 117, in is_alive
return self.deviceV1.alive()
File "C:\Users\borja\AppData\Local\Programs\Python\Python38\lib\site-packages\uiautomator_init_.py", line 589, in getattr
raise AttributeError("%s attribute not found!" % attr)
AttributeError: alive attribute not found!

Traceback (most recent call last):
File "C:\Users\borja\AppData\Local\Programs\Python\Python38\lib\site-packages\insomniac\session.py", line 232, in run
self.start_session(args, device_wrapper, app_version)
File "C:\Users\borja\AppData\Local\Programs\Python\Python38\lib\site-packages\insomniac\session.py", line 160, in start_session
device_wrapper.get().wake_up()
File "C:\Users\borja\AppData\Local\Programs\Python\Python38\lib\site-packages\insomniac\device_facade.py", line 124, in wake_up
while not self.is_alive() and attempts < 5:
File "C:\Users\borja\AppData\Local\Programs\Python\Python38\lib\site-packages\insomniac\device_facade.py", line 117, in is_alive
return self.deviceV1.alive()
File "C:\Users\borja\AppData\Local\Programs\Python\Python38\lib\site-packages\uiautomator_init_.py", line 589, in getattr
raise AttributeError("%s attribute not found!" % attr)
AttributeError: alive attribute not found!

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "start.py", line 4, in
insomniac.run(activation_code)
File "C:\Users\borja\AppData\Local\Programs\Python\Python38\lib\site-packages\insomniac_init_.py", line 20, in run
insomniac_session.run()
File "C:\Users\borja\AppData\Local\Programs\Python\Python38\lib\site-packages\insomniac\session.py", line 255, in run
save_crash(device_wrapper.get(), ex)
File "C:\Users\borja\AppData\Local\Programs\Python\Python38\lib\site-packages\insomniac\utils.py", line 137, in save_crash
device.wake_up()
File "C:\Users\borja\AppData\Local\Programs\Python\Python38\lib\site-packages\insomniac\device_facade.py", line 124, in wake_up
while not self.is_alive() and attempts < 5:
File "C:\Users\borja\AppData\Local\Programs\Python\Python38\lib\site-packages\insomniac\device_facade.py", line 117, in is_alive
return self.deviceV1.alive()
File "C:\Users\borja\AppData\Local\Programs\Python\Python38\lib\site-packages\uiautomator_init_.py", line 589, in getattr
raise AttributeError("%s attribute not found!" % attr)
AttributeError: alive attribute not found!

Thank you so much :)

<!-- gh-comment-id:763493740 --> @mordekai91 commented on GitHub (Jan 20, 2021): > Try with the `--old` flag please Hi @alexal1 , thanks for reply. When I use --old flag im getting the next error `C:\Users\borja\Desktop>py start.py --old --interact @natgeo   Insomniac v3.6.5 Hi! Since of v3.1.0 all core features in this project are free to use. You may want to get more fine grained control over the bot via these features: - Filtering - skip unwanted accounts by various parameters - Scrapping - technique that makes interactions significantly safer and faster - Working hours - the script will wait till specified hours before each session - Removing mass followers - automate "cleaning" you account - Analytics tool - build presentation that shows your growth Activate by supporting our small team: https://insomniac-bot.com/activate/ Using insomniac session-manager without extra-features [01/20 11:00:23] Checking your Internet speed to adjust the script speed, please wait for a minute... [01/20 11:00:23] (use --no-speed-check to skip this check) [01/20 11:00:44] Download speed 72.92 Mbit/s, upload speed 75.63 Mbit/s [01/20 11:00:44] Sleep range will be from 1.00 to 3.00 seconds Looking for ADB devices... Connected devices via adb: 1. That's ok. [01/20 11:00:44] Using uiautomator v1 [01/20 11:00:44] Instagram version: 170.2.0.30.474 [01/20 11:00:44] Running Insomniac with the "interact" action. [01/20 11:00:44] Successful interactions limit per source: 70 [01/20 11:00:44] Interactions limit per source: 140 [01/20 11:00:44] Total likes limit: 1000 [01/20 11:00:44] Total comments limit: 50 Caught an exception: alive attribute not found! [01/20 11:00:47] Traceback (most recent call last): File "C:\Users\borja\AppData\Local\Programs\Python\Python38\lib\site-packages\insomniac\session.py", line 232, in run self.start_session(args, device_wrapper, app_version) File "C:\Users\borja\AppData\Local\Programs\Python\Python38\lib\site-packages\insomniac\session.py", line 160, in start_session device_wrapper.get().wake_up() File "C:\Users\borja\AppData\Local\Programs\Python\Python38\lib\site-packages\insomniac\device_facade.py", line 124, in wake_up while not self.is_alive() and attempts < 5: File "C:\Users\borja\AppData\Local\Programs\Python\Python38\lib\site-packages\insomniac\device_facade.py", line 117, in is_alive return self.deviceV1.alive() File "C:\Users\borja\AppData\Local\Programs\Python\Python38\lib\site-packages\uiautomator\__init__.py", line 589, in __getattr__ raise AttributeError("%s attribute not found!" % attr) AttributeError: alive attribute not found! Traceback (most recent call last): File "C:\Users\borja\AppData\Local\Programs\Python\Python38\lib\site-packages\insomniac\session.py", line 232, in run self.start_session(args, device_wrapper, app_version) File "C:\Users\borja\AppData\Local\Programs\Python\Python38\lib\site-packages\insomniac\session.py", line 160, in start_session device_wrapper.get().wake_up() File "C:\Users\borja\AppData\Local\Programs\Python\Python38\lib\site-packages\insomniac\device_facade.py", line 124, in wake_up while not self.is_alive() and attempts < 5: File "C:\Users\borja\AppData\Local\Programs\Python\Python38\lib\site-packages\insomniac\device_facade.py", line 117, in is_alive return self.deviceV1.alive() File "C:\Users\borja\AppData\Local\Programs\Python\Python38\lib\site-packages\uiautomator\__init__.py", line 589, in __getattr__ raise AttributeError("%s attribute not found!" % attr) AttributeError: alive attribute not found! During handling of the above exception, another exception occurred: Traceback (most recent call last): File "start.py", line 4, in <module> insomniac.run(activation_code) File "C:\Users\borja\AppData\Local\Programs\Python\Python38\lib\site-packages\insomniac\__init__.py", line 20, in run insomniac_session.run() File "C:\Users\borja\AppData\Local\Programs\Python\Python38\lib\site-packages\insomniac\session.py", line 255, in run save_crash(device_wrapper.get(), ex) File "C:\Users\borja\AppData\Local\Programs\Python\Python38\lib\site-packages\insomniac\utils.py", line 137, in save_crash device.wake_up() File "C:\Users\borja\AppData\Local\Programs\Python\Python38\lib\site-packages\insomniac\device_facade.py", line 124, in wake_up while not self.is_alive() and attempts < 5: File "C:\Users\borja\AppData\Local\Programs\Python\Python38\lib\site-packages\insomniac\device_facade.py", line 117, in is_alive return self.deviceV1.alive() File "C:\Users\borja\AppData\Local\Programs\Python\Python38\lib\site-packages\uiautomator\__init__.py", line 589, in __getattr__ raise AttributeError("%s attribute not found!" % attr) AttributeError: alive attribute not found! Thank you so much :)
Author
Owner

@mordekai91 commented on GitHub (Jan 20, 2021):

Solved! In developer options menu, check also 'USB Debugging (Security settings)', both, USB debugging and this

Thank you!

<!-- gh-comment-id:763576331 --> @mordekai91 commented on GitHub (Jan 20, 2021): Solved! In developer options menu, check also '**USB Debugging (Security settings)**', both, USB debugging and this Thank you!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/Insomniac#207
No description provided.