epiccurious / gui-qml

Bitcoin GUI (experimental QML-based fork)
MIT License
2 stars 0 forks source link

Build apk from source on bare metal #2

Open epiccurious opened 2 weeks ago

epiccurious commented 2 weeks ago

Motivation

This issue is a placeholder for my notes while building the arm64/aarch64 APK.

Learning the codebase.

Possible solution

No response

Useful Skills

No response

Guidance for new contributors

Want to work on this issue?

For guidance on contributing, please read CONTRIBUTING.md before opening your pull request.

epiccurious commented 2 weeks ago

Seeing an error when building the apk. Something to do with the environmental variable for the SDK:

cd qt/android && gradle wrapper --gradle-version=6.6.1
openjdk version "21.0.3" 2024-04-16
OpenJDK Runtime Environment (build 21.0.3+9-Ubuntu-1ubuntu1)
OpenJDK 64-Bit Server VM (build 21.0.3+9-Ubuntu-1ubuntu1, mixed mode, sharing)

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 0s

Here's the commands I used:

sudo apt install curl
curl -fsSL https://github.com/bitcoin-tools/nodebuilder/raw/master/resources/dependencies/build_dependencies_aptget.txt | xargs sudo apt install -y
git clone --depth 1 https://github.com/bitcoin-core/gui-qml
cd gui-qml/
sudo apt-get install --no-install-recommends -y autoconf automake ca-certificates curl g++ gradle lbzip2 libtool make openjdk-8-jdk patch pkg-config python3 unzip xz-utils
curl --location --fail https://dl.google.com/android/repository/commandlinetools-linux-8512546_latest.zip -o android-tools.zip
mkdir /tmp/Android
unzip -o android-tools.zip -d /tmp/Android/
yes | /tmp/Android/cmdline-tools/bin/sdkmanager --sdk_root=/tmp/Android --install "build-tools;28.0.3" "platform-tools" "platforms;android-31" "platforms;android-28" "ndk;23.2.8568313"
cd depends/
make -j6 HOST=aarch64-linux-android ANDROID_SDK=/tmp/Android ANDROID_NDK=/tmp/Android/ndk/23.2.8568313 ANDROID_API_LEVEL=28 ANDROID_TOOLCHAIN_BIN=/tmp/Android/ndk/23.2.8568313/toolchains/llvm/prebuilt/linux-x86_64/bin
cd ..
./autogen.sh 
./configure CONFIG_SITE=/home/user1/gui-qml/depends/aarch64-linux-android/share/config.site --disable-dependency-tracking --disable-tests --disable-bench --disable-fuzz-binary
export
make -j6 -C src/qt bitcoin-qt
make -j6 -C src/qt apk
export ANDROID_HOME=/tmp/Android
make -j6 -C src/qt apk
export ANDROID_API_LEVEL=28
export ANDROID_BUILD_TOOLS_VERSION=28.0.3
export ANDROID_NDK_VERSION=23.2.8568313
make -j6 -C src/qt apk
export ANDROID_SDK=$ANDROID_HOME
echo $ANDROID_SDK 
make -j6 -C src/qt apk
make --info -j6 -C src/qt apk
make clean
make -j6 -C src/qt apk
make -j6 -C src/qt bitcoin-qt