android NDK - make standalone toolchain fails - android

I tried to make a standalone Android NDK toolchain on Linux 64 bit:
~/build/android-ndk-r9/build/tools $ ./make-standalone-toolchain.sh --platform=android-14 --ndk-dir=/home/user/build/android-ndk-r9 --system=linux-x86_64 --install-dir=/home/user/build/android-14-toolchain
Auto-config: --toolchain=arm-linux-androideabi-4.6
Copying prebuilt binaries...
No files are actually copied. Something goes wrong. The NDK ist the latest release r9.
How can I run the script so that the files get copied to the installation directory?

A suggestion: Use the --verbose option if you haven't already done so; it will tell you in which stage the error occurs.
Here are the options I ran to make a standalone toolchain targeting android-14 and arm-linux-androideabi-4.7
sudo sh make-standalone-toolchain.sh --verbose --toolchain=x86-4.7\
--install-dir=/project/arm-cc --ndk-dir=/project/android/ndk/android-ndk-r9\
--platform=android-14

Related

How can I compile Qt for Android with bluetooth?

I am pretty new to Qt (and linux for that matter), but need to build an Android app based on Qt with some basic bluetooth functionality. I have been able to build Qt for Android from source and develop a simple app, but QtBluetooth cannot be found.
Starting point:
Ubuntu 18.10 x64
Android NDK r18b
Android SDK (android-27)
OpenJDK v1.8.0_212
Qt 5.12.3
This is my configure command:
./configure -xplatform android-clang -android-ndk [path to NDK] -android-sdk [path to SDK] -android-ndk-host linux-x86_64 -android-toolchain-version 4.9 -no-warnings-are-errors -android-ndk-platform andoird-27 -opensource -confirm-license -v
The configure output shows that none of the Qt Bluetooth components are enabled, and that this is because
"None of [libbluetooth.so libbluetooth.a] could be found in [] and global paths."
"pkg-config use disabled globally"
This is really frustrating because I've installed those libraries: both of those files are in the /usr/lib/x86_65-linux-gnu/ directory! Also pkg-config is installed...
I have tried adding this path (/usr/lib/x86_64-linux-gnu/) to the configure command and copying these libraries into directories that I would have thought are already included, but these workarounds have been fruitless. I am using git to clean the submdodules and main directory between each attempt.
What am I missing?? It feels like this is sooo close to working.

Android SDK on Alpine - adb No such file or directory

I'm trying to build an Alpine image containing the Android SDK - specifically, the platform-tools package.
My Dockerfile does the following:
Installs Java and sets JAVA_HOME (needed for Android).
Downloads the Android SDK tools from Google.
Unzips the package.
Sets ANDROID_HOME. Also sets PATH so the sdkmanager executable can be used.
Installs platform-tools using sdkmanager.
Adds platform-tools to PATH.
platform-tools contains an executable named adb, but for some reason it cannot be seen. Running adb returns:
bash: /android-sdk/platform-tools/adb: No such file or directory
Here is my Dockerfile:
FROM alpine:latest
# Install bash and java
RUN apk update
RUN apk add bash openjdk8
ENV JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk
ENV PATH="$PATH:$JAVA_HOME/bin"
# Download Android SDK and set PATH
RUN mkdir /android-sdk
RUN wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip && unzip *.zip -d /android-sdk && rm *.zip
ENV ANDROID_HOME="/android-sdk"
ENV PATH="$PATH:$ANDROID_HOME/tools/bin"
# Install platform-tools
RUN yes | sdkmanager "platform-tools"
ENV PATH="$PATH:$ANDROID_HOME/platform-tools"
RUN adb version # throws error: adb not found
I've looked at this question but the problem should be fixed with platform-tools v24.0 and higher.
Alpine uses musl libc instead of glibc and friends, so certain software might run into issues depending on the depth of their libc requirements.
adb is compiled with glibc, so it won't be able to run in Alpine, which usually results in the error: No such file or directory.
You can verify that a file is compiled with glibc by running file <path to file> | grep "interpreter /lib64/ld-linux-x86-64.so.2".
This may help, although the Gradle daemon randomly crashes for me on Alpine Linux when using the compatibility layer.
gcompat is the go-to compatibility layer for Alpine users.
apk add gcompat
After that you run your binaries as normal.
Source: https://wiki.alpinelinux.org/wiki/Running_glibc_programs
You can install android-tools like so:
RUN apk add \
android-tools \
--repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing
The key is to set the --repository as shown, as it's only in the edge testing repo.
I don't think it includes the whole SDK, so may need to download and unzip as well for other tools. I don't know if this will handle everything you want, but adb prints a help document at least.

