I'm using firebase_admin with python 3.8
On my computer it works very well but when I package the application with buildozer it breaks, does not run after installed on Android.
1 - Is there a mdelo application that shows the use with kivy?
2 - Is the spec file missing something?
Nothing is missing all you need is to add the following modules in your
buildozer.spec
requests, openssl, urllib3, chardet, idna, jwt, cryptography, pyparsing, firebase_admin, PIL, google-auth, cachetools, pyasn1, pyasn1_modules, rsa, google-api-python-client, google-cloud-storage, google-cloud-firestore, google-api-core, protobuf, cachecontrol, gcloud, google-cloud, httplib2
and in permission allow internet accesses like this
android.permissions = INTERNET
and you can write in your terminal for viewing logs while your app is running on your phone
buildozer android debug deploy run logcat
but you will need to allow to see only python logs by doing this in your buildozer.spec
[buildozer]
# (int) Log level (0 = error only, 1 = info, 2 = debug (with command output))
log_level = 2
if you didn't understand there is a Youtuber named Erick Sandberg you should watch his video about deploying an android app
Related
I read the official docs but just can't get it running.
https://developer.android.com/topic/performance/baselineprofiles#measuring-baseline
My basline profiles are set up and I have my baseline-prof.txt file in the main folder.
Not sure on how to test it on my device now.
The docs say:
Next, let's sideload the Baseline Profile.
Note: This workflow is only supported on version Android 9 (API 28) to Android 11 (API 30).
# Unzip the Release APK first
unzip release.apk
# Create a ZIP archive
# Note: The name should match the name of the APK
# Note: Copy baseline.prof{m} and rename it to primary.prof{m}
cp assets/dexopt/baseline.prof primary.prof
cp assets/dexopt/baseline.profm primary.profm
# Create an archive
zip -r release.dm primary.prof primary.profm
# Confirm that release.dm only contains the two profile files:
unzip -l release.dm
# Archive: release.dm
# Length Date Time Name
# --------- ---------- ----- ----
# 3885 1980-12-31 17:01 primary.prof
# 1024 1980-12-31 17:01 primary.profm
# --------- -------
# 2 files
# Install APK + Profile together
adb install-multiple release.apk release.dm
But when I start typing those commants in the Terminal it tells me right away:
unzip: cannot find or open release.apk, release.apk.zip or release.apk.ZIP.
I have no clue how to do it and I'm not able to find any other source which explains it
EDIT
The docs state: "Note: This workflow is only supported on version Android 9 (API 28) to Android 11 (API 30)."
So I cannot sideload baseline profiles on my Android 12 device?
Android 12+ security updates restrict side-loading these, so yes. You cannot, as is clear from the docs.
Here's a handy-dandy Kotlin sample to help you easily, efficiently and seamlessly find out if your version is compatible or not.
val android_version = android.os.Build.VERSION.SDK_INT
// Let Kotlin demonstrate
if (android_version in 9..11)
print("Side-loading now")
else throw Exception("Oops! Wrong Android!")
Issue on Android 12 -(https://issuetracker.google.com/issues/232104540)
Issue on Android 13 -(https://issuetracker.google.com/issues/232104548)
You can't currently on Android 12+.
If you are trying to see what your app performance feels like for a user download your app from the Play Store, you can tell the Android runtime to fully compile the app which is slightly better than Baseline Profiles by running
adb shell cmd package compile -m speed -f <YOUR_APPS_PACKAGE_NAME>
I have made an apk by converting .py kivy with the help of buidozer in google colab. The earlier versions were working but now latest version is not working.
May be there is a problem in my .spec file so I am attaching it ...
At first I think my assest(images) are causing this problem but after removing them too it's not working.
I have done some research and got this buildozer -v android debug deploy run logcat but I don't know how to execute and use this command....
.spec file link : https://github.com/AyushRaj0305/APP/blob/main/.spec
All I want is that my apk should work in android
Thanks for Help
I have same issue in past and I solve by adding requirements in .spec
This requirements work for me:
requirements = hostpython3==3.7.8,python3==3.7.8,kivy==1.11.1, certifi,chardet, lxml, docutils, future, idna, Kivy-Garden, Pygments, requests, six, soupsieve, urllib3, deep-translator, arabic-reshaper, python-bidi, openssl, pyopenssl, numpy, pytz, python-dateutil, pandas, setuptools, zope.interface, datetime
you have to write all modules and parent module in requirements which your app is using.
To know module which you app is using has two method:
run command pip freeze in current app folder in powershell
install all the module as below photo which help to install your application module
I have debugged your code and found missing PIL
We're using Travis CI in combination with Fastlane to do our automated builds and nightly UI Espresso tests. For the instrumentation tests we are trying to use Firebase Test lab using the gcloud command line tools.
I'm trying to get the test results in an easy to work with format so that I can report internally to Slack, for example how many tests passed or failed and which ones.
./google-cloud-sdk/bin/gcloud beta firebase test android run \
--type instrumentation \
--app ourapp/app/build/outputs/apk/mock/debug/app-mock-debug-local.apk \
--test ourapp/app/build/outputs/apk/androidTest/mock/debug/ourapp-mock-debug-androidTest.apk \
--device-ids hammerhead \
--os-version-ids 22 \
--locales en \
--orientations portrait \
--project ourappgoogleprojectid \
--timeout 15m
This all executes the tests fine and prints two links to the raw results in the Google Cloud Storage buckets with some random links and also some logs like this:
Raw results will be stored in your GCS bucket at [https://console.developers.google.com/storage/browser/test-lab-vx5ak1y4tt3sw-yrzyhxjh4r1r6/]
13:25:59 Test is Pending
13:26:06 Starting attempt 1
13:26:06 Test is Running
13:26:46 Logging into the device
13:26:53 Installing APK: com.ourcompany.ourapp.debug
13:27:13 Installing APK: com.ourcompany.ourapp.test
13:27:33 Running instrumentation test. Package: com.ourcompany.ourapp.test testrunner: android.support.test.runner.AndroidJUnitRunner orchestrator: false options: []
13:34:34 Instrumentation test has finished
13:34:34 Generating video
13:34:41 Retrieving performance samples
13:35:00 Retrieving test artifacts
13:35:13 Retrieving any crash results
13:35:20 Retrieving logcat
13:35:53 Done. Test time=416 (secs)
13:36:00 Test is Finished
Instrumentation testing complete.
Then finally it prints what I'm most interested in:
┌─────────┬───────────────────────────┬──────────────────────┐
│ OUTCOME │ TEST_AXIS_VALUE │ TEST_DETAILS │
├─────────┼───────────────────────────┼──────────────────────┤
│ Passed │ hammerhead-22-en-portrait │ 60 test cases passed │
└─────────┴───────────────────────────┴──────────────────────┘
But there is nothing else from which I can get a good, workable, quick summary of the results.
I think I can only do it the following way:
Grep/awk/sed/whatever the bucket url that it prints in the output. But that url has some random ID's and whatnot. Then from the bash script in Travis somehow try to download the xml files in that bucket. But all the test result xml's are in their respective folders named after what device the tests ran on. For example hammerhead-22-en-portrait. Such a hassle in order to just get a simple test summary. All I need is the info in the table that it prints above.
Is there any gcloud command option I'm missing? The documentation is horrible. I was hoping there would be options to immediately download the proper xml files or for it to set an environment variable with the proper info or something.
Or is there a way to easily extract the values from that table?
EDIT:
I just found out that Android Studio supports setting up a run configuration that automatically builds, uploads the apk's and executes the tests on a Firebase test lab matrix. You then get a nice test report in the 'Run' tab in Android Studio. From here you can export these test results to either HTML or XML. That XML is exactly what I want. Does somebody know what tools Android Studio uses to do this or how I can do the same using command line tools?
Here are some tips that should help with what you're trying to do.
Regarding the default random IDs in the results path: you can exercise more control over that path by using the --results-dir=my/results/path flag (just be sure to choose a unique value for each test you run). You can also specify --results-bucket=gs://my-bucket to control the top-level bucket where test results get stored. Note that if you use --results-bucket you need a GCP billing account and will incur Cloud Storage charges for your results; you can use the provided default bucket for no charge and the path to it should remain stable for scripting.
All of the flag options for the gcloud firebase test android run command are documented here or via the CLI by adding --help to any gcloud command or command snippet.
Using these flags, you should be able to directly grab the junit.xml file from the raw results using a gsutil cp <src> <dst> command.
If you want to parse the gcloud output directly, it is useful to know that the test result table is printed to stdout while all the status updates are printed to stderr. So you can isolate just the results by adding 1>results.out to your command. You can also control the format of the output table via the --format=<format> flag (available on all gcloud commands). For example, if you add --format=json 1>results.out to your command above, the output will look something like this:
[
{
"axis_value": "hammerhead-21-en-portrait",
"outcome": "Failed",
"test_details": "5 test cases failed, 187 passed"
}
]
You can learn more about gcloud formats by running gcloud topic formats.
I have an issue that I can't explain why it happened because I try to debug this for hours.
My application runs succeed so it is nothing about import Python library. But it always crash when i press a button to send message through bluetooth using python socket. (App written using kivy framework and using buildozer to build apk file)
import socket
def callback(self,instance,pos): # function called when button click to send text typed in text input box
a = self.text # it is text that in text input box
macadd = '20:15:ff:7e:bc:9a'
port = 1
s = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_STREAM, socket.BTPROTO_RFCOMM) # this line cause the crash
Then I type command:
buildozer init
buildozer -v android debug
file buildozer.spec doesn't change. Everything is ok and I install in my Android 4.0 using API 21. Here is the problem: WHEN I COMMENT
#s = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_STREAM, socket.BTPROTO_RFCOMM)
My app run and when click the button to submit, nothing happend, it's ok as function does.
BUT WHEN I REMOVE COMMENT:
s = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_STREAM, socket.BTPROTO_RFCOMM)
My app run and when click the button to submit, it's crashed. I don't know what to do now. I really need somebody can help me with this situation. So thank you.
I tried to create APK of my application with buildozer.
buildozer android debug
I made log_level 2 and I got this:
HTTP isteği gönderildi, cevap bekleniyor... 301 Moved Permanently
Yer: https://python.org/ftp/python/2.7.2/Python-2.7.2.tar.bz2 [izleyen]
python.org (python.org)[104.130.43.121]:443 bağlanılıyor... bağlantı kuruldu.
HATA: python.org sertifikası doğrulanamıyor. `/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert SHA2 Extended Validation Server CA' tarafından sağlanmış: Yerel olarak sağlayıcının kimliği doğrulanamaıyor.
python.org adresine güvenliği gözardı ederek bağlanmak için `--no-check-certificate' seçeneğini kullanın.
It says it cannot verify the certificate so it wants me to use --no-check-certificate argument. It seems buildozer script has used wget to download Python 2 from server, but could not use --no-check-certificate so I got this error.
I looked for some solutions, it is widely said to install cython 0.20, but that version is already installed. I also tried to use it with su, but it started the download from the beginning.
Additional Information: I also installed buildozer to my virtualenv. I wonder if I get rid of this problem if I install buildozer globally.
Actually I found the answer and I found it necessary to share it at here since I could not find any possible duplicate in the same or similiar context.
Create a ".wgetrc" file in your home folder and open it with a text editor. Edit and save:
check_certificate = off
And wget will not check for any SSL certificate. But I don't know if it's a safe way to do this.