I heard information that Android can make apps using kivy or pythonForAndroid.
But I don't know if I can make Android sdk using the above.
Even if there was information, I couldn't check because the version was very different because it was written a long time ago.
What I am most curious about is that I want to make a lib used in Android app and put Python Code in it.
I'd like you to help me, even if it's a small word.
Thank you for reading it
https://github.com/yausername/youtubedl-android/blob/master/BUILD_PYTHON.mdhttps://github.com/yausername/youtubedl-android/blob/master/BUILD_PYTHON.md
I tried the link above, but it failed because I blocked it in git.
I tried pythonForAndroid, and I failed...
All I want is to be able to use pythonCode and pythonlib as I said above.
Related
I am new to Android studio, but I decided to write my first app using kivy and then with help of buildozer create .apk file out of it.
App works on my ubuntu when running python main.py.
After some struggle (following the video https://www.youtube.com/watch?v=yr7n0C2tspI&ab_channel=ShawCode) it worked and command
buildozer -v android debug worked creating .apk file.
I uploaded it to google drive and then installed on my phone, but it did not start (black screen for a couple of seconds and then it exits).
I decided it would be a good idea to try to debug it using Android-studio and launched it but as I am new to it I am not quite sure how to use it.
I tried to open directory when the project is located, but it acts, as it could not run it.
Anyone has idea what I am doing wrong, or how to fix this situation?
[EDIT] I managed to run LogCat and extract logs (warnings and errors) from my app.
Here they are:
2021-05-25 12:52:59.581 19114-19130/org.test.misia W/libEGL: [ANDROID_RECORDABLE] format: 1
2021-05-25 12:53:02.495 19114-19143/org.test.misia E/libEGL: validate_display:99 error 3008 (EGL_BAD_DISPLAY)
2021-05-25 12:53:02.499 19114-19143/org.test.misia W/libEGL: [ANDROID_RECORDABLE] format: 1
Unfortunately they don't say much. Anyone able to translate them and see what causes it?
well, you are doing one crucial thing wrong: you are trying to import project made in some IDE (PyCharm?) in Android Studio, which does NOT support such projects. "mobile" project made in one IDE rarely works in any other IDE, due to different project structure and sometimes even language. you've picked Kivy and Python, you have to go with it and it's tools, Android Studio is for native apps, not some ports/forks. powodzenia
After some debugging and running another android emulator
we were able to conduct that the reason for crashing was that not all packages were included in buildozer.spec. The full list is:
# (list) Application requirements
# comma separated e.g. requirements = sqlite3,kivy
requirements = python3,kivy,kivymd,mapview,requests,urllib3,chardet,idna
Now it starts correctly.
Too long for a comment, but it might be helpful.
For cross platform frameworks, I've seen examples where the code produces an Android Studio project and the final step is to use Android Studio to build the project. That's why some developers suggest looking at building a native app first when you start developing apps: so that you understand how the native tools work.
Going by the Kivy documentation, it looks like Kivy produces an apk file using buildozer (as you've done), but not an Android Studio project. From here, to debug it, it looks like you're going to have to use log files and logcat.
In your app code, you'll need to write to STDOUT or STDERR (i.e. you'll need to add some log statements).
In Android Studio, you'll need to attach logcat to a running instance of your code. There are two options for this. You can either use a cable to attach your actual phone to the computer with Android Studio running on it and then connect LogCat to that. Alternatively, you can use Android Studio to start an emulator (you'll need to select a suitable emulator - there are lots of options), then install your .apk file on that emulator (i.e. just click and drag the .apk file on to the emulator once it's open).
LogCat should then be able to see the output from your apk file (although you'll probably have to filter LogCat's output because some apps can be quite "chatty" on LogCat).
Unfortunately, debugging it might be difficult - with Android Studio, you need to select the version of Android that you want to target to produce a suitable .apk for an actual device. I can't see anything in your post that indicates that you've actually made that choice, so I've no idea what level of Android you're targeting. You might get some debug info out of LogCat, but it might just be something about your app failing to launch.
Recently I've been working on a project that involves a phone taking a picture, processing it in some way, and returning the output on the screen. In order to do this, I would have to use openCV, but when I try to "import cv2" in the Kivy code using the launcher, the app crashes immediately after I run it. I realize now that the reason this happens is because the Kivy launcher by itself can only do basic functions like print and such and there must be extra steps needed to use external libraries. I tried to use Buildozer to create a package for android, but soon found out that it only would work for linux computers, while I use Windows.
Essentially, my question is: Is there any way to include an external library in Kivy without using buildozer? And if there is, could you please describe it or post a link to a webpage that contains instructions(as I am fairly new to programming and am somewhat of a noob)
Thanks!
You can try python-for-android.
But the easiest way - install virtual box to your PC, download kivy/buildozer for VirtualBox( it calles Virtual Machine (for Android/buildozer)) here below: https://kivy.org/#download and then just connect downloaded vmdk-disk to VirtualBox, and then use this. Everything is prepared, you don't need to install kivy or buildozer.
You will spend about 30-40 minutes.
I am a beginner in python so my question is kinda trivial. I have an open-source library that I would like to develop and contribute to.
Lets say the lib has operations A,B and C. I want to change something in, say code of A operation and test it. However, every time I execute my modified code of the library it always tends to run the version of the lib installed with pip.
I am new to python, but how can I develop code of this lib and then run it using the code that I have actually modified? So that I can see my changes or maybe debug the execution.
What is the pythonic way of developing locally an OS library so that I can run it, debug it and test it?
I wanna know if i can use buildozer for non-kivy python scripts. Is it possible to build apk files from ordinary python scripts other than kivy scripts?
I would say that it probably isn't possible. However, you should ask in the kivy support group. You need to join it to post. Some people there really seem to know their kivy, and in my experience, I haven't had to wait too long for answers.
EDIT:
If you look in the buildozer.spec file of your project, you will see the following lines are included by default:
# (list) Application requirements
requirements = kivy
While this makes it seem like kivy may be a requirement for all projects with buildozer, you could try commenting out the requirements or something and see what happens when you try to compile code without kivy.
Or since that is a bit of a backwards way to do it, as you would have to have already created your buildozer.spec file. Perhaps you could just try using buildozer on a project without kivy and see what happens.
I'm not sure if I'm even asking this question correctly. I just built my first real program and I want to make it available to people in my office. I'm not sure if I will have access to the shared server, but I was hoping I could simply package the program (I hope I'm using this term correctly) and upload it to a website for my coworkers to download.
I know how to zip a file, but something tells me it's a little more complicated than that :) In fact, some of the people in my office who need the program installed do not have python on their computers already, and I would rather avoid asking everyone to install python before downloading my .py files from my hosting server.
So, is there an easy way to package my program, along with python and the other dependencies, for simple distribution from a website? I tried searching for the answer but I can't find exactly what I'm looking for. Oh, and since this is the first time I have done this- are there any precautions I need to take when sharing these files so that everything runs smoothly?
PyInstaller or py2exe can package your Python program.
Both are actively maintained. PyInstaller is actively maintained. py2exe has not been updated for at least a year. I've used each with success.
Also there is cx_Freeze which I have not used.
Take a look at http://www.py2exe.org/