I am working on an android app with GluonMobile. For one feature I need a ExoPlayer. So I included the dependency com.google.android.exoplayer:exoplayer:+ . It seems that the dependecy is an aar -file and InteliJ could not find any of ExoPlayers classes. Here my buildscript:
buildscript {
repositories {
mavenCentral()
jcenter()
google()
maven {
url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
}
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:+'
classpath 'com.github.jengelman.gradle.plugins:shadow:+'
}
}
apply plugin: 'org.javafxports.jfxmobile'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'java'
apply plugin: 'idea'
idea {
module {
downloadJavadoc = true
downloadSources = true
}
}
repositories {
mavenCentral()
jcenter()
google()
maven {
url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
}
maven {
url uri('libs')
}
}
mainClassName = '[...].main.Main'
version = '2.0_Alpha'
dependencies {
compile "com.gluonhq:charm:+"
compile "com.gluonhq:glisten-afterburner:+"
compile "com.google.apis:google-api-services-youtube:+"
compile "com.google.api-client:google-api-client-java6:+"
compile "com.google.oauth-client:google-oauth-client-jetty:+"
compile "com.google.code.gson:gson:+"
compileOnly 'lib.idea:annotations:0'
androidImplementation "org.javafxports:jfxdvk:+"
androidImplementation 'com.google.android.exoplayer:exoplayer:+@aar'
}
jfxmobile {
downConfig {
version = '+'
// Do not edit the line below. Use Gluon Mobile Settings in your project context menu instead
//noinspection GroovyAssignabilityCheck
plugins 'browser', 'display', 'lifecycle', 'statusbar', 'storage'
}
android {
manifest = 'src/android/AndroidManifest.xml'
//androidSdk = "${ANDROID_HOME}"
compileSdkVersion = 28
targetSdkVersion = 22
minSdkVersion = 16
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
}
}
task installApk{
group = "gluon mobile for android"
doLast{
exec {
workingDir "${ANDROID_HOME}\\platform-tools"
commandLine "${workingDir}\\adb.exe", "install", "${buildDir}/javafxports/android/YouJavaTubeApp.apk"
}
}
}
I found already something about explodeAarDependencies(...) but it did not work. So have somebody any ideas how to include (any) aar dependencies to my GluonMobile project.
Thank you for your help.
You are on the right track about explodeAarDependencies
, this is the task used by the jfxmobile plugin to unpack .aar dependencies into .jar and other resources.
You can find about the task here.
How to use it:
In your build.gradle file, include the dependency:
dependencies {
...
androidCompile 'com.google.android.exoplayer:exoplayer:2.9.0'
}
Note 1: don't to use @aar
Note 2: the jfxmobile plugin uses some defined configurations like androidCompile
instead of androidImplementation
.
Note 3: I'd rather use the given version, not +
.
And at the end of the file, add the task:
project.afterEvaluate {
explodeAarDependencies(project.configurations.androidCompile)
}
And that's it.
Save and apply/sync/reload the build and you should see exoplayer
and a bunch of transitive dependencies included into the Android compile dependencies, both .aar and .jar files.