updated Android build instructions
This commit is contained in:
parent
9d6cf369d6
commit
c140aa32b6
3 changed files with 79 additions and 19 deletions
52
BUILD.md
52
BUILD.md
|
@ -1,6 +1,8 @@
|
||||||
## Linux Build Instructions
|
## Linux Build Instructions
|
||||||
|
|
||||||
This app has currently only been built on Ubuntu 14.04, 16.04, 17.10, and 18.04, but these instructions, or an analog of them, should work on most Linux or macOS environments.
|
This app has currently only been built on Ubuntu 14.04, 16.04, 17.10, and 18.04, but these instructions, or an analog of them, should work on most Linux or macOS environments. An abridged version of these instructions is available at [QUICKSTART.md](QUICKSTART.md).
|
||||||
|
|
||||||
|
For instructions on how to build using a Docker image, please see [DOCKER.md](DOCKER.md).
|
||||||
|
|
||||||
### Install Prerequisites
|
### Install Prerequisites
|
||||||
|
|
||||||
|
@ -14,25 +16,31 @@ This app has currently only been built on Ubuntu 14.04, 16.04, 17.10, and 18.04,
|
||||||
* yarn
|
* yarn
|
||||||
|
|
||||||
#### apt Packages
|
#### apt Packages
|
||||||
Based on the quick-start instructions at http://buildozer.readthedocs.io/en/latest/installation.html
|
Install all apt packages required by running the following commands:
|
||||||
```
|
```
|
||||||
sudo dpkg --add-architecture i386
|
sudo dpkg --add-architecture i386
|
||||||
sudo apt-get update
|
sudo apt-get -y update
|
||||||
sudo apt-get install autoconf autogen build-essential curl libtool libffi-dev python python-pip python-openssl python3.7 python3.7-dev python3-pip ccache git libncurses5:i386 libstdc++6:i386 libgtk2.0-0:i386 libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 python2.7 python2.7-dev openjdk-8-jdk unzip zlib1g-dev zlib1g:i386 m4 libc6-dev-i386
|
sudo apt-get install -y curl ca-certificates software-properties-common gpg-agent wget
|
||||||
|
sudo add-apt-repository ppa:deadsnakes/ppa -y && \
|
||||||
|
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
|
||||||
|
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
|
||||||
|
sudo apt-get -y update && apt-get -y install autoconf autogen automake libtool libffi-dev \
|
||||||
|
build-essential python3.7 python3.7-dev python3.7-venv python3-pip ccache git libncurses5:i386 libstdc++6:i386 \
|
||||||
|
libgtk2.0-0:i386 libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 python2.7 python2.7-dev \
|
||||||
|
python-pip openjdk-8-jdk unzip zlib1g-dev zlib1g:i386 m4 libc6-dev-i386 yarn gawk nodejs npm
|
||||||
```
|
```
|
||||||
Alternatively, the JDK available from http://www.oracle.com/technetwork/java/javase/downloads/index.html can be installed instead of the `openjdk-8-jdk` package.
|
Alternatively, the JDK available from http://www.oracle.com/technetwork/java/javase/downloads/index.html can be installed instead of the `openjdk-8-jdk` package.
|
||||||
|
|
||||||
#### Install Cython and Setuptools
|
#### Install Cython and Setuptools
|
||||||
```
|
```
|
||||||
sudo pip install --upgrade cython==0.28.1 setuptools
|
sudo -H pip install --upgrade cython==0.28.1 setuptools
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Install buildozer
|
#### Install buildozer
|
||||||
A forked version of `buildozer` needs to be installed in order to copy the React Native UI source files into the corresponding directories.
|
A forked version of `buildozer` needs to be installed in order to copy the React Native UI source files into the corresponding directories.
|
||||||
```
|
```
|
||||||
git clone https://github.com/lbryio/buildozer.git
|
git clone https://github.com/lbryio/buildozer.git
|
||||||
cd buildozer
|
cd buildozer && python2.7 setup.py install && cd ..
|
||||||
sudo python2.7 setup.py install
|
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Create buildozer.spec
|
#### Create buildozer.spec
|
||||||
|
@ -59,11 +67,18 @@ Assuming `lbry-android` as the current working folder:
|
||||||
| p4a.source_dir | Path to the python-for-android repository folder. Currently set to the included `p4a` folder |
|
| p4a.source_dir | Path to the python-for-android repository folder. Currently set to the included `p4a` folder |
|
||||||
| p4a.local_recipes | Path to a folder containing python_for_android recipes to be used in the build. The included `recipes` folder includes recipes for a successful build |
|
| p4a.local_recipes | Path to a folder containing python_for_android recipes to be used in the build. The included `recipes` folder includes recipes for a successful build |
|
||||||
|
|
||||||
|
#### Create google-services.json
|
||||||
|
The `google-services.json` file is required for the build to be successful due to the Firebase implementation. Simply copy the provided sample file into the same destination folder.
|
||||||
|
```
|
||||||
|
cd lbry-android
|
||||||
|
cp p4a/pythonforandroid/bootstraps/lbry/templates/google-services.sample.json p4a/pythonforandroid/bootstraps/lbry/templates/google-services.json
|
||||||
|
```
|
||||||
|
|
||||||
#### Setup Android SDK for buildozer
|
#### Setup Android SDK for buildozer
|
||||||
Download the Android SDK, platform and build tools archives.
|
Download the Android SDK, platform and build tools archives.
|
||||||
* Android API 23 SDK - https://dl.google.com/android/android-sdk_r23-linux.tgz
|
* Android API 23 SDK - https://dl.google.com/android/android-sdk_r23-linux.tgz
|
||||||
* Android API 27 platform - https://dl.google.com/android/repository/platform-27_r01.zip
|
* Android API 28 platform - https://dl.google.com/android/repository/platform-28_r06.zip
|
||||||
* Android build tools 26.0.1 - https://dl.google.com/android/repository/build-tools_r26.0.1-linux.
|
* Android build tools 26.0.2 - https://dl.google.com/android/repository/build-tools_r26.0.2-linux.zip
|
||||||
|
|
||||||
Create the `.buildozer` path (and the `android` sub-path) in your home folder if it doesn't already exist.
|
Create the `.buildozer` path (and the `android` sub-path) in your home folder if it doesn't already exist.
|
||||||
`mkdir ~/.buildozer`
|
`mkdir ~/.buildozer`
|
||||||
|
@ -75,17 +90,17 @@ tar -xf android-sdk_r23-linux.tgz ~/.buildozer/android/platform/
|
||||||
mv ~/.buildozer/android/platform/android-sdk-linux ~/.buildozer/android/platform/android-sdk-23
|
mv ~/.buildozer/android/platform/android-sdk-linux ~/.buildozer/android/platform/android-sdk-23
|
||||||
```
|
```
|
||||||
|
|
||||||
Extract the API 27 platform archive into the `android-sdk-23` folder and rename the extracted folder.
|
Extract the API 28 platform archive into the `android-sdk-23` folder and rename the extracted folder.
|
||||||
```
|
```
|
||||||
unzip platform-27_r01.zip -d ~/.buildozer/android/platform/android-sdk-23/platforms
|
unzip ~/.buildozer/android/platform/platform-28_r06.zip -d ~/.buildozer/android/platform/android-sdk-23/platforms
|
||||||
mv ~/.buildozer/android/platform/android-sdk-23/platforms/android-8.1.0 ~/.buildozer/android/platform/android-sdk-23/platforms/android-27
|
mv ~/.buildozer/android/platform/android-sdk-23/platforms/android-9 ~/.buildozer/android/platform/android-sdk-23/platforms/android-2
|
||||||
```
|
```
|
||||||
|
|
||||||
Extract the build tools 26.0.1 build tools into the `android-sdk-23` folder and rename the extracted folder.
|
Extract the build tools 26.0.2 build tools into the `android-sdk-23` folder and rename the extracted folder.
|
||||||
```
|
```
|
||||||
mkdir -p ~/.buildozer/android/platform/android-sdk-23/build-tools
|
mkdir -p ~/.buildozer/android/platform/android-sdk-23/build-tools
|
||||||
unzip ~/.buildozer/android/platform/build-tools_r26.0.1-linux.zip -d ~/.buildozer/android/platform/android-sdk-23/build-tools
|
unzip ~/.buildozer/android/platform/build-tools_r26.0.2-linux.zip -d ~/.buildozer/android/platform/android-sdk-23/build-tools
|
||||||
mv ~/.buildozer/android/platform/android-sdk-23/build-tools/android-8.0.0 ~/.buildozer/android/platform/android-sdk-23/build-tools/26.0.1
|
mv ~/.buildozer/android/platform/android-sdk-23/build-tools/android-8.1.0 ~/.buildozer/android/platform/android-sdk-23/build-tools/26.0.2
|
||||||
```
|
```
|
||||||
|
|
||||||
Finally, create the Android SDK license file. This prevents being prompted to accept the SDK license during the build process.
|
Finally, create the Android SDK license file. This prevents being prompted to accept the SDK license during the build process.
|
||||||
|
@ -97,14 +112,17 @@ echo $'\nd56f5187479451eabf01fb78af6dfcb131a6481e' > ~/.buildozer/android/platfo
|
||||||
#### Setup Crystax Android NDK for buildozer
|
#### Setup Crystax Android NDK for buildozer
|
||||||
* Download the Crystax Android NDK from https://us.crystax.net/download/crystax-ndk-10.3.2-linux-x86_64.tar.xz and extract. Remember to update `android.ndk_path` in your `buildozer.spec` to the path of the extracted Crystax NDK archive.
|
* Download the Crystax Android NDK from https://us.crystax.net/download/crystax-ndk-10.3.2-linux-x86_64.tar.xz and extract. Remember to update `android.ndk_path` in your `buildozer.spec` to the path of the extracted Crystax NDK archive.
|
||||||
* Copy `build-target-python.sh` from the `scripts` folder in the cloned `lbry-android` repository to the `crystax-ndk-10.3.2/build/tools/` folder.
|
* Copy `build-target-python.sh` from the `scripts` folder in the cloned `lbry-android` repository to the `crystax-ndk-10.3.2/build/tools/` folder.
|
||||||
|
* Copy `mangled-glibc-syscalls.h` from the `scripts` folder in the cloned `lbry-android` repository to the `crystax-ndk-10.3.2/platforms/android-21/arch-arm/usr/include/crystax/bionic/libc/include/sys/` folder.
|
||||||
* Delete the `android-9` folder in `crystax-ndk-10.3.2/platforms`, and create a symbolic link named `android-9` to the `android-21` folder.
|
* Delete the `android-9` folder in `crystax-ndk-10.3.2/platforms`, and create a symbolic link named `android-9` to the `android-21` folder.
|
||||||
|
|
||||||
#### Build and Deploy
|
#### Build and Deploy
|
||||||
Run `npm i` in the `lbry-android/app` folder to install the necessary modules required by the React Native user interface.
|
Run `npm install -g react-native-cli` to install React Native CLI tools.
|
||||||
|
|
||||||
|
Run `npm i` in the `lbry-android/app` folder to install the necessary modules required by the React Native user interface, and then run `./bundle.sh`.
|
||||||
|
|
||||||
Run `./build.sh` in `lbry-android` to build the APK. The output can be found in the `bin` subdirectory.
|
Run `./build.sh` in `lbry-android` to build the APK. The output can be found in the `bin` subdirectory.
|
||||||
|
|
||||||
To build and deploy, you can run `./deploy.sh`. This requires a connected device or running Android emulator.
|
To build and deploy, you can run `./deploy.sh`. This requires a connected device or a running Android emulator.
|
||||||
|
|
||||||
#### Development
|
#### Development
|
||||||
If you already installed `Android SDK` and `adb`
|
If you already installed `Android SDK` and `adb`
|
||||||
|
|
|
@ -72,18 +72,20 @@ wget 'https://www.crystax.net/download/crystax-ndk-10.3.2-linux-x86_64.tar.xz' -
|
||||||
```
|
```
|
||||||
|
|
||||||
### Step 7 of 10
|
### Step 7 of 10
|
||||||
Clone the lbryio/lbry-android git repository and create your buildozer.spec file. The provide buildozer.spec.sample contains defaults provided you followed steps 1 through 5 exactly as described. You can also customise the spec file if you want to.
|
Clone the lbryio/lbry-android git repository and create your `buildozer.spec` and `google-services.json` files. The provided `buildozer.spec.sample` contains defaults provided you followed steps 1 through 5 exactly as described. You can also customise the spec file if you want to. The `google-services.sample.json` can be used to ensure the build completes successfully.
|
||||||
```
|
```
|
||||||
git clone https://github.com/lbryio/lbry-android
|
git clone https://github.com/lbryio/lbry-android
|
||||||
cd lbry-android
|
cd lbry-android
|
||||||
cp buildozer.spec.sample buildozer.spec
|
cp buildozer.spec.sample buildozer.spec
|
||||||
|
cp p4a/pythonforandroid/bootstraps/lbry/templates/google-services.sample.json p4a/pythonforandroid/bootstraps/lbry/templates/google-services.json
|
||||||
```
|
```
|
||||||
|
|
||||||
### Step 8 of 10
|
### Step 8 of 10
|
||||||
Install the npm packages required for the app's React Native code.
|
Install the npm packages required for the app's React Native code, and create the React Native app bundle.
|
||||||
```
|
```
|
||||||
cd app
|
cd app
|
||||||
npm install
|
npm install
|
||||||
|
./bundle.sh
|
||||||
cd ..
|
cd ..
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
{
|
||||||
|
"project_info": {
|
||||||
|
"project_number": "861521963586",
|
||||||
|
"firebase_url": "https://lbry-mobile-builds-debug.firebaseio.com",
|
||||||
|
"project_id": "lbry-mobile-builds-debug",
|
||||||
|
"storage_bucket": "lbry-mobile-builds-debug.appspot.com"
|
||||||
|
},
|
||||||
|
"client": [
|
||||||
|
{
|
||||||
|
"client_info": {
|
||||||
|
"mobilesdk_app_id": "1:861521963586:android:592958d248940ab2",
|
||||||
|
"android_client_info": {
|
||||||
|
"package_name": "io.lbry.browser"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"oauth_client": [
|
||||||
|
{
|
||||||
|
"client_id": "861521963586-60cmvg5nmnrqkrc11a7bpmpv5ra2d50q.apps.googleusercontent.com",
|
||||||
|
"client_type": 3
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"api_key": [
|
||||||
|
{
|
||||||
|
"current_key": "AIzaSyC7A3BYcIdZP9-Q-VNHoexYJWgZA7WzsPI"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"services": {
|
||||||
|
"appinvite_service": {
|
||||||
|
"other_platform_oauth_client": [
|
||||||
|
{
|
||||||
|
"client_id": "861521963586-60cmvg5nmnrqkrc11a7bpmpv5ra2d50q.apps.googleusercontent.com",
|
||||||
|
"client_type": 3
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"configuration_version": "1"
|
||||||
|
}
|
Loading…
Reference in a new issue