gpt4 book ai didi

android - Gluon Mobile:使用ExoPlayer

转载 作者:行者123 更新时间:2023-12-03 04:18:18 24 4
gpt4 key购买 nike

我正在使用GluonMobile开发一个Android应用程序。对于一项功能,我需要一个ExoPlayer。
因此,我包括了com.google.android.exoplayer:exoplayer:+依赖项。
看来Dependecy是一个aar文件,InteliJ找不到任何ExoPlayers类。
这是我的脚本:

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"
}
}
}

我已经发现了有关explodeAarDependencies(...)的信息,但是它没有用。因此,有人对我的GluonMobile项目中包括(任何)所有依赖项有任何想法。

谢谢您的帮助。

最佳答案

您对explodeAarDependencies的了解是正确的,这是jfxmobile插件用来将.aar依赖项解压缩为.jar和其他资源的任务。

您可以找到有关任务here的信息。

如何使用它:

在build.gradle文件中,包括依赖项:

dependencies {
...

androidCompile 'com.google.android.exoplayer:exoplayer:2.9.0'
}
  • 注1:请勿使用@aar
  • 注2:jfxmobile插件使用一些已定义的配置,例如androidCompile而不是androidImplementation
  • 注3:我宁愿使用给定的版本,而不是+

  • 然后在文件末尾添加任务:
    project.afterEvaluate {
    explodeAarDependencies(project.configurations.androidCompile)
    }

    就是这样。

    保存并应用/同步/重新加载构建,您应该看到 exoplayer和Android编译依赖项(.aar和.jar文件)中包含的一堆传递依赖项。

    关于android - Gluon Mobile:使用ExoPlayer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52814948/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com