Android-sdk emulator doesn't work - android

My platform: debian 8 (sid)
uname -a : Linux ... 3.2.0-4-686-pae #1 SMP Debian 3.2.78-1 i686 GNU/Linux
I downloaded android-sdk_r24.4.1-linux.tgz from https://developer.android.com/
but emulator(*) executables don't run because I get :
"bash: tools/emulator: cannot execute binary file: Exec format error. "
I guess this means these binaries can't run on my system. So does it mean , I can't run the emulator on my platform?
I didn't find source of emulator in tgz.
Or where can I find the source of emulator?
thanks

Hehe....
If I downloaded tgz file with wget (wget http://dl.google.com/android/android-sdk_r24.4.1-linux.tgz), binaries work!
I don't understand why.... ?.... :-|

Didn't work ! :(
This was very strange for me.
When I downloaded tgz and extracted, the binaries worked.
I run SDK manager and downloaded some packages for example : some System Images, Android 6.0 SDK platform, build tools, etc, and after this, binaries didn't work.
I figured it out, the case of problem was I updated current SDK tools. After update The binaries didn't work.

Related

Install build tools on arm64 doesn't work

I've been trying to install sdkmanager "build-tools;30.0.2" on an arm64 processor (ampere CPU).
But every time I get this:
Warning: Dependant package with key emulator not found!
Warning: Unable to compute a complete list of dependencies.
I'm trying to build an app and I get this error:
Failed to install the following SDK components:
build-tools;30.0.2 Android SDK Build-Tools 30.0.2
Edit: I think the problem is the package emulator isn't available. I tried downloading it from here but sdkmanager didn't recognize it.
(Assumption: CMD Line Tools are installed)
SDK manager package "emulator" is missing on ARM
Workaround:
Download emulator from Google for Linux: https://developer.android.com/studio/emulator_archive
Extract it to $ANDROID_SDK_HOME/emulator
You need a license file called "package.xml" which is automatically created when you download it via Android Studio UI SDK Manager, you copy that file to $ANDROID_SDK_HOME/emulator and change all version numbers related to the version you have downloaded:
... <revision><major>31</major><minor>1</minor><micro>4</micro></revision>...
I was able to install build-tools using sdkmanager on arm64 by copying to the sdk dir emulator from
https://chromium.googlesource.com/android_tools/+/refs/heads/main/sdk/emulator/
Unfortunately the installed packages seem to be not compiled for arm64 and are not working.
Anybody help to cross compile emulator for arm64 ?
https://developer.android.com/studio/releases/emulator
Emulator for ARM64 hosts
Linux emulator source code now supports cross compilation from x86_64 to arm64 hosts, enabling running arm64 system images with KVM virtualization. Currently, only -gpu swiftshader_indirect (Swiftshader arm64 host rendering) is supported, but a compatible set of host GPU libEGL/libGLESv2 libraries may also be used by replacing lib64/gles_swiftshader with them and then relaunching with -gpu swiftshader_indirect. Snapshots may also not be working (add -no-snapshot to the command line).
Instructions:
cd emu
repo init -u https://android.googlesource.com/platform/manifest -b emu-master-dev --depth=1
repo sync -qcj 12
cd external/qemu
pip install absl-py
pip install urlfetch
sudo apt-get install crossbuild-essential-arm64
python android/build/python/cmake.py --noqtwebengine --noshowprefixforinfo --target linux_aarch64
Anybody try this one ?
I got error and unable install one toolm

'apkanalyzer' is not recognized as an internal or external command

I often compare my new build apk size with the production build and I am looking for options to automate this activity such that it compares both new and prod apk sizes and reports me.
I am aware of APK Analyzer of Android Studio but I want to do that using command-line tools. This doc lists the usage of apkanalyzer but upon running this command
apkanalyzer -h apk file-size myapk.apk
It says "'apkanalyzer' is not recognized as an internal or external command, operable program or batch file." though I have already set the environment path to \Android\sdk\tools\bin.
Not sure why command-line is not recognizing this command, could you let me know where I could possibly have gone wrong or is there any other way to check apk file size using command-line?
Thanks for any help in advance.
apkanalyzer is unix shell script, here converted batch script for windows, make sure to change APP_HOME and CLASSPATH to match your setup. save it as apkanalyzer.cmd
#echo off
::##############################################################################
::##
::## apkanalyzer start up script for Windows
::##
::## converted by ewwink
::##
::##############################################################################
::Attempt to set APP_HOME
SET SAVED=%cd%
SET APP_HOME=C:\android\sdk\tools
SET APP_NAME="apkanalyzer"
::Add default JVM options here. You can also use JAVA_OPTS and APKANALYZER_OPTS to pass JVM options to this script.
SET DEFAULT_JVM_OPTS=-Dcom.android.sdklib.toolsdir=%APP_HOME%
SET CLASSPATH=%APP_HOME%\lib\dvlib-26.0.0-dev.jar;%APP_HOME%\lib\util-2.2.1.jar;%APP_HOME%\lib\jimfs-1.1.jar;%APP_HOME%\lib\annotations-13.0.jar;%APP_HOME%\lib\ddmlib-26.0.0-dev.jar;%APP_HOME%\lib\repository-26.0.0-dev.jar;%APP_HOME%\lib\sdk-common-26.0.0-dev.jar;%APP_HOME%\lib\kotlin-stdlib-1.1.3-2.jar;%APP_HOME%\lib\protobuf-java-3.0.0.jar;%APP_HOME%\lib\apkanalyzer-cli.jar;%APP_HOME%\lib\gson-2.3.jar;%APP_HOME%\lib\httpcore-4.2.5.jar;%APP_HOME%\lib\dexlib2-2.2.1.jar;%APP_HOME%\lib\commons-compress-1.12.jar;%APP_HOME%\lib\generator.jar;%APP_HOME%\lib\error_prone_annotations-2.0.18.jar;%APP_HOME%\lib\commons-codec-1.6.jar;%APP_HOME%\lib\kxml2-2.3.0.jar;%APP_HOME%\lib\httpmime-4.1.jar;%APP_HOME%\lib\annotations-12.0.jar;%APP_HOME%\lib\bcpkix-jdk15on-1.56.jar;%APP_HOME%\lib\jsr305-3.0.0.jar;%APP_HOME%\lib\explainer.jar;%APP_HOME%\lib\builder-model-3.0.0-dev.jar;%APP_HOME%\lib\baksmali-2.2.1.jar;%APP_HOME%\lib\j2objc-annotations-1.1.jar;%APP_HOME%\lib\layoutlib-api-26.0.0-dev.jar;%APP_HOME%\lib\jcommander-1.64.jar;%APP_HOME%\lib\commons-logging-1.1.1.jar;%APP_HOME%\lib\annotations-26.0.0-dev.jar;%APP_HOME%\lib\builder-test-api-3.0.0-dev.jar;%APP_HOME%\lib\animal-sniffer-annotations-1.14.jar;%APP_HOME%\lib\bcprov-jdk15on-1.56.jar;%APP_HOME%\lib\httpclient-4.2.6.jar;%APP_HOME%\lib\common-26.0.0-dev.jar;%APP_HOME%\lib\jopt-simple-4.9.jar;%APP_HOME%\lib\sdklib-26.0.0-dev.jar;%APP_HOME%\lib\apkanalyzer.jar;%APP_HOME%\lib\shared.jar;%APP_HOME%\lib\binary-resources.jar;%APP_HOME%\lib\guava-22.0.jar
SET APP_ARGS=%*
::Collect all arguments for the java command, following the shell quoting and substitution rules
SET APKANALYZER_OPTS=%DEFAULT_JVM_OPTS% -classpath %CLASSPATH% com.android.tools.apk.analyzer.ApkAnalyzerCli %APP_ARGS%
::Determine the Java command to use to start the JVM.
SET JAVACMD="java"
where %JAVACMD% >nul 2>nul
if %errorlevel%==1 (
echo ERROR: 'java' command could be found in your PATH.
echo Please set the 'java' variable in your environment to match the
echo location of your Java installation.
echo.
exit /b 0
)
:: execute apkanalyzer
%JAVACMD% %APKANALYZER_OPTS%
While checking the output of appium-doctor command - The following error was seen -
android, apkanalyzer could NOT be found in /Users/{user_name}/Library/Android/sdk!
The solution was to enable Android SDK Command-line tools from Android Studio Preferences
Checkout the screenshot
Hope this helps
APK Analyzer tool is available in android studio https://developer.android.com/studio/build/apk-analyzer.html.
Most the command executable options can be used just with the good UI available in the Android Studio.
The apkanalyzer file (with no extension) in my sdk>tools>bin installed on my windows 10 pc is a Unix Shell script.
Windows doesn't recognize this file as a valid command.
This appears to be a bug in the windows install of the Android SDK Tools 26.1.1.
This means that apkanalyzer does not exist in your SDK path.
To download it, just got to SDK Manager and click on Android SDK Tools, then click Ok to continue and download the missing tools.
SDK manager
As others have mentioned, make sure you have installed the Android SDK Tools via the SDK Manager. They should show up in <your_sdk_root>/tools/bin. A long time ago I added <your_sdk_root>/tools to my $PATH in my ~/.bash_profile, but never added <your_sdk_root>/tools/bin; apparently I missed the note that as of SDK Tools, Revision 25.3.0 tools were deprecated or otherwise moved to there among other places.
Seee also
https://developer.android.com/studio/command-line/ for details on the regular Tools, Build, Platform, and Emulator tools.
In Android Studio > Tools > sdkmanager > install Android SDK Command line tools
This worked for me!
I've submitted a bug report to Google: https://issuetracker.google.com/issues/124064881
Apparently it's broken on Windows.
be sure that Android Studio "Commandline Tools" installed on your system.
Then, add the following information into your system path;
C:\Users\user\AppData\Local\Android\Sdk\tools
C:\Users\user\AppData\Local\Android\Sdk\tools\bin
C:\Users\user\AppData\Local\Android\Sdk\cmdline-tools\latest
C:\Users\user\AppData\Local\Android\Sdk\cmdline-tools\latest\bin
It worked for me..
M. Yaşar Özden

How to install SDK manager on linux ubuntu 16.04?

I was trying to install Android SDK with the help of the SDK command line tools downloaded from the link https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip
on my Linux Ubuntu 16.04 PC.
i run the command following command for installation
./android update sdk
but the installation has stopped and gave the following message on terminal
------------------------------------------------------------------------------------------------------------------------------------
The "android" command is deprecated.
For manual SDK, AVD, and project management, please use Android Studio.
For command-line tools, use tools/bin/sdkmanager and tools/bin/avdmanager
"android" SDK commands can be translated to sdkmanager commands on a best-effort basis.
Continue? (This prompt can be suppressed with the--use-sdk-wrapper command-line argument or by setting the USE_SDK_WRAPPER environment variable) [y/N]: y
Running /home/user/Android/Sdk/bin/sdkmanager --update
Warning: java.net.SocketException: Connection reset
Warning: Failed to download any source lists!
Done
-----------------------------------------------------------------------------------------------------------------------------------
how to solve this error.or suggest me a way to install android sdk on my linux pc without installing android studio.
A bit late, but in the same situation. It looks like this isn't an error, but the way the tools evolved: they are pushing users to use Android Studio if they want the GUI for the sdk manager, it's usable only from the IDE.
You still have the command line available at bin/sdkmanager in this folder from the download, and instructions can be found here, but they are not great, either, so I'll share what I did:
downloaded the latest compressed file from this page (link way down there)
unzipped somewhere (I chose /opt/Android/android-sdk)
created a symlink to add sdkmanager to my path (ln -s /opt/Android/android-tools/bin/sdkmanager ~/.local/bin/sdkmanager)
installed platform tools and build tools for kitkat and up using sdkmanager "platform-tools" "platforms;android-19" "build-tools;19.1.0" (sudo may be needed)
You can check the versions available using sdkmanager --list, and figure what you need to support and download tools for other versions. The download will not show any kind of progress, it'll only tell you it's done after a while.
I suppose it's not a big deal to keep Android Studio installed solely to have access to the sdk manager GUI, but I'll make do with the command line tools. That's very shady of Google, specially to people not really into their hacked up Intellij version.

Problem with Android SDK on Fedora 14 with Eclipse

I just installed the Android SDK on my machine. I am running Fedora 14 (64 bit) and the Android kit is r07 for Linux. I am running Eclipse Indigo. I get an error when I try to link to the sdk inside Eclipse, saying :
Failed to get the adb version: Cannot run program "/home/naman/workspace/android-sdk-linux/tools/adb": java.io.IOException: error=2, No such file or directory
The problem is also documented here
Problem with Android SDK on Linux with Eclipse Helios
But with no solutions.
A solution is there for Ubuntu machines--
Android SDK on a 64-bit linux machine
Can someone suggest a similar solution maybe for fedora??
I had the same problem until I figured out that they have moved adb (and then I had updated it automatically).
See if you can see it here (or make Eclipse try here): /home/naman/workspace/android-sdk-linux/platform-tools/adb
Also see if you have the file: /home/naman/workspace/android-sdk-linux/tools/adb_has_moved.txt
This worked like magic
http://beginlinux.com/blog/2009/09/installing-32-bit-support-into-64-bit-fedora-11/
though installing all i686 libs as in
http://beginlinux.com/blog/2009/09/installing-32-bit-support-into-64-bit-fedora-11/comment-page-1/#comment-1514 didn't work.
For Fedora-16 64-bit I solved this as follows:
yum install glibc.i686 glibc-devel.i686
yum install ncurses-libs.i686
yum install libstdc++.i686
After installing, restart Eclipse and Android packages should load.

NDK - Error trying to generate a build.xml file for Hello-jni

I just installed Android NDK, r5b, and while trying to follow the steps from Exploring the hello-jni Sample, on the command line I receive the error:
MacBook-2:~ mvermant$ cd ndk/samples/hello-jni
MacBook-2:hello-jni mvermant$ android update project -p . -s
-bash: android: command not found
I'm using Eclipse Helios release 2 with Android SDK r10 and ADT 10.0.0 on MAC 10.6.6. I have also checked to have GNU Make 3.81, and installed GNU Awk(though I am not sure it's in the right place).
I've searched a lot, and seems there might be a class path missing somewhere, but I can't figure out where exactly and what to do to fix it.
You should make sure the tools directory of your android-sdk is on your (shell) path.
Something like:
export PATH="/path/to/sdk/tools:$PATH"
before you execute your command.
In general you will also need two other directories to be on your path:
/path/to/sdk/platform-tools - for adb and other android sdk tools
/path/to/ndk - for ndk-build and ndk-gdb, which are ndk tools
You can also do some setup so that you don't have to run these commands every time you open Terminal.

Categories

Resources