I want to use third-party libraries in my Qt/Android project. In typical android project I have to add compile to dependencies list, however it's impossible for Qt, because build.gradle is generated by androiddeployqt.
Docs says I should use project.properties for this, but it doesn't make any sense, because its support has been dropped since Android Studio. Moreover, I don't want to recompile all libraries on my own when using gradle.
So the question is: is it possible to hook androiddeployqt somehow to add few lines into build.gradle? Or maybe it's possible to put another build.gradle into subdir and gradle will execute tasks from it?
The solution is put build.gradle neat AndroidManifest.xml file with content like
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
}
}
allprojects {
repositories {
jcenter()
}
}
apply plugin: 'com.android.application'
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'io.grpc:grpc-protobuf-lite:1.5.0'
compile 'io.grpc:grpc-stub:1.5.0'
compile 'javax.annotation:javax.annotation-api:1.2'
compile 'io.grpc:grpc-okhttp:1.5.0'
compile 'com.google.protobuf:protobuf-java:3.4.0'
compile 'io.grpc:grpc-protobuf:1.5.0'
}
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
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With