2016-12-19 3 views
0

J'essaie de générer une apk à partir de NetBeans 8 mais je reçois une déception. Voici le contenu de mon dossier gradle:Impossible de créer un fichier APK en utilisant Gluon

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' 


    } 
} 

Je l'ai déjà installé: multidex-1.0.1.aar

J'ai vu ce answer mais pas de chance. ça ne m'aide pas.

Edit: ce qui suit est une partie de stacktrace (en utilisant l'option --info de Netbeans):

: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 

Note:

Je ne ai pas besoin 25. Je peux utiliser Ancienne version. Lorsque je supprime compileSdkVersion = '25', je reçois la cette exception:

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 me donner:

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

Le lien ci-dessous présentent les outils SDK Android déjà installés: Android SDK tools installed

+0

Mettez à jour Charm vers la version 4.2.0, et essayez-le depuis la ligne de commande, à partir de la racine du projet, en exécutant 'gradlew.bat clean build android --info'. Utiliser 'gradlew' utilisera probablement une nouvelle version gradle. –

+0

Je reçois l'exception suivante: 'Exécution de la tâche ': dex' (la vérification à jour a pris 0,005 secondes) en raison de: Aucun historique disponible. [ant: java] Java Résultat: 1 : dex ÉCHEC : dex (Discussion [principal, 5, principal]) terminée. A pris 0,152 secondes. Échec: La génération a échoué avec une exception. » – user7233170

+0

Il semble que vous obteniez une erreur différente maintenant. Pouvez-vous éditer votre question et publier la pile afin que nous puissions voir où elle échoue? Pouvez-vous également essayer une version inférieure de la SDK? Avez-vous strictement besoin de 25? –

Répondre

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.**.*' 
    ] 

} 

S'il vous plaît assurez-vous pour définir votre chemin android sdk comme indiqué dans le code ci-dessus. si vous n'avez pas le SDK Android, vous pouvez le télécharger ici

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

dans ce cas, vous téléchargerez studio Android (ce qui est bien). Téléchargez-le, puis installez la version souhaitée du SDK souhaité.