Compare commits
317 Commits
cwtch-alph
...
master
11466 changed files with 361634 additions and 232081 deletions
@ -0,0 +1,3 @@ |
|||
[submodule "qml/opaque"] |
|||
path = qml/opaque |
|||
url = https://git.openprivacy.ca/openprivacy/opaque |
@ -0,0 +1,89 @@ |
|||
# Notes on Android Debugging |
|||
|
|||
If you are reading this you are probably interested in developing Cwtch for Android! Awesome. |
|||
|
|||
The Cwtch UI app is intended to be a single codebase that runs on multiple platforms. This |
|||
complicates the build process in favour of simplifying the code (so goes the theory). |
|||
|
|||
We make use of https://github.com/therecipe/qt/ for deploying Go/Qt code to Android. Before you venture into the weeds |
|||
of this README please take a look at the [Installation](https://github.com/therecipe/qt/wiki/Installation) |
|||
and [Setup instructions](https://github.com/therecipe/qt/wiki/Deploying-Linux-to-Android) in therecipe/qt. |
|||
|
|||
## Building |
|||
|
|||
Check out and follow the instructions at https://github.com/therecipe/qt/wiki/Deploying-Linux-to-Android as they are sufficient, |
|||
below you will find high-level notes regarding the process. |
|||
|
|||
You need to run `qtsetup --qt_version=<vesion> full android` for the non-docker setup. You will need to do this |
|||
for every major version change of therecipe dependencies. |
|||
|
|||
You will also need the Android 28 SDK (Pie), the NDK, SDK build tools and platform tools, gradle and **JDK 8** |
|||
|
|||
JAVA_JDK=/path/to/jre8 |
|||
ANDROID_NDK_DIR=/path/to/ndk |
|||
|
|||
Once all that setup is done you should be able to run: |
|||
|
|||
ANDROID_MODULES_INCLUDE="Core,Gui,Svg,QuickWidgets,Xml" qtdeploy build android |
|||
|
|||
2-4 minutes later an android apk will pop out in `./deploy/android/build-debug.apk`. |
|||
|
|||
### Build Setup Issues we have seen |
|||
|
|||
* `Could not determine java version from <blah>` - this is thrown by gradle inside the `androiddeployqt` process when the |
|||
Java version is *not* JRE8. Ensure that JAVA_HOME is pointed to the correct java installation. |
|||
* ` readelf <blah> "is not an ordinary file"` - this isn't actually an error that will stop the build, but sometimes |
|||
because of the very long debug log output you will come across it when trying to find the *actual* error (which is |
|||
probably a Java version issue). It can be safely ignored. |
|||
* `could not find QAndroid...` / `CPP build errors` - you will need to run `qtsetup` full android` for the Qt version |
|||
you are using. |
|||
* Example: androidextras_android.cpp:9:10: fatal error: 'QAndroidActivityResultReceiver' file not found |
|||
|
|||
## Testing on a Real Device |
|||
|
|||
Consult the Android documentation on setting up your device for development. |
|||
|
|||
You will need an android sdk, setup your device for USB Debugging and then with `adb` you can do: |
|||
|
|||
adb install -r ./deploy/android/build-debug.apk |
|||
|
|||
To get the logs you can run |
|||
|
|||
adb logcat |
|||
|
|||
Android Studio provides a nice logcat interface for quickly filtering log files that can be very useful when trying to |
|||
debug complex behavior, but command line tools like `grep` and the built-in [logcat filtering](https://developer.android.com/studio/command-line/logcat) |
|||
should also suffice. |
|||
|
|||
*Important*: Cwtch UI technically runs *3* different applications: Cwtch Frontend (application client), |
|||
Cwtch Backend (application server) and Tor. When filtering logcat you should be aware that some of your messages might |
|||
be getting logged by a different process. |
|||
|
|||
(*Ctrl-F Helper: "Why are log messages missing"*) |
|||
|
|||
# Bundled Libraries |
|||
|
|||
There seems to be a bug in Qt (https://bugreports.qt.io/browse/QTBUG-84371) that prevents the use of |
|||
`AndroidExtras` in `ANDROID_MODULES_INCLUDE` so we bundle it in `android/libQt5AndroidExtras.so` along with |
|||
`libtor` for Tor support. |
|||
|
|||
## Non-SDK Interfaces |
|||
|
|||
e.g. java.lang.NoSuchFieldException: No field mPivotX in class Landroid/graphics/drawable/RotateDrawable$RotateState; |
|||
|
|||
* https://bugreports.qt.io/browse/QTBUG-71590 |
|||
|
|||
## Plugins |
|||
|
|||
Theoretically speaking it should be possible to use `ANDROID_EXTRA_PLUGINS` to include support for e.g. |
|||
SVG images on Android. However, we have been unable to make it work. If you would like to try, the following |
|||
issues might be helpful: |
|||
|
|||
* https://bugreports.qt.io/browse/QTBUG-60022 |
|||
|
|||
## Notifications |
|||
|
|||
- Android 8 (API Level 26) forces you to call setChannelId() |
|||
- Android 9 "Do Not Disturb" mode also hides all notifications |
|||
- Setting up notification channels only seems possible *once* per install. any changes you need to make |
|||
require that the app is reinstalled, or the actual channel deleted and changed. |
@ -1,7 +1,33 @@ |
|||
all: |
|||
.PHONY: all clean linux windows android |
|||
|
|||
default: all |
|||
DEFAULT_GOAL: linux |
|||
|
|||
SHELL := env QT_BUILD_VERSION=$(QT_BUILD_VERSION) $(SHELL) |
|||
QT_BUILD_VERSION ?= "5.13.4" |
|||
|
|||
all: clean linux windows android |
|||
|
|||
clean: |
|||
find -iname "moc*" | xargs rm |
|||
rm -r vendor || true |
|||
find -type f -iname "moc*" | xargs rm |
|||
find -iname "rcc*" | xargs rm |
|||
|
|||
linux: |
|||
date |
|||
qtdeploy -qt_version $(QT_BUILD_VERSION) build linux 2>&1 | tee qtdeploy.log | pv |
|||
date |
|||
cp -R assets deploy/linux/ |
|||
|
|||
windows: |
|||
date |
|||
qtdeploy -qt_version $(QT_BUILD_VERSION) build windows 2>&1 | tee qtdeploy.log | pv |
|||
date |
|||
cp -R assets deploy/windows/ |
|||
|
|||
android: |
|||
cp -R assets android/ |
|||
date |
|||
## TODO have this also include AndroidExtras (see ANDROID_DEBUGGING) for full notes. |
|||
env ANDROID_MODULES_INCLUDE="Core,Gui,Svg,QuickWidgets,Xml" qtdeploy -debug -qt_version $(QT_BUILD_VERSION) build android 2>&1 | tee qtdeploy.log | pv |
|||
date |
|||
|
|||
|
@ -0,0 +1,10 @@ |
|||
# Settings List / Flickable |
|||
|
|||
Content not scrolling: Flickable does some reparenting behind the scenes and so |
|||
in the top level child of the Flickable you will need: |
|||
|
|||
parent: root.contentItem |
|||
|
|||
And in the flickable you will need to set the contentHeight: |
|||
|
|||
contentHeight: <childId>.height + <padding> |
@ -0,0 +1,150 @@ |
|||
buildscript { |
|||
repositories { |
|||
google() |
|||
jcenter() |
|||
} |
|||
|
|||
dependencies { |
|||
classpath 'com.android.tools.build:gradle:3.2.0' |
|||
} |
|||
} |
|||
|
|||
repositories { |
|||
google() |
|||
jcenter() |
|||
} |
|||
|
|||
apply plugin: 'com.android.application' |
|||
|
|||
dependencies { |
|||
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar']) |
|||
} |
|||
|
|||
android { |
|||
/******************************************************* |
|||
* The following variables: |
|||
* - androidBuildToolsVersion, |
|||
* - androidCompileSdkVersion |
|||
* - qt5AndroidDir - holds the path to qt android files |
|||
* needed to build any Qt application |
|||
* on Android. |
|||
* |
|||
* are defined in gradle.properties file. This file is |
|||
* updated by QtCreator and androiddeployqt tools. |
|||
* Changing them manually might break the compilation! |
|||
*******************************************************/ |
|||
|
|||
compileSdkVersion androidCompileSdkVersion.toInteger() |
|||
|
|||
buildToolsVersion '28.0.3' |
|||
|
|||
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'] |
|||
} |
|||
} |
|||
|
|||
|
|||
// kinda of cheaty, would prefer to use if (System.getEnv("GOARCH") == "arm64") { |
|||
// but it doesn't want to work in this context |
|||
if (qt5AndroidDir.contains("arm64")) { |
|||
|
|||
splits { |
|||
|
|||
// Configures multiple APKs based on ABI. |
|||
abi { |
|||
|
|||
// Enables building multiple APKs per ABI. |
|||
enable true |
|||
|
|||
// By default all ABIs are included, so use reset() and include to specify that we only |
|||
// want APKs for x86 and x86_64. |
|||
|
|||
// Resets the list of ABIs that Gradle should create APKs for to none. |
|||
reset() |
|||
|
|||
// Specifies a list of ABIs that Gradle should create APKs for. |
|||
// Note that because of the way that therecipe/qt bundles libraries |
|||
// only the specific architecture specified by GOARCH /GOARM will *actually* |
|||
// work so we currently have to do separate builds for each arch - this needs to be fixed. |
|||
include "arm64-v8a" |
|||
|
|||
// Specifies that we do not want to also generate a universal APK that includes all ABIs. |
|||
// QT deploy has to be run twice to generate the libgo_base.so for each arch |
|||
universalApk false |
|||
} |
|||
} |
|||
|
|||
task linkBuildDebugArm64(type: Exec) { |
|||
workingDir '../build/build/outputs/apk/debug/' |
|||
commandLine 'ln', '-sf', 'build-arm64-v8a-debug.apk', 'build-debug.apk' |
|||
} |
|||
|
|||
task renameBuildReleaseArm64(type: Exec) { |
|||
workingDir '../build/build/outputs/apk/release/' |
|||
commandLine 'mv', 'build-arm64-v8a-release-unsigned.apk', 'build-release-unsigned.apk' |
|||
} |
|||
|
|||
afterEvaluate { |
|||
assembleDebug.finalizedBy(linkBuildDebugArm64) |
|||
assembleRelease.finalizedBy(renameBuildReleaseArm64) |
|||
} |
|||
|
|||
} else { |
|||
|
|||
splits { |
|||
|
|||
// Configures multiple APKs based on ABI. |
|||
abi { |
|||
|
|||
// Enables building multiple APKs per ABI. |
|||
enable true |
|||
|
|||
// By default all ABIs are included, so use reset() and include to specify that we only |
|||
// want APKs for x86 and x86_64. |
|||
|
|||
// Resets the list of ABIs that Gradle should create APKs for to none. |
|||
reset() |
|||
|
|||
// Specifies a list of ABIs that Gradle should create APKs for. |
|||
// Note that because of the way that therecipe/qt bundles libraries |
|||
// only the specific architecture specified by GOARCH /GOARM will *actually* |
|||
// work so we currently have to do separate builds for each arch - this needs to be fixed. |
|||
include "armeabi-v7a" |
|||
|
|||
// Specifies that we do not want to also generate a universal APK that includes all ABIs. |
|||
// QT deploy has to be run twice to generate the libgo_base.so for each arch |
|||
universalApk false |
|||
} |
|||
} |
|||
|
|||
task linkBuildDebugArm7(type: Exec) { |
|||
workingDir '../build/build/outputs/apk/debug/' |
|||
commandLine 'ln', '-sf', 'build-armeabi-v7a-debug.apk', 'build-debug.apk' |
|||
} |
|||
|
|||
task renameBuildReleaseArm7(type: Exec) { |
|||
workingDir '../build/build/outputs/apk/release/' |
|||
commandLine 'mv', 'build-armeabi-v7a-release-unsigned.apk', 'build-release-unsigned.apk' |
|||
} |
|||
|
|||
afterEvaluate { |
|||
assembleDebug.finalizedBy(linkBuildDebugArm7) |
|||
assembleRelease.finalizedBy(renameBuildReleaseArm7) |
|||
} |
|||
} |
|||
|
|||
|
|||
lintOptions { |
|||
abortOnError true |
|||
} |
|||
|
|||
} |
|||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 13 KiB |