无法使用Gluon创建APK文件

时间:2016-12-19 20:49:15

标签: javafxports gluon-mobile

我尝试从Netbeans 8生成apk但我得到了一个例外。 这是我的gradle文件的内容:

buildscript {
    repositories {
        maven {
            url 'https://oss.sonatype.org/content/repositories/snapshots'
        }
        jcenter()
    }
    dependencies {
        classpath 'org.javafxports:jfxmobile-plugin:1.3.0-SNAPSHOT'
    }
}

apply plugin: 'org.javafxports.jfxmobile'

repositories {
    jcenter()
    maven {
        url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
    }
}

mainClassName = 'com.testgluon.TestGluonMob'

dependencies {
    compile 'com.gluonhq:charm:4.2.0'

    }

jfxmobile {
    android {
        manifest = 'src/android/AndroidManifest.xml'
        compileSdkVersion = '25'


    }
}

我已安装:   multidex-1.0.1.aar

我看到了answer,但没有运气。它没有帮助我。

编辑:以下是stacktrace的一部分(使用Netbeans的--info选项):

    :applyRetrolambda (Thread[Daemon worker Thread 3,5,main]) completed. Took 21.933 secs.
:mergeClassesIntoJar (Thread[Daemon worker Thread 3,5,main]) started.
:mergeClassesIntoJar
Putting task artifact state for task ':mergeClassesIntoJar' into context took 0.001 secs.
Task :mergeClassesIntoJar class loader hash: 83f3637f6805a7b149525a93c5faad58
Task :mergeClassesIntoJar actions class loader hash: fde60ab3b9776111ebd9bf87f24df716
Executing task ':mergeClassesIntoJar' (up-to-date check took 0.172 secs) due to:
  Output property 'archivePath' file P:\javafxGluon\TestGluonMob\build\javafxports\tmp\android\multi-dex\allclasses.jar has changed.
:mergeClassesIntoJar (Thread[Daemon worker Thread 3,5,main]) completed. Took 3.91 secs.
:shrinkMultiDexComponents (Thread[Daemon worker Thread 3,5,main]) started.
:shrinkMultiDexComponents
Putting task artifact state for task ':shrinkMultiDexComponents' into context took 0.033 secs.
Task :shrinkMultiDexComponents class loader hash: c54ece983c65e20d963e3e8bb57cfcb0
Task :shrinkMultiDexComponents actions class loader hash: b6f3644e00f5f8abdc2639cc044bf52b
Executing task ':shrinkMultiDexComponents' (up-to-date check took 0.061 secs) due to:
  Output property 'outJarFileCollection' file P:\javafxGluon\TestGluonMob\build\javafxports\tmp\android\multi-dex\componentClasses.jar has changed.
ProGuard, version 5.1
Reading program jar [P:\javafxGluon\TestGluonMob\build\javafxports\tmp\android\multi-dex\allclasses.jar]
Reading library jar [C:\Program Files\Android\android-sdk\build-tools\25.0.1\lib\shrinkedAndroid.jar]
Preparing output jar [P:\javafxGluon\TestGluonMob\build\javafxports\tmp\android\multi-dex\componentClasses.jar]
  Copying resources from program jar [P:\javafxGluon\TestGluonMob\build\javafxports\tmp\android\multi-dex\allclasses.jar]
:shrinkMultiDexComponents (Thread[Daemon worker Thread 3,5,main]) completed. Took 7.079 secs.
:createMainDexList (Thread[Daemon worker Thread 3,5,main]) started.
:createMainDexList
Putting task artifact state for task ':createMainDexList' into context took 0.03 secs.
Task :createMainDexList class loader hash: c54ece983c65e20d963e3e8bb57cfcb0
Task :createMainDexList actions class loader hash: b6f3644e00f5f8abdc2639cc044bf52b
Executing task ':createMainDexList' (up-to-date check took 0.005 secs) due to:
  Output property 'outputFile' file P:\javafxGluon\TestGluonMob\build\javafxports\tmp\android\multi-dex\maindexlist.txt has changed.
:createMainDexList (Thread[Daemon worker Thread 3,5,main]) completed. Took 3.276 secs.
:writeInputListFile (Thread[Daemon worker Thread 3,5,main]) started.
:writeInputListFile
Putting task artifact state for task ':writeInputListFile' into context took 0.029 secs.
Task :writeInputListFile class loader hash: c54ece983c65e20d963e3e8bb57cfcb0
Task :writeInputListFile actions class loader hash: b6f3644e00f5f8abdc2639cc044bf52b
Executing task ':writeInputListFile' (up-to-date check took 0.034 secs) due to:
  Output property 'inputListFile' file P:\javafxGluon\TestGluonMob\build\javafxports\tmp\android\dex\inputList.txt has changed.
:writeInputListFile (Thread[Daemon worker Thread 3,5,main]) completed. Took 0.108 secs.
:dex (Thread[Daemon worker Thread 3,5,main]) started.
:dex
Putting task artifact state for task ':dex' into context took 0.034 secs.
Task :dex class loader hash: c54ece983c65e20d963e3e8bb57cfcb0
Task :dex actions class loader hash: b6f3644e00f5f8abdc2639cc044bf52b
Executing task ':dex' (up-to-date check took 0.002 secs) due to:
  No history is available.
