jeudi 21 janvier 2021

vendredi 15 janvier 2021

How to view crash logs with adb logcat ?

 Use the following command, after the crash happens :

adb logcat AndroidRuntime:E *:S

jeudi 14 janvier 2021

How to build an universal APK when using NDK C++ in Android Studio ?

 In the module build.gradle, add the following lines in the android section :

splits {
abi {
enable true
reset()
universalApk true
}
}

Then when you build the APK (even the debug one), it will install on all Android devices.



mercredi 30 décembre 2020

How to sign an Android app for it to be seen as a system app ?

 I've just read the following topic on StackOverflow and I think that it can be very useful to replicate the procedure here.

  1. Add to manifest android:sharedUserId="android.uid.system"

  2. Download System signatures files: platform.x509.pem platform.pk8

        link: https://android.googlesource.com/platform/build/+/android-8.0.0_r17/target/product/security/

  1. Sign app through terminal (java -jar signapk.jar platform.x509.pem platform.pk8 unsigned.apk signed.apk) (first you must put all files to one folder), or make certificate with keytool-importkeypair to make google_certificate.keystore and then

        link for keytool-importkeypair download and explanation:

              https://github.com/getfatday/keytool-importkeypair

  1. After that steps install your signed system app to your device.


vendredi 27 novembre 2020

mardi 24 novembre 2020

Adb shell on Android 10 : How to view IP address ?

If you have error "ifconfig: ioctl 8927: Permission denied" when trying to use "ifconfig" then you can use the following command :

ip -f inet addr show


Sample output :

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1

    inet 127.0.0.1/8 scope host lo

       valid_lft forever preferred_lft forever

11: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 3000

    inet 192.168.1.24/24 brd 192.168.1.255 scope global wlan0

       valid_lft forever preferred_lft forever



lundi 23 novembre 2020

Changer d'adresse IP avec netsh sur Windows

Pour obtenir une adresse IP statique :

netsh interface ip set address "Connexion au réseau local" static 192.168.1.251 255.255.255.0 192.168.1.1 1

Ici, la gateway est 192.168.1.251 et l'adresse IP statique est 192.168.1.1


Pour obtenir une adresse IP dynamique (DHCP) :

netsh interface ip set address "Connexion au réseau local" dhcp



Transférer une base de données depuis Android vers PC en ligne de commande avec adb.

 Voici comment transférer une base de données SQLite depuis un Android vers le PC en ligne de commande. Ceci fonctionne aussi bien sur Windows que sur Linux :

cd C:\Users\UserName\AppData\Local\Android\Sdk\platform-tools

adb exec-out run-as com.activity.myapplication cat /data/data/com.activity.myapplication/databases/DataBase.db > C:\Users\UserName\DataBase.db

adb exec-out run-as com.activity.myapplication cat /data/data/com.activity.myapplication/databases/DataBase.db-shm > C:\Users\UserName\DataBase.db-shm

adb exec-out run-as com.activity.myapplication cat /data/data/com.activity.myapplication/databases/DataBase.db-wal > C:\Users\UserName\DataBase.db-wal

Bien sûr vous devez modifier le nom du package par le vôtre, ainsi que le nom de la base de données et le répertoire de destination sur le PC.



jeudi 19 novembre 2020

Tools for downloading Youtube videos to your computer

 Here are some links that will be useful to do that :


Youtube-dl documentation (don't download the tool from there) :

https://github.com/ytdl-org/youtube-dl


Youtube-dl .EXE download (get the latest one) :

https://github.com/ytdl-org/youtube-dl/releases/tag/2020.11.12


FFMPEG download (put the ffmpeg.exe file next to the youtube-dl.exe file) :

https://www.gyan.dev/ffmpeg/builds/


A small example to download to a MP3 file :

youtube-dl --extract-audio --audio-format mp3 https://www.youtube.com/watch?v=fd0qV2LErzA


Another example that downloads to a MP3 file on a F: drive (USB) :

youtube-dl --extract-audio --audio-format mp3 -o 'F:\%(title)s.%(ext)s' https://www.youtube.com/watch?v=fd0qV2LErzA


Another example for downloading 10 MP3 from a search about "sizzla 2020" :

youtube-dl --extract-audio --audio-format mp3 -o "F:\%(title)s.%(ext)s" "ytsearch10:sizzla 2020"


Have fun with all that !