diff options
author | Igor Cota <igor@openbook.hr> | 2020-08-28 11:09:58 +0200 |
---|---|---|
committer | Igor Cota <igor@openbook.hr> | 2021-03-21 22:33:27 +0100 |
commit | ebfb10cb75adb704418d08197681c1e742e63bd5 (patch) | |
tree | 8260d1138285ca49119ebad91f079a77cd487d99 /src/qt/android | |
parent | d2a78ee9288e4d3bace9125bcfae6b7747f85982 (diff) |
Qt: add Android packaging support
Introduce an android directory under qt and allow one to package bitcoin-qt for Android by running make apk.
Add bitcoin-qt Android build instructions.
Diffstat (limited to 'src/qt/android')
-rw-r--r-- | src/qt/android/AndroidManifest.xml | 38 | ||||
-rw-r--r-- | src/qt/android/build.gradle | 52 | ||||
-rw-r--r-- | src/qt/android/gradle.properties | 4 | ||||
-rw-r--r-- | src/qt/android/res/drawable-hdpi/bitcoin.png | bin | 0 -> 4536 bytes | |||
-rw-r--r-- | src/qt/android/res/drawable-ldpi/bitcoin.png | bin | 0 -> 1697 bytes | |||
-rw-r--r-- | src/qt/android/res/drawable-mdpi/bitcoin.png | bin | 0 -> 2558 bytes | |||
-rw-r--r-- | src/qt/android/res/drawable-xhdpi/bitcoin.png | bin | 0 -> 6832 bytes | |||
-rw-r--r-- | src/qt/android/res/drawable-xxhdpi/bitcoin.png | bin | 0 -> 11479 bytes | |||
-rw-r--r-- | src/qt/android/res/drawable-xxxhdpi/bitcoin.png | bin | 0 -> 17034 bytes | |||
-rw-r--r-- | src/qt/android/src/org/bitcoincore/qt/BitcoinQtActivity.java | 29 |
10 files changed, 123 insertions, 0 deletions
diff --git a/src/qt/android/AndroidManifest.xml b/src/qt/android/AndroidManifest.xml new file mode 100644 index 0000000000..abb88fe89d --- /dev/null +++ b/src/qt/android/AndroidManifest.xml @@ -0,0 +1,38 @@ +<?xml version='1.0' encoding='utf-8'?> +<manifest package="org.bitcoincore.qt" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0" android:versionCode="1" android:installLocation="auto"> + <uses-sdk android:targetSdkVersion="24"/> + + <uses-permission android:name="android.permission.INTERNET" /> + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> + <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> + + <uses-feature android:glEsVersion="0x00020000" android:required="true" /> + + <supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/> + + <application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="Bitcoin Core"> + <activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density" + android:name="org.bitcoincore.qt.BitcoinQtActivity" + android:label="Bitcoin Core" + android:icon="@drawable/bitcoin" + android:screenOrientation="unspecified" + android:launchMode="singleTop"> + <intent-filter> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> + </intent-filter> + + <meta-data android:name="android.app.arguments" android:value="-testnet"/> + <meta-data android:name="android.app.lib_name" android:value="bitcoin-qt"/> + <meta-data android:name="android.app.repository" android:value="default"/> + <meta-data android:name="android.app.bundle_local_qt_libs" android:value="1"/> + <meta-data android:name="android.app.use_local_qt_libs" android:value="1"/> + <meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/> + <meta-data android:name="android.app.system_libs_prefix" android:value="/system/lib/"/> + <meta-data android:name="android.app.background_running" android:value="true"/> + <meta-data android:name="android.app.auto_screen_scale_factor" android:value="true"/> + <meta-data android:name="android.app.extract_android_style" android:value="default"/> + </activity> + + </application> +</manifest> diff --git a/src/qt/android/build.gradle b/src/qt/android/build.gradle new file mode 100644 index 0000000000..4c36e79db8 --- /dev/null +++ b/src/qt/android/build.gradle @@ -0,0 +1,52 @@ +buildscript { + repositories { + google() + jcenter() + } + + dependencies { + classpath 'com.android.tools.build:gradle:3.1.0' + } +} + +repositories { + google() + jcenter() +} + +apply plugin: 'com.android.application' + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) +} + +android { + compileSdkVersion androidCompileSdkVersion.toInteger() + + buildToolsVersion androidBuildToolsVersion + + sourceSets { + main { + manifest.srcFile 'AndroidManifest.xml' + java.srcDirs = [qt5AndroidDir + '/src', 'src', 'java'] + aidl.srcDirs = [qt5AndroidDir + '/src', 'src', 'aidl'] + res.srcDirs = [qt5AndroidDir + '/res', 'res'] + resources.srcDirs = ['src'] + renderscript.srcDirs = ['src'] + assets.srcDirs = ['assets'] + jniLibs.srcDirs = ['libs'] + } + } + + lintOptions { + abortOnError false + } + + dexOptions { + javaMaxHeapSize '4g' + } + + defaultConfig { + minSdkVersion 24 + } +} diff --git a/src/qt/android/gradle.properties b/src/qt/android/gradle.properties new file mode 100644 index 0000000000..838870f62d --- /dev/null +++ b/src/qt/android/gradle.properties @@ -0,0 +1,4 @@ +androidBuildToolsVersion=28.0.3 +androidCompileSdkVersion=28 +qt5AndroidDir=new File(".").absolutePath +org.gradle.jvmargs=-Xmx4608M diff --git a/src/qt/android/res/drawable-hdpi/bitcoin.png b/src/qt/android/res/drawable-hdpi/bitcoin.png Binary files differnew file mode 100644 index 0000000000..31a556a35f --- /dev/null +++ b/src/qt/android/res/drawable-hdpi/bitcoin.png diff --git a/src/qt/android/res/drawable-ldpi/bitcoin.png b/src/qt/android/res/drawable-ldpi/bitcoin.png Binary files differnew file mode 100644 index 0000000000..76d80d4196 --- /dev/null +++ b/src/qt/android/res/drawable-ldpi/bitcoin.png diff --git a/src/qt/android/res/drawable-mdpi/bitcoin.png b/src/qt/android/res/drawable-mdpi/bitcoin.png Binary files differnew file mode 100644 index 0000000000..c2aeab851a --- /dev/null +++ b/src/qt/android/res/drawable-mdpi/bitcoin.png diff --git a/src/qt/android/res/drawable-xhdpi/bitcoin.png b/src/qt/android/res/drawable-xhdpi/bitcoin.png Binary files differnew file mode 100644 index 0000000000..2bd5e3defc --- /dev/null +++ b/src/qt/android/res/drawable-xhdpi/bitcoin.png diff --git a/src/qt/android/res/drawable-xxhdpi/bitcoin.png b/src/qt/android/res/drawable-xxhdpi/bitcoin.png Binary files differnew file mode 100644 index 0000000000..d236cf2132 --- /dev/null +++ b/src/qt/android/res/drawable-xxhdpi/bitcoin.png diff --git a/src/qt/android/res/drawable-xxxhdpi/bitcoin.png b/src/qt/android/res/drawable-xxxhdpi/bitcoin.png Binary files differnew file mode 100644 index 0000000000..bb1dbc3554 --- /dev/null +++ b/src/qt/android/res/drawable-xxxhdpi/bitcoin.png diff --git a/src/qt/android/src/org/bitcoincore/qt/BitcoinQtActivity.java b/src/qt/android/src/org/bitcoincore/qt/BitcoinQtActivity.java new file mode 100644 index 0000000000..cf3b4f6668 --- /dev/null +++ b/src/qt/android/src/org/bitcoincore/qt/BitcoinQtActivity.java @@ -0,0 +1,29 @@ +package org.bitcoincore.qt; + +import android.os.Bundle; +import android.system.ErrnoException; +import android.system.Os; + +import org.qtproject.qt5.android.bindings.QtActivity; + +import java.io.File; + +public class BitcoinQtActivity extends QtActivity +{ + @Override + public void onCreate(Bundle savedInstanceState) + { + final File bitcoinDir = new File(getFilesDir().getAbsolutePath() + "/.bitcoin"); + if (!bitcoinDir.exists()) { + bitcoinDir.mkdir(); + } + + try { + Os.setenv("QT_QPA_PLATFORM", "android", true); + } catch (ErrnoException e) { + e.printStackTrace(); + } + + super.onCreate(savedInstanceState); + } +} |