shell script in android gives [: not found
generally [
is an alias for test
,
in Linux machine test is at
/usr/bin/test
and
if [ $c == 1 ]
is evaluated as
if test "$c" = 1
BUT here in android there is no test
so if with [] will not work in any case...
i will cross compile test for android and check it....!!!
Shell script works in bash but not on 'adb shell'
When the value of $x
is just =
, it looks like:
if [ = = " " -o -z = ]; then
and it's apparently getting confused by the =
that should be a value rather than an operator.
Change it to:
if [ "x${x}" = "x " -o "x${x}" = "x" ]; then
Shell script does not work when pushed to device
I solved the problem with a little workaround.
I just start the pm uninstall command also from the batch and do not push it to the device.
Like this: (uninstall.bat)
adb shell pm uninstall --user 0 com.google.android.gm
adb shell pm uninstall --user 0 com.google.android.apps.maps
adb shell pm uninstall --user 0 com.google.android.youtube
pause
Unable to execute a shell script in android shell
Usually this happens when a shebang is not correct. Check if you have a "#!..." at the start of the script and remove it or correct it
No such file or directory but it exists
This error can mean that ./arm-mingw32ce-g++
doesn't exist (but it does), or that it exists and is a dynamically linked executable recognized by the kernel but whose dynamic loader is not available. You can see what dynamic loader is required by running ldd /arm-mingw32ce-g++
; anything marked not found
is the dynamic loader or a library that you need to install.
If you're trying to run a 32-bit binary on an amd64 installation:
- Up to Ubuntu 11.04, install the package
ia32-libs
. - On Ubuntu 11.10, install
ia32-libs-multiarch
. - Starting with 12.04, install
ia32-libs-multiarch
, or select a reasonable set of:i386
packages in addition to the:amd64
packages.
.sh File Not Found
You probably have set the wrong shabang. In ubuntu bash is normally located in /bin/bash
so at the top of the file you should have:
#!/bin/bash
instead of:
#!/usr/bin/bash
Another way to run the script is to just tell bash
(or sh
) to execute it:
bash ./test.sh
Failed to install the following Android SDK packages as some licences have not been accepted error
You need to accept the licences before building.
According to Android SDK docs you can use the following command depending on the sdkmanager location: Docs on --licenses
option seems to be missing though.
yes | sdkmanager --licenses
GNU/Linux Distributions:
yes | ~/Android/Sdk/tools/bin/sdkmanager --licenses
macOS:
export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jre/jdk/Contents/Home
yes | ~/Library/Android/sdk/tools/bin/sdkmanager --licenses
Windows:
%ANDROID_HOME%/tools/bin/sdkmanager --licenses
Flutter:
> flutter doctor --android-licenses
Related Topics
Export a Python Script to an Android Executable (.Apk) with Python-For-Android
Jelly Bean Datepickerdialog --- How to Cancel
How to Show Icons in Overflow Menu in Actionbar
Android Push Notification (Gcm), Is There Any Daily Limit
How to Add a Dropdown Item on the Action Bar
How to Save Custom Arraylist on Android Screen Rotate
Android Timepickerdialog Set Max Time
Change Drawable Color Programmatically
Convert a Bitmap to Grayscale in Android
Difficulties with Calling an Android Ndk Function from Directly Delphi
How to Get an Event in Android Spinner When the Current Selected Item Is Selected Again
Java.Lang.Classnotfoundexception on Working App
Phonegap - Add a Splash Screen for Android App
How to Handle Cookies in Httpurlconnection Using Cookiemanager
Android Create Folders in Internal Memory
Change the Color of a Checked Menu Item in a Navigation Drawer