Post by AnkuLua on Aug 30, 2015 14:58:31 GMT
To capture screen and send event, AnkuLua needs either rooted device or installing daemon.
If your device is rooted, then you can skip this post.
If your device (not emulator) Android version is 7.0 and above, with AnkuLua 8.0.0 and above you don't need daemon. You can skip this post.
For emulators, strongly suggest LD player 4.x or Blue Stacks 5.x. No daemon is needed. You can use media projection and accessibility directly.
For BS 5.x, please use compatible mode.
For other emulators, you still need daemon or root.
Step one: enable USB debugging
There are many online guides. Here is one.
MIUI Users:
If there are two USB debugging options in "Developer options", enable both of them.
BlueStacks:
For installing daemon on BlueStacks 4.0, after BS start normally, go to settings preference enable ADB.
LDPlayer:
You need to turn on adb in LDPlayer
www.ldplayer.net/blog/introduction-to-version-4.0.37-and-3.102-features.html
Step two: install Windows USB driver
If your device manufacturer provides the driver, follow their instructions.
Otherwise, you can install general driver provided by Google.
Here is a web showing the details.
Samsung USB driver:
developer.samsung.com/galaxy/others/android-usb-driver-for-windows
When you plugging your device, it's very possible that following dialog show on the screen. Please click "Always allow from this computer", then click OK.
The dialog should show at least once. If not, please unplug and plug the device.
Step three: Install Daemon
Connect your Android device to the PC with installed USB driver.
Windows Users:
Please download the daemon zip file from DropBox and unzip it.
Version 1.8.5:
www.dropbox.com/s/ycrxyni3u53b37b/ama_daemon.v1.8.5.zip
Version 1.8.3:
drive.google.com/file/d/1dTmeokWBlMCpKRprA-Ea7pUpr1kvrKNH/view?usp=sharing
www.dropbox.com/s/ejjp1rp22lf88s3/ama_daemon.v1.8.3.zip
Version 1.8.2:
drive.google.com/file/d/1faS7rGoioINbw4N8fTVJ9dpd3sk_IBX_/view?usp=sharing
www.dropbox.com/s/x45yvaeqzycwvof/ama_daemon.v1.8.2.zip
Version 1.8.1:
drive.google.com/open?id=16XkJuDF_ltCk-5aQWC8o2iTwoaUsV1Pa
www.dropbox.com/s/3unalg5hmmg31cg/ama_daemon.v1.8.1.zip
Mac Users: Please download the daemon tar.gz file and untar it.
drive.google.com/open?id=1SRh8Zk5SyW2E_3iMxoN4cpXcn5vicQaI
www.dropbox.com/s/qcgmf8pux0odsla/ama_daemon.v1.8.1.tar.gz
www.dropbox.com/s/bpg7cdy49guu6tt/ama_daemon.v1.31.tar.gz
Please keep the directory structure. That is, you will see following picture in the ama_daemon directory.
Double click "run.bat", then following screen shows that the daemon is installed successfully.
Mac users: please run ./run.bat in terminal.
Android above 8.0 devices: disconnecting USB cause daemon failing
Normally, this only happens on Android version above 8.0 (Oreo).
Please use installation program above version 1.7.0
There are two solutions.
Please try solution 1 firstly. If solution 1 doesn't work, then try solution 2.
Solution 1
After connecting USB, please swipe from upper notification bar and choose USB options.
Please select "charge".
Note: You may need to select this option every time when connecting USB. Devices don't remember this option.
Then execute run.bat , just like before.
Solution 2
Make sure that your PC and phone connect to the same WiFi AP.
Execute run_tcpip.bat
When the computer shows
Please unplug USB before continuing.
Please unplug the USB.
Then press any key to continue.
Note: if you use Nox App Player, please double click "nox_player.run.bat".
For nox, you need to copy all *adb* files from directory nox\bin to ama_daemon\tools\nox.
If you use KOPlayer, please double click "koplayer.nun.bat".
And if the screen shows the device is offline, restart the emulator and install the daemon again.
MEmu emulator:
Please turn on developer option and USB debugging mode. Then install daemon as following steps.
1. close Memu
2. Run Windows task manager (Ctrl + Shirt + Esc) -> Process -> Image Name-> adb.exe *32 -> End Process
3. Run Memu
4. After Memu starts completely, run memu.run.bat
Note for Samsung users: If failing to install daemon, uninstalling the KNOX app from Samsung smartphones (the yellow app with the little shield) who was blocking the USB debugging.
Note for BlueStacks multiple instances: Please download version 1.6.0 and run "instances_run.bat".
If not all instances are listed, you can edit the file tools\instances.bat
Edit the line as below and keep increasing the number 9 until all instances listed.
Nox multiple instances:
If not every instance shown when running "nox_player.run.bat", please refer to appendix in following link.
Nox multiple instances instruction
Go back to your device and press "Recheck Daemon", AnkuLua will show that it finds the daemon.
After daemon installation, you can disconnect your Android device from PC.
If everything goes smoothly, you can go to step 4 now.
If "adb server is out of date. killing..." shows on the screen and cause the installation failure
It's caused by phone sync softwares (like hTC sync), please uninstall and remove them.
Or search and remove "adb.exe" under "\Program Files (x86)" "\Program Files" and sub-directories.
Or unfortunately, you are stuck in following screen
It means something wrong, either the debug mode not enabled or the USB driver not installed successfully.
Suggest that you search your model's information online.
Or, you can try to change the USB options.
Drag the Android top bar, screen like below will show
touch "Touch for other USB options"
You can try MTP or PTP.
Step Four: Run AnkuLua and make sure Daemon working properly
Back to phone or tablet and run AnkuLua, you should see damon detected.
Now enjoy the automation brought by AnkuLua.
Note: If your device need to reboot for some reason, you will need to install the daemon again.
Please repeat step three to install the daemon.
[Next]: First Example: the usage of AnkuLua in real application
[Previous]: AnkuLua Introduction
Appendix 1: Nox multiple instances deamon installation
Please follow the steps.
1. Find the ports
After starting all Nox instances, press Windows key and type in resmon.exe to open resource monitor.
Or you can run resmon.exe from the command prompt window.
Then select Network->Listen Ports->image
Find NoxVMHandle.exe, following picture will show
Here, the different NoxVMHandle.exe PID represents different Nox instance.
We can see that each Nox PID uses many ports, normally we just pay attention to the ones with address "IPv4 loopback".
Here we use two instances, and the ports are
11600 -> 60001, 64027, 63026, 62025, 61024, 58030
1140 -> 57001, 64001, 63001, 62001, 61002, 58001
As original daemon installation already show 62001 device, we just focus on 11600 PID instance.
2. modify nox_player.run.bat
According to the ports found, we modify the file as following.
You should modify it according to your system.
Run the modified nox_player.run.bat, it may show many devices. Some are offline.
Don't select those offline devices. Just select the normal ones.
If your device is rooted, then you can skip this post.
If your device (not emulator) Android version is 7.0 and above, with AnkuLua 8.0.0 and above you don't need daemon. You can skip this post.
For emulators, strongly suggest LD player 4.x or Blue Stacks 5.x. No daemon is needed. You can use media projection and accessibility directly.
For BS 5.x, please use compatible mode.
For other emulators, you still need daemon or root.
Step one: enable USB debugging
There are many online guides. Here is one.
MIUI Users:
If there are two USB debugging options in "Developer options", enable both of them.
BlueStacks:
For installing daemon on BlueStacks 4.0, after BS start normally, go to settings preference enable ADB.
LDPlayer:
You need to turn on adb in LDPlayer
www.ldplayer.net/blog/introduction-to-version-4.0.37-and-3.102-features.html
Step two: install Windows USB driver
If your device manufacturer provides the driver, follow their instructions.
Otherwise, you can install general driver provided by Google.
Here is a web showing the details.
Samsung USB driver:
developer.samsung.com/galaxy/others/android-usb-driver-for-windows
When you plugging your device, it's very possible that following dialog show on the screen. Please click "Always allow from this computer", then click OK.
The dialog should show at least once. If not, please unplug and plug the device.
Step three: Install Daemon
Connect your Android device to the PC with installed USB driver.
Windows Users:
Please download the daemon zip file from DropBox and unzip it.
Version 1.8.5:
www.dropbox.com/s/ycrxyni3u53b37b/ama_daemon.v1.8.5.zip
Version 1.8.3:
drive.google.com/file/d/1dTmeokWBlMCpKRprA-Ea7pUpr1kvrKNH/view?usp=sharing
www.dropbox.com/s/ejjp1rp22lf88s3/ama_daemon.v1.8.3.zip
Version 1.8.2:
drive.google.com/file/d/1faS7rGoioINbw4N8fTVJ9dpd3sk_IBX_/view?usp=sharing
www.dropbox.com/s/x45yvaeqzycwvof/ama_daemon.v1.8.2.zip
Version 1.8.1:
drive.google.com/open?id=16XkJuDF_ltCk-5aQWC8o2iTwoaUsV1Pa
www.dropbox.com/s/3unalg5hmmg31cg/ama_daemon.v1.8.1.zip
Mac Users: Please download the daemon tar.gz file and untar it.
drive.google.com/open?id=1SRh8Zk5SyW2E_3iMxoN4cpXcn5vicQaI
www.dropbox.com/s/qcgmf8pux0odsla/ama_daemon.v1.8.1.tar.gz
www.dropbox.com/s/bpg7cdy49guu6tt/ama_daemon.v1.31.tar.gz
Please keep the directory structure. That is, you will see following picture in the ama_daemon directory.
Double click "run.bat", then following screen shows that the daemon is installed successfully.
Mac users: please run ./run.bat in terminal.
Android above 8.0 devices: disconnecting USB cause daemon failing
Normally, this only happens on Android version above 8.0 (Oreo).
Please use installation program above version 1.7.0
There are two solutions.
Please try solution 1 firstly. If solution 1 doesn't work, then try solution 2.
Solution 1
After connecting USB, please swipe from upper notification bar and choose USB options.
Please select "charge".
Note: You may need to select this option every time when connecting USB. Devices don't remember this option.
Then execute run.bat , just like before.
Solution 2
Make sure that your PC and phone connect to the same WiFi AP.
Execute run_tcpip.bat
When the computer shows
Please unplug USB before continuing.
Please unplug the USB.
Then press any key to continue.
Note: if you use Nox App Player, please double click "nox_player.run.bat".
For nox, you need to copy all *adb* files from directory nox\bin to ama_daemon\tools\nox.
If you use KOPlayer, please double click "koplayer.nun.bat".
And if the screen shows the device is offline, restart the emulator and install the daemon again.
MEmu emulator:
Please turn on developer option and USB debugging mode. Then install daemon as following steps.
1. close Memu
2. Run Windows task manager (Ctrl + Shirt + Esc) -> Process -> Image Name-> adb.exe *32 -> End Process
3. Run Memu
4. After Memu starts completely, run memu.run.bat
Note for Samsung users: If failing to install daemon, uninstalling the KNOX app from Samsung smartphones (the yellow app with the little shield) who was blocking the USB debugging.
Note for BlueStacks multiple instances: Please download version 1.6.0 and run "instances_run.bat".
If not all instances are listed, you can edit the file tools\instances.bat
Edit the line as below and keep increasing the number 9 until all instances listed.
ping 127.0.0.1 -n 9 > nul
Nox multiple instances:
If not every instance shown when running "nox_player.run.bat", please refer to appendix in following link.
Nox multiple instances instruction
Go back to your device and press "Recheck Daemon", AnkuLua will show that it finds the daemon.
After daemon installation, you can disconnect your Android device from PC.
If everything goes smoothly, you can go to step 4 now.
If "adb server is out of date. killing..." shows on the screen and cause the installation failure
It's caused by phone sync softwares (like hTC sync), please uninstall and remove them.
Or search and remove "adb.exe" under "\Program Files (x86)" "\Program Files" and sub-directories.
Or unfortunately, you are stuck in following screen
It means something wrong, either the debug mode not enabled or the USB driver not installed successfully.
Suggest that you search your model's information online.
Or, you can try to change the USB options.
Drag the Android top bar, screen like below will show
touch "Touch for other USB options"
You can try MTP or PTP.
Step Four: Run AnkuLua and make sure Daemon working properly
Back to phone or tablet and run AnkuLua, you should see damon detected.
Now enjoy the automation brought by AnkuLua.
Note: If your device need to reboot for some reason, you will need to install the daemon again.
Please repeat step three to install the daemon.
[Next]: First Example: the usage of AnkuLua in real application
[Previous]: AnkuLua Introduction
Appendix 1: Nox multiple instances deamon installation
Please follow the steps.
1. Find the ports
After starting all Nox instances, press Windows key and type in resmon.exe to open resource monitor.
Or you can run resmon.exe from the command prompt window.
Then select Network->Listen Ports->image
Find NoxVMHandle.exe, following picture will show
Here, the different NoxVMHandle.exe PID represents different Nox instance.
We can see that each Nox PID uses many ports, normally we just pay attention to the ones with address "IPv4 loopback".
Here we use two instances, and the ports are
11600 -> 60001, 64027, 63026, 62025, 61024, 58030
1140 -> 57001, 64001, 63001, 62001, 61002, 58001
As original daemon installation already show 62001 device, we just focus on 11600 PID instance.
2. modify nox_player.run.bat
According to the ports found, we modify the file as following.
You should modify it according to your system.
@echo off
.\tools\nox_adb.exe connect 127.0.0.1:60001
.\tools\nox_adb.exe connect 127.0.0.1:64027
.\tools\nox_adb.exe connect 127.0.0.1:63026
.\tools\nox_adb.exe connect 127.0.0.1:62025
.\tools\nox_adb.exe connect 127.0.0.1:61024
.\tools\nox_adb.exe connect 127.0.0.1:58030
.\tools\lua5.1.exe .\tools\install.nox.luac
set /p temp=""
Run the modified nox_player.run.bat, it may show many devices. Some are offline.
Don't select those offline devices. Just select the normal ones.