Open huynhtanloc2612 opened 1 year ago
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.
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;
}
Hi @WuDi-ZhanShen , I have unzip a apk and seen that only
classes4.dex
file is the correct .dex file. So I changedif
condition inunzipFiles()
method the withclasses4.dex
instead ofclasses.dex
and the project work as expected. It means that I can run the command ofadb 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.
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.
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 itsdescription[]
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.
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).
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 ofapp_process
to see if there is any message and saw only "Aborted" Hope I could get your feedback and advices for this. Thank you!