alexal1 / Insomniac

Instagram bot for automated Instagram interaction using Android device via ADB
https://insomniac-bot.com
MIT License
687 stars 159 forks source link

[Crash] Injecting to another application requires INJECT_EVENTS permission #247

Closed mordekai91 closed 3 years ago

mordekai91 commented 3 years ago

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: 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

alexal1 commented 3 years ago

Try with the --old flag please

mordekai91 commented 3 years ago

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:

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 :)

mordekai91 commented 3 years ago

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

Thank you!