How do you define the NDK installation that ndk-build uses?

How do you define the NDK installation that ndk-build uses? I used the r10e build for a good while, then updated my NDK and modified my $PATH to point to the new location, but when I build using the ndk-build command in Terminal it still uses the older android-ndk-r10e version.
I know this because I use the NDK_LOG=1 option when invoking ndk-build and it produces the following verbose information as it builds my project. Notice the references to "/NDKDev/android-ndk-r10e". That's my old installation.
~/Documents/MyNDKProject-- $ ndk-build NDK_LOG=1
HOST_OS=darwin
HOST_ARCH=x86_64
HOST_TAG=darwin-x86_64
GNUMAKE=/Users/user1/Documents/NDKDev/android-ndk-r10e/prebuilt/darwin-x86_64/bin/make (NDK prebuilt)
Android NDK: NDK installation path auto-detected: '/Users/user1/Documents/NDKDev/android-ndk-r10e'
Android NDK: GNU Make version 3.81 detected
Android NDK: Host OS was auto-detected: darwin
Android NDK: Host operating system detected: darwin
Android NDK: Host CPU was auto-detected: x86
Android NDK: HOST_TAG set to darwin-x86
Android NDK: Host tools prebuilt directory: /Users/user1/Documents/NDKDev/android-ndk-r10e/prebuilt/darwin-x86_64/bin
Android NDK: Host 'echo' tool: echo
. . .
Also note that when I enter echo $PATH at the Terminal prompt it gives:
/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin/:/sbin:/usr/local/bin:/Applications/android-sdk-macosx/ndk-bundle:/Applications/android-sdk-macosx
and where you see /Applications/android-sdk-macosx/ndk-bundle is exactly where it used to refer to the android-ndk-r10e path, so I'm certain I've updated my PATH successfully. So anyhow, IF the PATH environment variable is not what ndk-build uses to determine the NDK installation to use, what does it use, and how can I modify it so that it uses my new installation which is at:
/Applications/android-sdk-macosx/ndk-bundle
Fixed. The problem was that when the .bash_profile file is successfully sourced in a given Terminal session it does not have any effect on other instances of Terminal that are open. I had two instances of Terminal open and because I hadn't closed the one with which I was calling ndk-build the changes to .bash_profile weren't being applied.

Build PJSIP for Android on Windows?

I am beginner with Android and I have to make a voip app and after searching I found that the better opensource library for that is PJSIP.
I download the below things to build the PJSIP library:
PJSIP from here
Android NDK
SWIG
...But I don't know how to start. I checked this link for the official PJSIP website but I didn't make any progress.
Which Directory do I have to put the Android NDK into?
How to use SWIG to build the PJSIP?!
which Directory i have to put the Android NDK ?
Put it where you want, later you will setup the path to it
$ export ANDROID_NDK_ROOT=/path_to_android_ndk_dir
how to use SWIG to build the PJSIP ?!
You don't need SWIG to compile the PJSIP sources, it's needed only if you want to build and and run the sample application PJSUA.
Updated
The steps to build sources are
Download sources from PJSIP site. Pay attention if you will compile on Windows machine download .zip file, if on Unix machine (including OS X) then download .bz2 file.
Go to pjlib/include/pj/ from the downloaded sources. Create (or overwrite) a file called config_site.h. Copy the following code snippet
#define PJ_CONFIG_ANDROID 1
#include <pj/config_site_sample.h>
Open Cmd or Terminal
Go to pjsip root folder (the downloaded sources)
$ cd /path/to/your/pjsip/dir
Export bash var ANDROID_NDK_ROOT as a environment variable. Variable value should be the path of android ndk directory.
$ export ANDROID_NDK_ROOT=/path_to_android_ndk_dir (Unix)
SET ANDROID_NDK_ROOT=/path_to_android_ndk_dir (Windows)
Perform build for target armeabi
$ ./configure-android
If you need to perform build for
target arm64-v8a do $ TARGET_ABI=armeabi-v8a ./configure-android --use-ndk-cflags
target armeabi-v7a do $ TARGET_ABI=armeabi-v7a ./configure-android --use-ndk-cflags
target x86 do $ TARGET_ABI=x86 ./configure-android --use-ndk-cflags
Compile sources
$ make dep && make clean && make

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