GramAddict / bot

Completely free and open-source human-like Instagram bot. Powered by UIAutomator2 and compatible with basically any Android device 5.0+ that can run Instagram - real or emulated.
https://docs.gramaddict.org
MIT License
1.14k stars 180 forks source link

Next Session never starts #300

Closed firetog closed 7 months ago

firetog commented 1 year ago

After a session is finished it will hold till the next session is ready to start. However, the next session never starts. it holds at this:

Ready for botting!🤫 [04/05 10:29:32] INFO | FastInputIME is the default keyboard. [04/05 10:29:32] INFO | Instagram version: 195.0.0.31.123

If I click on the emulator and just open and view atx-agent it will continue to this:

[04/05 13:36:54] ERROR | Exception: App has crashed / has been closed! [W 230405 13:36:54 init:492] [pid:95055] [emulator-5554] jsonrpc call got: -32001 Jsonrpc error: data: java.lang.NullPointerException: Attempt to read from field 'int android.accessibilityservice.AccessibilityServiceInfo.flags' on a null object reference in method 'void androidx.test.uiautomator.UiDevice.setCompressedLayoutHeirarchy(boolean)' at androidx.test.uiautomator.UiDevice.setCompressedLayoutHeirarchy(UiDevice.java:234) at com.github.uiautomator.stub.AutomatorServiceImpl.dumpWindowHierarchy(AutomatorServiceImpl.java:295) at com.github.uiautomator.stub.AutomatorServiceImpl.dumpWindowHierarchy(AutomatorServiceImpl.java:284) 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:1012) , method: dumpWindowHierarchy [D 230405 13:36:56 init:661] [pid:95055] [emulator-5554] kill process(ps): uiautomator /opt/homebrew/lib/python3.11/site-packages/packaging/version.py:127: DeprecationWarning: Creating a LegacyVersion has been deprecated and will be removed in the next major release warnings.warn( [D 230405 13:36:57 init:682] [pid:95055] [emulator-5554] uiautomator-v2 is starting ... left: 40.0s [D 230405 13:36:59 init:682] [pid:95055] [emulator-5554] uiautomator-v2 is starting ... left: 38.2s [D 230405 13:37:00 init:682] [pid:95055] [emulator-5554] uiautomator-v2 is starting ... left: 37.1s [D 230405 13:37:00 init:696] [pid:95055] [emulator-5554] show float window [D 230405 13:37:01 init:682] [pid:95055] [emulator-5554] uiautomator-v2 is starting ... left: 36.0s [D 230405 13:37:02 init:682] [pid:95055] [emulator-5554] uiautomator-v2 is starting ... left: 35.0s [D 230405 13:37:03 init:682] [pid:95055] [emulator-5554] uiautomator-v2 is starting ... left: 34.0s [D 230405 13:37:04 init:682] [pid:95055] [emulator-5554] uiautomator-v2 is starting ... left: 33.0s [I 230405 13:37:04 init:643] [pid:95055] [emulator-5554] uiautomator back to normal [04/05 13:37:04] INFO | Crash saved as crashes/3.2.4_2023-04-05-13-36-54.zip [04/05 13:37:04] INFO | If you want to report this crash, please upload the dump file via a ticket in the #lobby channel on discord [04/05 13:37:04] INFO | https://discord.gg/66zWWCDM7x

[04/05 13:37:04] INFO | [04/05 13:37:04] INFO | TOTAL [04/05 13:37:04] INFO | Completed sessions: 0 [04/05 13:37:04] INFO | Total duration: 3:08:33 [04/05 13:37:04] INFO | Total interactions: (0) 0 [04/05 13:37:04] INFO | Successful interactions: (0) 0 [04/05 13:37:04] INFO | Total followed: (0) 0 [04/05 13:37:04] INFO | Total likes: 0 [04/05 13:37:04] INFO | Total comments: 0 [04/05 13:37:04] INFO | Total PM sent: 0 [04/05 13:37:04] INFO | Total watched: 0 [04/05 13:37:04] INFO | Total unfollowed: 0 [04/05 13:37:04] INFO | This bot is backed with love by me for free. If you like using it, consider donating to help keep me motivated: https://www.buymeacoffee.com/mastrolube

I can't figure out why it seems to be timing out or how to fix this issue. I am using an M1 mac w/ Android Studio. The emulator is Pixel 4 w/ Android 12. Any help on this would be much appreciated so i do not need to keep manually starting sessions.

rjsop commented 1 year ago

Have you tried the supported version of Instagram? 226.0.0.16.117 instead of 195.0.0.31.123?

firetog commented 1 year ago

Yeah, I also tried it with that version too. I think it's something with the atx-agent like it's timing out.

firetog commented 1 year ago

Also came across this: https://github.com/openatx/uiautomator2/issues/813

rjsop commented 1 year ago

I suspect you already ran "python3 -m uiautomator2 init" to make sure it's updated. I am on a physical pixel 4a with android 12 and it's not having this issue.

rjsop commented 1 year ago

I have my screen on 100% of the time (in developer options) and have screen-sleep: false in the configuration file. If you are on an emulator, you probably do that already, but might be something to try.

rjsop commented 1 year ago

I found the same issue using the same setup as yours. You might try commenting out line 347 kill_atx_agent(device) on bot_flow.py which kills the atx agent during bot turn off. Worked for me, but haven't fully tested it.

image

rjsop commented 1 year ago

There are a few others in utils.py. I commented out both and am still testing.

image

chrisjansky commented 1 year ago

Did you find any fix for this? It happens to me also on Android 12.

alexyutmp commented 1 year ago

Same here, uiautomatro2 check does fix it, but error occurs later.