Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

app_process showed "Aborted" when executing by adb command #2

Open
huynhtanloc2612 opened this issue Aug 2, 2023 · 5 comments
Open

Comments

@huynhtanloc2612
Copy link

huynhtanloc2612 commented Aug 2, 2023

Hi @WuDi-ZhanShen
Thank you for creating and sharing this project. It is very impresive.
I have cloned, built and launched app successfully on my Samsung phone with Android 12 version (No root).
Screenshot_20230802-213829_MC Gyro

However, I saw nothing after running the adb command to start it.
adb shell sh /storage/emulated/0/Android/data/com.tile.tuoluoyi/files/starter.sh

I tried to remove > /dev/null 2>&1 & in the command of app_process to see if there is any message and saw only "Aborted"
Hope I could get your feedback and advices for this.
Thank you!

@huynhtanloc2612
Copy link
Author

Hi @WuDi-ZhanShen ,
After spending some time to debug, I've found that the dex file of /storage/emulated/0/Android/data/com.tile.tuoluoyi/files/GyroNative.dex had issue (I have not known the cause yet).
I instead used dex file from "build" folder of ./app/build/intermediates/dex/debug/mergeProjectDexDebug/5/classes.dex and pushed it to device folder /data/local/tmp and ran below command and it worked successfully (I could play Minecraft PE game with gyroscope by using you app)
adb shell CLASSPATH="/data/local/tmp/classes.dex" app_process -Djava.library.path="/data/local/tmp/" / com.tile.tuoluoyi.GamePadNative
Hope above could help you know about this issue.

@huynhtanloc2612
Copy link
Author

Hi @WuDi-ZhanShen ,
I have unzip a apk and seen that only classes4.dex file is the correct .dex file. So I changed if condition in unzipFiles() method the with classes4.dex instead of classes.dex and the project work as expected. It means that I can run the command of adb shell sh /storage/emulated/0/Android/data/com.tile.tuoluoyi/files/starter.sh.

                if (entry.getName().equals("classes4.dex")){
                    InputStream inputStream = zipFile.getInputStream(entry);
                    FileOutputStream fos = new FileOutputStream(file2);
                    byte[] buffer = new byte[1024];
                    int len;
                    while ((len = inputStream.read(buffer)) > 0) {
                        fos.write(buffer, 0, len);
                    }
                    fos.close();
                    break;
                }

@WuDi-ZhanShen
Copy link
Owner

Hi @WuDi-ZhanShen , I have unzip a apk and seen that only classes4.dex file is the correct .dex file. So I changed if condition in unzipFiles() method the with classes4.dex instead of classes.dex and the project work as expected. It means that I can run the command of adb shell sh /storage/emulated/0/Android/data/com.tile.tuoluoyi/files/starter.sh.

                if (entry.getName().equals("classes4.dex")){
                    InputStream inputStream = zipFile.getInputStream(entry);
                    FileOutputStream fos = new FileOutputStream(file2);
                    byte[] buffer = new byte[1024];
                    int len;
                    while ((len = inputStream.read(buffer)) > 0) {
                        fos.write(buffer, 0, len);
                    }
                    fos.close();
                    break;
                }

If you add "multiDexEnabled false" into the build.gradle(:app) file, the app-release.apk will contain only one classes.dex. I hope that will help you.

@huynhtanloc2612
Copy link
Author

If you add "multiDexEnabled false" into the build.gradle(:app) file, the app-release.apk will contain only one classes.dex. I hope that will help you.

It works. Thank you very much @WuDi-ZhanShen

BTW, I am wondering where I can get the values for variable of description[] for the gamepad or all other uhid devices like keyboard, mouse...? And is there the list of all uhid devices? For example, I also want to check if the usbc-to-hbmi dongle which connects to TV/monitor is an uhid device or not. If so, what are its description[] values...(I searched on the internet but cannot find such information). Hope you can give me some advices. Thanks.

@WuDi-ZhanShen
Copy link
Owner

If you add "multiDexEnabled false" into the build.gradle(:app) file, the app-release.apk will contain only one classes.dex. I hope that will help you.

It works. Thank you very much @WuDi-ZhanShen

BTW, I am wondering where I can get the values for variable of description[] for the gamepad or all other uhid devices like keyboard, mouse...? And is there the list of all uhid devices? For example, I also want to check if the usbc-to-hbmi dongle which connects to TV/monitor is an uhid device or not. If so, what are its description[] values...(I searched on the internet but cannot find such information). Hope you can give me some advices. Thanks.

The HDMI converter you mentioned doesn't belong to hid devices. Hid means human input device such as keyboard, mouse, koystick, touchscreen, gamepad. And "uhid" is a Linux API which allows us to simulate hid devices using hid descriptions.

However, I didn't use the "uhid" as the primary work mode but the"uinput", which is also a Linux api to simulate input devices but has better performance in this situation of using gyro in MC.

If you want to get some more hid descriptions such as keyboard, mouse, gamepad, you can check my project named "uhid-purejava", or check this website: https://www.usbzh.com/article/detail-525.html . And you can go deeper into the source code of Linux kernel to find out any information you want about uhid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants