Question and Answer about Android from Stack Exchange network.


Lately I've been playing around with .sh scripting in Android. At first I used BusyBox and it's integrated scripting utility, though I quickly realised that coding on the phone isn't the best, so I switched over to my desktop and started using ADB to push my scripts to my device. It all worked well for about two weeks, until recently the exact same scripts that used to work perfectly, tell me some : not found[0]: syntax error: '{ Error. I've copied the exact same code from my script and used BusyBox to create it for me, and that way it works just fine. So the code is fine.

After some digging, I think it's either because of permissions, because of encoding possibly, or also because of the location of the scripts. I've tried many different locations (because I want to be able to run the scripts without root), and ended up choosing /storage/emulated/0. If I understood correctly, this is a symlink to the internal storage, which is read/write-able without root. But maybe sometimes executable and sometimes not? I don't know.

So my question is as following: What is the best location on an Android Device to run scripts without root from? Preferably a path that works on any android device.

Info:

  • Rooted Samsung S7 SM-G930F
  • Android 8.0.0
  • I'm using #!/system/bin/sh inside the .sh files
  • I'm running the scripts with sh script.sh
  • When trying to run it as an executable ./script.sh, I get a Permission denied error. With or without root.

PS: And if anyone has a clue to why the exact same scripts stopped working out of nowhere, I'd be happy to know!

UPDATE: Thanks to @IrfanLatif, I've managed to fix the : not found[0]: syntax error: '{ Error! I was using Visual Studio Code as my editor for the scripts, which was saving them with the End of Line Sequence CRLF, which Android doesn't like. For an easy fix, just change your Line Endings to LF, problem solved. Check the comments out for more info.

I've an Android 9 Samsung tablet. I've set up normal (I.e. not limited) accounts for my children. When the tablet reboot, the only account which is usable is mine. The others are greyed out. When I've logged in once, the other accounts are unlocked.

I'd like my children to be able to use the tablet after a reboot without me needing to log in. How can I achieve that?

I found this question which seems similar but it has no answers.

I own a Samsung Galaxy Tab S6, and it's quite good... except for Samsung's software, which I would qualify as bloatware without hesitation.

I bought a cable that is able to move signal from USB-C ports to HDMI ports, and I connected my tablet to my TV using that cable.

The problem arrives when Samsung, in all its wisdom, refuses to just stream my screen, and insists on starting this Frankenstein thing of Dex. Even if the idea seems good, its execution is very poor, and all the software running on it becomes highly unstable, crashing all the time (when it does not have any problems running in basic mode).

And that's why I'm looking for some way to send my tablet screen to my TV while avoiding to activate Dex.

As an extra, I also considered using something like Chromecast Ultra, and in fact I did, but its streaming quality is just a disaster, and looses a lot of quality (hence my intention to go with simple cables).

Thank you for your attention.

I'm making an installation using Android (Bliss Os).

For getting the recognizable android keyboard that everybody knows I installed GBoard. Everything worked fine except that my keyboard misses half the most left line of letters.

Does anybody have any experience with this problem? I already tried using a different display but this didn't help.

Also tried installing swiftkey. But this also had the same problem. They do have a functionality to rescale the keyboard but this is a dirty fix for my problem..

Picture Screen

Sorry for the bad picture quality, I do not have the buttons on this elo touch display to take a screenshot.

I'm trying to understand how Android works internally. Before ART, it used Dalvik to run java code. I guess it created a Dalkiv process in 'Linux' kernel which was simply a VM that ran the dex bytecode.

For ART, the dex bytecode is compiled into instructions in the processor's architecture (happens during the installation process). This compiled dex bytecode is stored into an ELF binary. So it's somethig that 'Linux' kernel can understand.

So suppose I wanted to run this ELF binary on Linux. Besides ashmem and binder kernel modules, what more would I need? Which libraries do this ELF binary require? Is this ELF binary simply launched as a linux process?

I tried reading anbox.io source code, but I couldn't understand how it launched an ELF binary from an APK. Maybe understanding what it's required to run it will make me understand anbox.io's source code better.

I also found https://android.googlesource.com/platform/art/+/refs/heads/master/runtime/ but I don't know where to begin. What is /runtime? Is it a program, a library? Is Android Runtime something that is linked together with the ELF binary generated from dex bytecode?

My oneplus 3T running Oxygen OS 9.0.6 (Android 9) came with full system encryption by default.

I want to install root but also keep full system encryption.

  • Will root disable encryption?
  • Does root allow to bypass encryption / lock screen with adb or some other method? (I. e. in any case)
  • I am familiar with the half-baked Android system backup feature. is there a way to root the phone without a factory reset? if not, what is the best way to create a system image or similar so I don't have re-install and configure everything over again?
  • what is the difference between system and systemless root?

If my phone natively supports Widevine L1 in order to play 1080p to 4K videos on Netflix or Amazon Prime, will Netflix play the high res rather than 480p with magisk that passes safetynet.

The current state of the device is shown bellow. I prefer using heimdall to flash each partition directly from command line if possible. Unless it is mandatory to put all images inside a tar and flash them at the same time.

Top left corner of the Download mode screen:

enter image description here

More details of the previous (and solved) problem here: question

Everything was fine on my rooted device with magisk, until I flashed a custom recovery (TWRP) on RECOVERY partition. That didn't work, resulting in a message "recovery error validating footer vbmeta" during boot into "download mode".

Perhaps the device was still ok after that. However, trying to fix the message and put TWRP to work, I flashed a vbmeta.img on VBMETA partition. This resulted in the current boot loop, I suppose because of some checksum regarding vbmeta and the (stock) root partition.

Is there any hope for this device?

I am still waiting for the battery to drain, but so far all the attempts with using the buttons/USB failed to be able to communicate with the device in any way. I does anything other than just rebooting.

I setup a captive portal on a wireless access point. If I use a laptop to connect to it, the laptop pops up a browser telling me to login to the captive portal. I can open any browser on the laptop (IE, Chrome, Firefox) and it works fine.

With my Samsung Galaxy S8 (Android 9), when I connect to the wireless access point, Android automatically checks for captive portals, same as every other device does these days. Since it detects it, it also pops up a browser and tries to load the login page, and on my phone, it shows an SSL cert error. Other Android phones don't have this error.

enter image description here

If I tell my phone to stay connected to the WiFi despite not having logged in, and open Chrome on my phone, the exact same captive portal redirect loads without any issues. It is clear that whatever internal browser my phone is popping up, it's not the regular Chrome browser, as that one works fine. It also doesn't appear to be the "Internet" app my phone shipped with, as that shows no SSL error either.

What browser is my Galaxy S8 using to detect captive portals? Why does it have an SSL error when other browsers and devices don't? How do I even begin to debug this?

Note: My SSL cert was generated by LetsEncrypt. It points to http://ocsp.int-x3.letsencrypt.org as the server for verifying that the cert hasn't been revoked. I added this domain to my captive portal's walled garden (bypass) list, so that connections to that domain are NOT redirected, but it didn't help.

Basically, there's a file /etc/dhcpcd/dhcpcd.conf . Is this file or dhcpcd used at all? My phone runs Android 7.1.2 and I wanted to change the default hostname using the hostname somename line in this file, but it looks like it was ignored (there was no change in dhcp request).

I've read something about "legacy Android DHCP client" in the dev options, but I don't have this position there, and also I couldn't find anything about the modern DHCP client, which I think is used now - does it have any config file like dhcpcd?

I have a Samsung Galaxy S7 Edge in which I put a 400GB SanDisk micro-SD card to expand its storage space. Seems that didn't work though. The space is not available to me. And I can't really figure out why or how I can make this space available.

When I inserted the SD card, I selected that this SD card needs to be adopted as internal storage (I don't intend to take it out any time soon). And I had Android reformat it as it likes. However the storage app seems to be confused or the partitions messed up.

Bottom line, I'm not able to take more photos or transfer more music onto the phone because it's running out of storage.

Here's what the "Storage Settings" settings menu says about my disk usage:

  • 367GB total used of 728GB
    • Internal shared storage: 366GB used of 367GB
      • Apps: 845MB
      • Images: 483MB
      • Videos: 0
      • Audio: 19.50GB
      • System: 342GB
      • Other: 3.17GB
      • Cached data: 112MB
    • SanDisk SD Card: 0.96GB used of 361GB
      • Apps: 2.71GB
      • Cached data: 40.42MB

Bold is my highlight. I don't understand why System is using 342GB or why it's counting the SD card double (the phone itself comes with 32GB built-in storage). Why is it not letting me store these files on the SD card?

I have Termux installed and here's the output of the df command:

Filesystem       1K-blocks     Used Available Use% Mounted on
rootfs             1680128     4560   1675568   1% /
tmpfs              1816220      448   1815772   1% /dev
tmpfs              1816220        0   1816220   0% /mnt
/dev/block/dm-0  378585556  1006608 377562564   1% /mnt/expand/612126b2-7bab-4bf8-8a24-ebacec5b0c23
/dev/block/sda14   4233152  1095448   3121320  26% /system
/dev/block/sda15    197472      188    193188   1% /cache
/dev/block/sda18  25772320 25243840    512096  99% /data
/data/media       25772320 25243840    512096  99% /storage/emulated

So I understand that this /storage/emulated is the one that's full, but somehow in this /dev/block/dm-0 there is this 377.6GB of space being unused. How can I make that space available to me? I've got ADB installed on my computer if necessary. It seems that the only thing saved on the SD card is several apps.

When my phone connects to my home WiFi network, it sends DHCP request in order to get an IP address. It looks like the following:

22:50:53.743535 IP (tos 0x10, ttl 64, id 0, offset 0, flags [DF], proto UDP (17), length 328)
    0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from a0:39:f7:5f:c0:45, length 300, xid 0xddd7abec, Flags [none]
          Client-Ethernet-Address a0:39:f7:5f:c0:45
          Vendor-rfc1048 Extensions
            Magic Cookie 0x63825363
            DHCP-Message Option 53, length 1: Discover
            Client-ID Option 61, length 7: ether a0:39:f7:5f:c0:45
            MSZ Option 57, length 2: 1500
            Vendor-Class Option 60, length 18: "android-dhcp-7.1.2"
            Hostname Option 12, length 9: "localhost"
            Parameter-Request Option 55, length 10:
              Subnet-Mask, Default-Gateway, Domain-Name-Server, Domain-Name
              MTU, BR, Lease-Time, RN
              RB, Vendor-Option

As you can see, there's Vendor-Class Option 60, length 18: "android-dhcp-7.1.2" which contains the OS version. Is there a way to remove this from the request?

In operating systems like windows there is a special folder like Program Files where the executables themselves are stored. But in android it's kind of amazing that the binaries themselves are hidden after their installation via an APK file, and the APK can be deleted safely. Moreover, the only way to uninstall an app is via the application manager! Can anyone give me insights to the reason behind this design ?

I want to find a folder, where Firefox for Android is keeping files generated by installed add-ons (list of saved tabs in OneTab, for example). I've tried to do a full root file system search (e.g. onetab.html, store.json) and looked insede specific app folders (e.g. /data/data/org.mozilla.firefox). Found nothing but the .xpi extension files.

According to Help @ one-tab.com, tabs data is located in C:\Users\Username\AppData\Roaming\Mozilla\Firefox\Profiles\Profile Folder\jetpack\[email protected]\simple-storage\store.json for a Windows desktop version. On Android, using rooted Amaze, I've found nothing similar.

Where should I search next? Are those files even visible for a root user?

I was about to buy some Samsung Galaxy Buds but then saw in the system requirements that they required 1.5GB of ram to operate!

"Compatibility" section under "specifications" https://checkout.telstra.com.au/consumer/rewards/headphones-speakers/145

I'm using an old S7 Android Galaxy phone. Right now it is using 2.9GB out of it's available 3.5GB of RAM just with the apps I have open.

I'm worried that my phone doesn't have enough ram to use the headphones.

Do the ear buds really require 1.5GB of RAM to operate?

I use Xiaomi Mi 4 (Android 7.1.2 Nougat) phone's hotspot to surf the internet on a laptop. After sometime approximately 20 minutes, the phone automatically turns off the mobile data and I have to turn on the mobile data manually.

I think the phone turns off the data automatically because it is left undisturbed and to save battery. However, the phone is already plugged-in to the charging spot.

How to prevent mobile data from automatically turning off after a while on Xiaomi Mi 4?

I use Samsung Galaxy S9 with Android 9.

Screenshot from the Google Drive Android application, which seems to indicate that it is possible to change the theme in the battery saver:

Google Drive providing 'Set by Battery Saver' for theme

How can one change the battery saver to dark mode in Android 9 (Samsung Galaxy S9)?

I haven't used my Galaxy Tab 3 in ages and would like to use it again, but it's not working as it used to. I would like to perform full system restore, but I'm having real problems.

Last month:

I press the On / Volume up / Start buttons to get to MANUAL MODE.

It gives me an option to do a factory reset, and says to use the volume buttons to get to this option.

I press to go down and it skips over the reset option, meaning I can't do it.

Today:

I press the On / Volume up / Start buttons and it crashes on MANUAL MODE saying:

-- Applying Multi-CSC...  
Applied the CSC-code : BTU  
Successfully appled multi-CSC.  

How do I do a factory reset in another way?

The question is what to grep/filter?

adb logcat | grep what?
adb install file.apk

tried with grep apk and manual install, but it contains no useful information:

01-25 17:29:05.721  4241  6322 I ActivityManager: START u0 {dat=file:///data/user_de/0/com.google.android.packageinstaller/no_backup/package7763548981090696460.apk flg=0x2000000 cmp=com.google.android.packageinstaller/com.android.packageinstaller.InstallInstalling (has extras)} from uid 10020, pid 24521
01-25 17:29:08.660  4241  5058 I ActivityManager: START u0 {dat=file:///data/user_de/0/com.google.android.packageinstaller/no_backup/package7763548981090696460.apk flg=0x2000000 cmp=com.google.android.packageinstaller/com.android.packageinstaller.InstallFailed (has extras)} from uid 10020, pid 24521

tried with grep apk and adb install nothing captured (stuck), how can i know what part causes the installation failure?

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes