MX09 support (+Android build issues + how I fixed them) #70
meglyne
started this conversation in
Show and tell
Replies: 1 comment
-
Cheers for your achieving experience 🎉 A fun fact about this project is that who come here are either pros or wanna-be geeks that have made their first step. I just had free time, and would like to make a new release including community contributions like this one. I’m glad this project have given ones feeling of achievement… wonderful! Tip: you may want to submit pyjnius related issues to its dedicated repo. I’m not experienced with Java or Android or so, and have no relationship with it (other than a common user) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I'm creating this discussion to suggest the support of the MX09 printer to the project, as well as some issues I encountered while building the app for android, how I fixed them, and the process I went through.
Device issues encountered
In order of appearance
After installing the project on my Linux programming machine, I've actually been able to print pictures
In
models.py
, I've added the device nameMX09
to the list (line 21 to 23)After some preliminary testing, I've noticed that the printer was not pushing paper all the way through after printing was completed (the picture was properly printed on paper). This was fixed by adding the model to the list of models with problems feeding paper in
models.py
(lineAndroid build issues encountered
Build environment
I've used the android build guide to build the app, so I'm running it on an arch linux container in docker, with
mnt/data
mounted on my physical machine.Build error n°1 : pyjnius config file missing
This error was caused by a missing file (
config.pxi
) in the pyjnius environment, which determines what the target platform will be.Error message
Fix
config.pxi
in$DIR_P4A/build/other_builds/pyjnius-genericndkbuild/arm64-v8a__ndk_target_21/pyjnius/jnius
Alternate fix
Run the following command
Build error n°2 : javac target version unsupported
This error was caused by a misconfiguration in the source and target options of pyjnius. Source and Target options 7 by javac in version 20 of openjdk. Now I'm not sure as of how much it is an issue since I've downgraded to openjdk 17 to fix Build error n°3, so take this with a grain of salt and I'll investigate that.
Error message
Fix
I opened the file
$DIR_P4A/build/other_builds/pyjnius-genericndkbuild/arm64-v8a__ndk_target_21/pyjnius/setup.py
and changedsource_level
from'1.7'
to'1.8'
Build error n°3 : class file major version unsupported by Gradle
This error happens because Gradle doesn't support
class file major version 64
while buildingbuild.gradle
. I've fixed it by doing two things:gradle-wrapper.properties
from 7.4.1 to 7.6.2 (this changed the format of the error message tobut the error remained the same.
Error message
Fix part 1 : Upgrading gradle
In
$DIR_P4A/dists/cat-printer/gradle/wrapper/gradle-wrapper.properties
, I've changed the Url of the Gradle downloaded version from version7.4.1
to version7.6.2
To :
Fix part 2 : Downgrading openjdk
The new error message led me to the following stackoverflow issue. According to the solution, this issue may also have been caused because of incompatibilites in support between gradle and openjdk. The default installation of openjsk with
pacman -Syuu jdk-openjdk
installs openjdk version 20. So I followed the Archlinux wiki article on java to install openjdk version 17 and to enable it by default like soShowing openjdk17 as the default installation
Remarks
I'm not sure how much upgrading Gradle to version 7.6.2 has fixed the issue and I'd say it's mostly using openjdk 17. So I'll try to test further on that.
Additional python package install remarks
On the arch linux docker install, running pip while not sourcing a virtualenv triggers the following error message.
While I understand this is running in a docker container created specifically for building the android app, I believe using a virtual environment is the best practice there. Therefore, I have installed the python packages like so
Conclusion
While I'm not sure how to fix the build errors regarding pyjnius from the source code, I believe specifying the openjdk version while installing the arch linux packages in the docker container will solve a lot of further issues if your intent is to make minimal changes to the android build instruction manual. I've always had a lot of trouble with building apps with gradle for android or java applications and it's always a mess in my opinion, but I'm glad I made it in the end. In that regard, the android building guide was very straight-forward and helped me a lot!
Context
I've bought recently a cat printer from Amazon. I've tried to use it on Android through the bloated app "Fun Print" and I've been taken aback by the amount of permissions requested and the fact that it was annoyingly turning the Bluetooth back on every time I was turning it of (concerning isn't it ?). I've stumbled upon the Cat-Printer project and I've installed the apk, but I haven't been able to use it because the name MX09 wasn't recognized by the app, and that's what made me contribute. While adding the device to the list of supported devices was pretty straight-forward, the building process for android took me a lot of time because of the errors that I've mentioned.
It's my first time contributing to an open-source project and I thought I'd share my experience. I hope I've not been too verbose...
Beta Was this translation helpful? Give feedback.
All reactions