[ant:java] Java Result: 1
:dex FAILED
:dex (Thread[Daemon worker Thread 3,5,main]) completed. Took 0.246 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':dex'.
> org.gradle.api.GradleException (no error message)

* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.

BUILD FAILED

注意:

我不需要25.我可以使用旧版本。 当我删除compileSdkVersion = '25'时,我得到了这个例外:

Executing: gradle :android
Arguments: [--info]

The client will now receive all logging from the daemon (pid: 5056). The daemon log file: C:\Users\user\.gradle\daemon\3.2.1\daemon-5056.out.log
Starting 14th build in daemon [uptime: 1 hrs 0 mins 21.185 secs, performance: 100%, no major garbage collections]
Executing build with daemon context: DefaultDaemonContext[uid=42b5a162-e19a-4659-8796-8ca0d6e5684c,javaHome=C:\Program Files\Java\jdk1.8.0_60,daemonRegistryDir=C:\Users\user\.gradle\daemon,pid=5056,idleTimeout=10800000,daemonOpts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=windows-1252,-Duser.country=FR,-Duser.language=fr,-Duser.variant]
Starting Build
Settings evaluated using settings file 'P:\master\settings.gradle'.
Projects loaded. Root project using build file 'P:\javafxGluon\TestGluonMob\build.gradle'.
Included projects: [root project 'TestGluonMob']
Evaluating root project 'TestGluonMob' using build file 'P:\javafxGluon\TestGluonMob\build.gradle'.
Android install directory: P:\javafxGluon\TestGluonMob\build\javafxports\android
Android temporary output directory: P:\javafxGluon\TestGluonMob\build\javafxports\tmp\android
Resources directory: P:\javafxGluon\TestGluonMob\build\javafxports\tmp\android\resources
Multi-dex output directory: P:\javafxGluon\TestGluonMob\build\javafxports\tmp\android\multi-dex
Dex output directory: P:\javafxGluon\TestGluonMob\build\javafxports\tmp\android\dex
iOS install directory: P:\javafxGluon\TestGluonMob\build\javafxports\ios
iOS temporary output directory: P:\javafxGluon\TestGluonMob\build\javafxports\tmp\ios
Adding C:\Program Files\Android\android-sdk\extras\android\m2repository to project repositories.
Adding C:\Program Files\Android\android-sdk\extras\google\m2repository to project repositories.
All projects evaluated.
Selected primary task ':android' from project :
Tasks to be executed: [task ':validateManifest', task ':collectMultiDexComponents', task ':compileJava', task ':processResources', task ':classes', task ':compileAndroidJava', task ':copyClassesForRetrolambda', task ':applyRetrolambda', task ':mergeClassesIntoJar', task ':shrinkMultiDexComponents', task ':createMainDexList', task ':writeInputListFile', task ':dex', task ':mergeAndroidAssets', task ':mergeAndroidResources', task ':processAndroidResources', task ':processAndroidResourcesDebug', task ':validateSigningDebug', task ':apkDebug', task ':zipalignDebug', task ':android']
Using javafxports version 8.60.8
Configuring Build for Android
Using javafxports dalvik sdk from location C:\Users\user\.gradle\caches\modules-2\files-2.1\org.javafxports\dalvik-sdk\8.60.8\6630ec66e4703c910ac3fd6151a8494c8b59186b\unpacked\dalvik-sdk
Using androidSdk from location: C:\Program Files\Android\android-sdk
There was no buildToolsVersion specified, looking for most recent installed version automatically
Using the following automatically detected buildToolsVersion: 25.0.1

FAILURE: Build failed with an exception.

* What went wrong:
Configured compileSdkVersion is invalid: 21 (C:\Program Files\Android\android-sdk/platforms/android-21

* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.

BUILD FAILED

runnig gradle -v cammand给我:

------------------------------------------------------------
Gradle 3.2.1
------------------------------------------------------------

Build time:   2016-11-22 15:19:54 UTC
Revision:     83b485b914fd4f335ad0e66af9d14aad458d2cc5

Groovy:       2.4.7
Ant:          Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM:          1.8.0_60 (Oracle Corporation 25.60-b23)
OS:           Windows Vista 6.0 x86

以下链接显示已安装的Android SDK工具: Android SDK tools installed

1 个答案:

答案 0 :(得分:0)

jfxmobile {
downConfig {
    version = '3.0.0'
    plugins 'display', 'lifecycle', 'statusbar', 'storage'
}
android {
    manifest = 'src/android/AndroidManifest.xml'
    compileSdkVersion=25
    buildToolsVersion = '25.0.0'
    androidSdk='/Users/USERNAME/Library/Android/sdk'
}
ios {
    infoPList = file('src/ios/Default-Info.plist')
    forceLinkClasses = [
            'com.gluonapplication.**.*',
            'com.gluonhq.**.*',
            'javax.annotations.**.*',
            'javax.inject.**.*',
            'javax.json.**.*',
            'org.glassfish.json.**.*'
    ]

}

请确保设置您的Android sdk路径,如上面的代码所示。如果您没有Android SDK,可以从这里下载

https://developer.android.com/studio/index.html

在这种情况下,你将下载android studio(这很好)。下载它,然后安装所需的SDK版本。