Closed klautun closed 2 years ago
Hello! Can you open ig and then write on console "uiautomator2 current" and write here the result? Thanks
Yes, the response is:
{ "package": "com.instagram.android", "activity": "com.instagram.mainactivity.MainActivity", "pid": 27552 }
Uhm.. I don't see anything wrong there https://github.com/GramAddict/bot/issues/217#issue-1013196496
Someone else complain about that few months ago..
What's your android phone? Android version?
It's a Samsung S22 Ultra, Android 12... I don't really want to downgrade but I can try to do a clean install again and start from scratch?
Can you try these commands and tell me what is says?
uiautomator2 healthcheck
And then
uiautomator2 doctor
I just tried and this is what I got:
[I 220312 14:02:09 init:156] uiautomator2 version: 2.16.14 [D 220312 14:02:09 main:105] sdk:31 abi:arm64-v8a CHECK atx-agent [D 220312 14:02:09 init:295] Real version: [0, 10, 0], Expect version: [0, 10, 0] [D 220312 14:02:09 init:359] Forward: local:tcp:50013 -> remote:tcp:7912 [D 220312 14:02:09 init:362] atx-agent version 0.10.0 [D 220312 14:02:09 init:365] device wlan ip: 192.168.1.180 GOOD: atx-agent version 0.10.0 CHECK uiautomator-apks [D 220312 14:02:10 init:256] apk-debug package-info: {'package_name': 'com.github.uiautomator', 'version_name': '2.3.3', 'version_code': '2003003', 'flags': ['DEBUGGABLE', 'HAS_CODE', 'ALLOW_CLEAR_USER_DATA', 'ALLOW_BACKUP'], 'first_install_time': datetime.datetime(2022, 3, 10, 7, 50, 37), 'last_update_time': datetime.datetime(2022, 3, 10, 7, 50, 37), 'signature': 'ae17cd86], past signatures:['} [D 220312 14:02:10 init:257] apk-debug-test package-info: {'package_name': 'com.github.uiautomator.test', 'version_name': '', 'version_code': '', 'flags': ['DEBUGGABLE', 'HAS_CODE', 'ALLOW_CLEAR_USER_DATA', 'ALLOW_BACKUP'], 'first_install_time': datetime.datetime(2022, 3, 10, 7, 50, 52), 'last_update_time': datetime.datetime(2022, 3, 10, 7, 50, 52), 'signature': 'ae17cd86], past signatures:['} GOOD: com.github.uiautomator 2.3.3 CHECK jsonrpc GOOD: d.info success ==> GOOD <==
OK, so I downgraded Instagram - it seems that what I experienced above is gone, but I have a new issue:
[03/12 14:45:34] INFO | Checking for updates...
[03/12 14:45:34] INFO | Bot is updated.
[03/12 14:45:34] INFO | GramAddict v.3.1.5
[03/12 14:45:34] INFO | Loading plugins . . .
[03/12 14:45:34] INFO | - ActionUnfollowFollowers: Handles the functionality of unfollowing your followers
[03/12 14:45:34] INFO | - ClonedApp: Adds support for cloned apps
[03/12 14:45:34] INFO | - CoreArguments: Simply adds core arguments
[03/12 14:45:34] INFO | - DataAnalytics: Generates a PDF analytics report of current username session data
[03/12 14:45:34] INFO | - InteractBloggerPostLikers: Handles the functionality of interacting with a blogger
[03/12 14:45:34] INFO | - InteractBloggerFollowers_Following: Handles the functionality of interacting with a bloggers followers/following
[03/12 14:45:34] INFO | - InteractBloggerPostLikers: Handles the functionality of interacting with a blogger post likers
[03/12 14:45:34] INFO | - InteractOwnFeed: Handles the functionality of interacting with your own feed
[03/12 14:45:34] INFO | - InteractHashtagLikers: Handles the functionality of interacting with a hashtags likers
[03/12 14:45:34] INFO | - InteractHashtagPosts: Handles the functionality of interacting with a hashtags post owners
[03/12 14:45:34] INFO | - InteractPlaceLikers: Handles the functionality of interacting with a places likers
[03/12 14:45:34] INFO | - InteractPlacePosts: Handles the functionality of interacting with a places post owners
[03/12 14:45:34] INFO | - LikeFromURLs: Likes a post from url. The urls are read from a plaintext file
[03/12 14:45:34] WARNING | If you want to use telegram_reports, please type in console: 'pip3 install gramaddict[telegram-reports]'
[03/12 14:45:34] INFO | - TelegramReports: Generate reports at the end of the session and send them using telegram
[03/12 14:45:36] INFO | Time delta has set to 00:00:32.
[03/12 14:45:37] INFO | -------- START: 14:45:36 - 2022/03/12 --------
[03/12 14:45:37] INFO | Device screen ON and unlocked.
[03/12 14:45:37] INFO | Open Instagram app.
[03/12 14:45:37] INFO | Ready for botting!🤫
[03/12 14:45:39] INFO | FastInputIME is the default keyboard.
[03/12 14:45:39] INFO | Instagram version: 213.0.0.29.120
Traceback (most recent call last):
File "C:\Users\kevin\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\kevin\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\kevin\AppData\Local\Programs\Python\Python39\Scripts\gramaddict.exe__main.py", line 7, in
set the screen time of your phone greater than 1m
Thank you. I'm back to the old issue where the bot is waiting for Instagram to open... 😟 I guess I'll wait an update or something to try again. Thanks for your advices all along.
logger.critical(
f"Unable to open Instagram. Bot will stop. Current package name: {device.deviceV2.info['currentPackageName']} (Looking for {app_id}"
)
Please, replace that line of code in your utils.py
pip show gramaddict
and you get the path of the package, then inside gramaddict/core you will find the file.
It won't fix it, but I'll see the problem hopefully.
Thanks for that! I just tried and this is the message I got:
[03/14 09:54:15] INFO | -------- START: 09:53:24 - 2022/03/14 -------- [03/14 09:54:23] INFO | Device screen ON and unlocked. [03/14 09:54:23] INFO | Open Instagram app. [03/14 09:54:31] INFO | Waiting for Instagram to open... 😴 (1/3) [03/14 09:55:36] INFO | Waiting for Instagram to open... 😴 (2/3) [03/14 09:56:42] INFO | Waiting for Instagram to open... 😴 (3/3) [03/14 09:57:55] CRITICAL | Unable to open Instagram. Bot will stop. Current package name: None (Looking for com.instagram.android
What is weird is that, when the bot says "Open Instagram app.", Instagram actually does open.
uh! I think you found an uiautomator2 bug!
while device.deviceV2.app_current()["package"] != app_id:
replace that and let me know :)
I run it twice with the new code. First time...
[03/14 10:44:05] INFO | -------- START: 10:43:14 - 2022/03/14 -------- [03/14 10:44:13] INFO | Device screen ON and unlocked. [03/14 10:44:13] INFO | Open Instagram app. [03/14 10:44:24] INFO | Waiting for Instagram to open... 😴 (1/3) [03/14 10:45:32] INFO | Waiting for Instagram to open... 😴 (2/3) [03/14 10:46:40] INFO | Waiting for Instagram to open... 😴 (3/3) [03/14 10:47:56] CRITICAL | Unable to open Instagram. Bot will stop. Current package name: None (Looking for com.instagram.android
Second time:
[03/14 10:50:26] INFO | -------- START: 10:49:34 - 2022/03/14 --------
[03/14 10:50:33] INFO | Device screen ON and unlocked.
[03/14 10:50:33] INFO | Open Instagram app.
[03/14 10:50:39] INFO | Ready for botting!🤫
[03/14 10:50:40] INFO | FastInputIME is the default keyboard.
[03/14 10:50:40] INFO | Instagram version: 225.0.0.19.115
[03/14 10:50:40] INFO | You have a newer version of IG then the one tested! (Tested version: 220.0.0.16.115). That shouldn't be a problem.
Traceback (most recent call last):
File "C:\Users\kevin\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\kevin\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\kevin\AppData\Local\Programs\Python\Python39\Scripts\gramaddict.exe__main.py", line 7, in
The screen time out is now 5 minutes...
app_current shouldn't return None.
Anyway wait for the next version and reopen this if it's not working.
Will do! Thanks for your help!
I also have the same issue and tried debugging myself a few days ago and have the same diagnosis that uiautomator returns None. This happened with my s10 and also my new s22 ultra. I am on M1 Mac though. I'll try to debug through and see if I can use some other API
I also have the same issue and tried debugging myself a few days ago and have the same diagnosis that uiautomator returns None. This happened with my s10 and also my new s22 ultra. I am on M1 Mac though. I'll try to debug through and see if I can use some other API
app_current() returns None even for you? :S
open shell and start python CLI (write python3
in console)
then run this
import uiautomator2 as u2
d = u2.connect()
d.app_current()
d.info
if you get None, you have to find the way to extract from your devices the packagename from adb in order to fix that
I also have the same issue and tried debugging myself a few days ago and have the same diagnosis that uiautomator returns None. This happened with my s10 and also my new s22 ultra. I am on M1 Mac though. I'll try to debug through and see if I can use some other API
app_current() returns None even for you? :S
open shell and start python CLI (write
python3
in console)then run this
import uiautomator2 as u2 d = u2.connect() d.app_current() d.info
>>> import uiautomator2 as u2
>>> d = u2.connect()
[W 220315 11:23:50 __init__:217] [pid:36124] atx-agent has something wrong, auto recovering
[D 220315 11:23:50 __init__:312] [pid:36124] device R5CT22MS7TA is online
[I 220315 11:23:50 init:156] uiautomator2 version: 2.16.8
[D 220315 11:23:50 init:295] Real version: [0, 10, 0], Expect version: [0, 10, 0]
[D 220315 11:23:51 init:256] apk-debug package-info: {'package_name': 'com.github.uiautomator', 'version_name': '2.3.3', 'version_code': '2003003', 'flags': ['DEBUGGABLE', 'HAS_CODE', 'ALLOW_CLEAR_USER_DATA', 'ALLOW_BACKUP'], 'first_install_time': datetime.datetime(2022, 3, 9, 22, 37, 36), 'last_update_time': datetime.datetime(2022, 3, 9, 22, 37, 36), 'signature': 'ae17cd86], past signatures:['}
[D 220315 11:23:51 init:257] apk-debug-test package-info: {'package_name': 'com.github.uiautomator.test', 'version_name': '', 'version_code': '', 'flags': ['DEBUGGABLE', 'HAS_CODE', 'ALLOW_CLEAR_USER_DATA', 'ALLOW_BACKUP'], 'first_install_time': datetime.datetime(2022, 3, 9, 22, 37, 39), 'last_update_time': datetime.datetime(2022, 3, 9, 22, 37, 39), 'signature': 'ae17cd86], past signatures:['}
[D 220315 11:23:51 init:167] Shell: ('/data/local/tmp/atx-agent', 'server', '--nouia', '-d', '--addr', '127.0.0.1:7912')
[D 220315 11:23:51 init:387] Forward: local:tcp:50678 -> remote:tcp:7912
[D 220315 11:23:51 init:387] Forward: local:tcp:50678 -> remote:tcp:7912
[D 220315 11:23:51 init:390] atx-agent version 0.10.0
[D 220315 11:23:51 init:393] device wlan ip: 10.0.0.176
>>> d.app_current()
{'package': 'com.tmobile.tuesdays', 'activity': 'com.tmobile.tmte.MainActivity', 'pid': 31527}
>>> d.app_current()
{'package': 'com.instagram.android', 'activity': 'com.instagram.mainactivity.MainActivity', 'pid': 17610}
>>> d.app_current()
{'package': 'com.instagram.android', 'activity': 'com.instagram.mainactivity.MainActivity', 'pid': 17610}
>>> d.app_current()
{'package': 'com.instagram.android', 'activity': 'com.instagram.mainactivity.MainActivity', 'pid': 17610}
>>> d.info
[D 220315 11:24:38 __init__:661] [pid:36124] kill process(ps): uiautomator
[D 220315 11:24:39 __init__:679] [pid:36124] uiautomator-v2 is starting ... left: 40.0s
[D 220315 11:24:40 __init__:679] [pid:36124] uiautomator-v2 is starting ... left: 39.0s
[D 220315 11:24:41 __init__:679] [pid:36124] uiautomator-v2 is starting ... left: 38.0s
[D 220315 11:24:42 __init__:679] [pid:36124] uiautomator-v2 is starting ... left: 36.9s
[D 220315 11:24:43 __init__:679] [pid:36124] uiautomator-v2 is starting ... left: 35.9s
[D 220315 11:24:44 __init__:679] [pid:36124] uiautomator-v2 is starting ... left: 34.9s
[D 220315 11:24:45 __init__:679] [pid:36124] uiautomator-v2 is starting ... left: 33.8s
[D 220315 11:24:45 __init__:693] [pid:36124] show float window
[D 220315 11:24:46 __init__:679] [pid:36124] uiautomator-v2 is starting ... left: 32.7s
[D 220315 11:24:47 __init__:679] [pid:36124] uiautomator-v2 is starting ... left: 31.7s
[D 220315 11:24:48 __init__:679] [pid:36124] uiautomator-v2 is starting ... left: 30.7s
[D 220315 11:24:49 __init__:679] [pid:36124] uiautomator-v2 is starting ... left: 29.6s
[D 220315 11:24:50 __init__:679] [pid:36124] uiautomator-v2 is starting ... left: 28.6s
[D 220315 11:24:51 __init__:679] [pid:36124] uiautomator-v2 is starting ... left: 27.6s
[D 220315 11:24:52 __init__:679] [pid:36124] uiautomator-v2 is starting ... left: 26.6s
[I 220315 11:24:52 __init__:643] [pid:36124] uiautomator back to normal
{'currentPackageName': 'com.instagram.android', 'displayHeight': 2935, 'displayRotation': 0, 'displaySizeDpX': 411, 'displaySizeDpY': 882, 'displayWidth': 1440, 'productName': 'b0qsqw', 'screenOn': True, 'sdkInt': 31, 'naturalOrientation': True}
>>> d.app_current()
{'package': 'com.instagram.android', 'activity': 'com.instagram.mainactivity.MainActivity', 'pid': 17610}
>>> d.app_current()
{'package': 'com.instagram.android', 'activity': 'com.instagram.mainactivity.MainActivity', 'pid': 17610}
>>> d.app_current()
{'package': 'com.google.android.gm', 'activity': '.ConversationListActivityGmail', 'pid': 18567}
>>> d.info
{'currentPackageName': 'com.google.android.gm', 'displayHeight': 2935, 'displayRotation': 0, 'displaySizeDpX': 411, 'displaySizeDpY': 882, 'displayWidth': 1440, 'productName': 'b0qsqw', 'screenOn': True, 'sdkInt': 31, 'naturalOrientation': True}
It was initially detecting my last opened app and then I closed all. d.info then triggered uiautomator to restart and after that that the bot detected Instagram.
@klautun With some experimentation, I found a temporary workaround to this issue. You Just go to Settings -> Apps -> Atx and there you force stop that application before running the bot.
@klautun With some experimentation, I found a temporary workaround to this issue. You Just go to Settings -> Apps -> Atx and there you force stop that application before running the bot.
you can kill the atx by code, just call the function https://github.com/GramAddict/bot/blob/a0219606afb0dc8313fd9ef4456349e8af001888/GramAddict/core/utils.py#L437
I've released a new version, is the problem still present?
Thanks to both of you! I'm sorry I couldn't try it before.
I just tried to kill the ATX process before using the old version ->The application crashed.
I've updated to the 3.2.1 version and still have the same issue unfortunately:
[03/27 10:24:56] INFO | Time delta has set to 00:14:13. [03/27 10:24:56] INFO | Kill atx agent. [03/27 10:24:56] INFO | Next session will start at: 10:29:13 (2022/03/27). [03/27 10:24:56] INFO | Time left: 00:04:16. [W 220327 10:29:13 init:218] [pid:3104] atx-agent has something wrong, auto recovering [D 220327 10:29:13 init:322] [pid:3104] [R5CT12HPR8Y] device R5CT12HPR8Y is online [I 220327 10:29:13 init:156] uiautomator2 version: 2.16.14 [D 220327 10:29:13 init:167] Shell: ('/data/local/tmp/atx-agent', 'server', '--stop') [D 220327 10:29:13 init:295] Real version: [0, 10, 0], Expect version: [0, 10, 0] [D 220327 10:29:13 init:167] Shell: ('/data/local/tmp/atx-agent', 'server', '--nouia', '-d', '--addr', '127.0.0.1:7912') [I 220327 10:29:14 init:350] Check atx-agent version [D 220327 10:29:14 init:359] Forward: local:tcp:50646 -> remote:tcp:7912 [D 220327 10:29:14 init:359] Forward: local:tcp:50646 -> remote:tcp:7912 [D 220327 10:29:14 init:362] atx-agent version 0.10.0 [D 220327 10:29:14 init:365] device wlan ip: 192.168.1.180 [03/27 10:30:09] INFO | Screen timeout is fine! [03/27 10:31:00] INFO | -------- START: 10:30:09 - 2022/03/27 -------- [03/27 10:31:08] INFO | Device screen ON and unlocked. [03/27 10:31:08] INFO | Open Instagram app. [03/27 10:31:18] INFO | Waiting for Instagram to open... 😴 (1/3) [03/27 10:32:26] INFO | Waiting for Instagram to open... 😴 (2/3) [03/27 10:34:08] INFO | Waiting for Instagram to open... 😴 (3/3) [03/27 10:35:26] CRITICAL | Unable to open Instagram. Bot will stop. Current package name: com.google.android.keep (Looking for com.instagram.android)
Does this help you?
I will tell you how to disable the checks tomorrow, but probably your device is not compatible with uiautomator2 and some functions doesn't work properly. Hopefully it's only that get_current
@mastrolube I just wanted to follow up on this - in case I can try something else to make it work? Thanks!
@mastrolube I just wanted to follow up on this - in case I can try something else to make it work? Thanks!
Sorry, I forgot about that... :(
delete this line: https://github.com/GramAddict/bot/blob/45b084f66a3ceec11fea60aff09e9bf4d7468447/GramAddict/core/device_facade.py#L116
and replace from https://github.com/GramAddict/bot/blob/45b084f66a3ceec11fea60aff09e9bf4d7468447/GramAddict/core/utils.py#L267 to https://github.com/GramAddict/bot/blob/45b084f66a3ceec11fea60aff09e9bf4d7468447/GramAddict/core/utils.py#L281
with only call_ig()
that will exclude all the checks, but as I said your device is not compatible
Hi! I wanted to update you all on the issue I had with my Samsung S22. I tried again today by updating everything that needed to be updated (Pip, GramAddict, uiautomator) and... it works!! Yeah!
The only strange thing now is that the process seems to be a little slower than before. I don't know if this is something I can change? Is there any way to speed up the time between actions?
Thank you for your support through this and for this great tool!
Hello! Happy to hear that! You can use speed-multiplier parameter in config to increase the speed by decrease the sleep time between actions. In the docs you will find a good explanation on how to use that
Hello team! Thank you for the work you do. The bot is great and I hope you continue updating it for a long time.
I just changed my phone so I changed my configuration files to make the scripts work with the new ADB device ID (I thought it would be enough)
When I run gramaddict now, the script gets stuck for a long time at the step "Time delta has set to..."
Then Instagram opens on my phone and nothing happens...
Waiting for Instagram to open... 😴 (1/3) Waiting for Instagram to open... 😴 (2/3) Waiting for Instagram to open... 😴 (3/3)
I don't know what I did wrong or what I forgot to install/update. Everything was working great before! Do you have any idea?
Thank you!
[03/12 08:23:14] INFO | Checking for updates... [03/12 08:23:14] INFO | Bot is updated. [03/12 08:23:14] INFO | GramAddict v.3.1.5 [03/12 08:23:14] INFO | Loading plugins . . . [03/12 08:23:14] INFO | - ActionUnfollowFollowers: Handles the functionality of unfollowing your followers [03/12 08:23:14] INFO | - ClonedApp: Adds support for cloned apps [03/12 08:23:14] INFO | - CoreArguments: Simply adds core arguments [03/12 08:23:14] INFO | - DataAnalytics: Generates a PDF analytics report of current username session data [03/12 08:23:14] INFO | - InteractBloggerPostLikers: Handles the functionality of interacting with a blogger [03/12 08:23:14] INFO | - InteractBloggerFollowers_Following: Handles the functionality of interacting with a bloggers followers/following [03/12 08:23:14] INFO | - InteractBloggerPostLikers: Handles the functionality of interacting with a blogger post likers [03/12 08:23:14] INFO | - InteractOwnFeed: Handles the functionality of interacting with your own feed [03/12 08:23:14] INFO | - InteractHashtagLikers: Handles the functionality of interacting with a hashtags likers [03/12 08:23:14] INFO | - InteractHashtagPosts: Handles the functionality of interacting with a hashtags post owners [03/12 08:23:14] INFO | - InteractPlaceLikers: Handles the functionality of interacting with a places likers [03/12 08:23:14] INFO | - InteractPlacePosts: Handles the functionality of interacting with a places post owners [03/12 08:23:14] INFO | - LikeFromURLs: Likes a post from url. The urls are read from a plaintext file [03/12 08:23:14] WARNING | If you want to use telegram_reports, please type in console: 'pip3 install gramaddict[telegram-reports]' [03/12 08:23:14] INFO | - TelegramReports: Generate reports at the end of the session and send them using telegram [03/12 08:23:24] INFO | Time delta has set to -00:00:00. [03/12 08:25:10] INFO | -------- START: 08:24:19 - 2022/03/12 -------- [03/12 08:25:47] INFO | Device screen ON and unlocked. [03/12 08:25:47] INFO | Open Instagram app. [03/12 08:25:55] INFO | Waiting for Instagram to open... 😴 (1/3) [03/12 08:26:41] INFO | Waiting for Instagram to open... 😴 (2/3) [03/12 08:27:27] INFO | Waiting for Instagram to open... 😴 (3/3) [03/12 08:28:13] CRITICAL | Unable to open Instagram. Bot will stop. [03/12 08:28:13] INFO | [03/12 08:28:13] INFO | TOTAL [03/12 08:28:13] INFO | Completed sessions: 0 [03/12 08:28:13] INFO | Total duration: 0:03:54 [03/12 08:28:13] INFO | Total interactions: (0) 0 [03/12 08:28:13] INFO | Successful interactions: (0) 0 [03/12 08:28:13] INFO | Total followed: (0) 0 [03/12 08:28:13] INFO | Total likes: 0 [03/12 08:28:13] INFO | Total comments: 0 [03/12 08:28:13] INFO | Total PM sent: 0 [03/12 08:28:13] INFO | Total watched: 0 [03/12 08:28:13] INFO | Total unfollowed: 0 [03/12 08:28:13] 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