Android: Say hello to gradle!
Add build.gradle script, move Android template files to another folder. These files are specific to every project, and they should be copied to then project android folder. Switching from Ant to Gradle brings lots of advantages: - it is way faster when rebuilding (25-50% faster than ant). - it enables first class Android Studio integration. - adding Android Extras libs (e.g. Google Play services, OBB, etc.) to your project is now painless. [ChangeLog][Android] Added Gradle support to build the APK. Change-Id: I9c8cb355118c9ac1997270c8b80916eca43fce4d Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
This commit is contained in:
parent
e26404e43f
commit
8b7a2d582c
@ -1,2 +1,2 @@
|
||||
TEMPLATE = subdirs
|
||||
SUBDIRS = jar java accessibility
|
||||
SUBDIRS = jar java templates accessibility
|
||||
|
@ -507,6 +507,9 @@ public class QtActivityDelegate
|
||||
? extras.getString("gdbserver_socket")
|
||||
: "+debug-socket";
|
||||
|
||||
if (!(new File(gdbserverPath)).exists())
|
||||
gdbserverPath += ".so";
|
||||
|
||||
// start debugger
|
||||
m_debuggerProcess = Runtime.getRuntime().exec(gdbserverPath
|
||||
+ socket
|
||||
|
@ -1,8 +1,6 @@
|
||||
CONFIG -= qt android_install
|
||||
|
||||
javaresources.files = \
|
||||
$$PWD/AndroidManifest.xml \
|
||||
$$PWD/version.xml \
|
||||
$$PWD/res \
|
||||
$$PWD/src
|
||||
|
||||
@ -18,8 +16,6 @@ INSTALLS += javaresources
|
||||
OUT_PATH = $$shell_path($$OUT_PWD)
|
||||
|
||||
QMAKE_POST_LINK += \
|
||||
$${QMAKE_COPY} $$shell_path($$PWD/AndroidManifest.xml) $$OUT_PATH $$RETURN \
|
||||
$${QMAKE_COPY} $$shell_path($$PWD/version.xml) $$OUT_PATH $$RETURN \
|
||||
$${QMAKE_COPY_DIR} $$shell_path($$PWD/res) $$OUT_PATH $$RETURN \
|
||||
$${QMAKE_COPY_DIR} $$shell_path($$PWD/src) $$OUT_PATH
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<resources>
|
||||
<string name="app_name"><!-- %%INSERT_APP_NAME%% --></string>
|
||||
|
||||
<!-- %%INSERT_STRINGS -->
|
||||
<string name="ministro_not_found_msg">Can\'t find Ministro service.\nThe application can\'t start.</string>
|
||||
<string name="ministro_needed_msg">This application requires Ministro service. Would you like to install it?</string>
|
||||
<string name="fatal_error_msg">Your application encountered a fatal error and cannot continue.</string>
|
||||
|
@ -1,8 +0,0 @@
|
||||
<version value="5.3">
|
||||
<ignore>
|
||||
<file>AndroidManifest.xml</file>
|
||||
<file>libs.xml</file>
|
||||
<file>logo.png</file>
|
||||
<file>icon.png</file>
|
||||
</ignore>
|
||||
</version>
|
@ -1,9 +1,9 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<manifest package="org.qtproject.example" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0" android:versionCode="1" android:installLocation="auto">
|
||||
<application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="@string/app_name">
|
||||
<application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="-- %%INSERT_APP_NAME%% --">
|
||||
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|locale|fontScale|keyboard|keyboardHidden|navigation"
|
||||
android:name="org.qtproject.qt5.android.bindings.QtActivity"
|
||||
android:label="@string/app_name"
|
||||
android:label="-- %%INSERT_APP_NAME%% --"
|
||||
android:screenOrientation="unspecified"
|
||||
android:launchMode="singleTop">
|
||||
<intent-filter>
|
51
src/android/templates/build.gradle
Normal file
51
src/android/templates/build.gradle
Normal file
@ -0,0 +1,51 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:0.12.1'
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'android'
|
||||
|
||||
dependencies {
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
}
|
||||
|
||||
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 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
|
||||
}
|
||||
}
|
21
src/android/templates/templates.pro
Normal file
21
src/android/templates/templates.pro
Normal file
@ -0,0 +1,21 @@
|
||||
CONFIG -= qt android_install
|
||||
|
||||
templates.files = \
|
||||
$$PWD/AndroidManifest.xml \
|
||||
$$PWD/res
|
||||
|
||||
templates.path = $$[QT_INSTALL_PREFIX]/src/android/templates
|
||||
|
||||
INSTALLS += templates
|
||||
|
||||
!prefix_build:!equals(OUT_PWD, $$PWD) {
|
||||
RETURN = $$escape_expand(\\n\\t)
|
||||
equals(QMAKE_HOST.os, Windows) {
|
||||
RETURN = $$escape_expand(\\r\\n\\t)
|
||||
}
|
||||
OUT_PATH = $$shell_path($$OUT_PWD)
|
||||
|
||||
QMAKE_POST_LINK += \
|
||||
$${QMAKE_COPY} $$shell_path($$PWD/AndroidManifest.xml) $$OUT_PATH $$RETURN \
|
||||
$${QMAKE_COPY_DIR} $$shell_path($$PWD/res) $$OUT_PATH
|
||||
}
|
Loading…
Reference in New Issue
Block a user