Question

Je viens de passer à partir de Android Studio 0.6 à 0.8.3 (sur Linux Mint 15) et maintenant, ma construction ne fonctionne pas comme prévu.Dans mon fichier de gradle, j'ai beaucoup de tâches personnalisées qui font des étapes de Preguild (copie des fichiers, redimensionnement des images, etc.).

// lots of tasks snipped  
task convertToOGG(type:Exec) {
    ext.srcDir = 'bb/src/main/buildAssets/wavs/'
    ext.destDir = 'bb/src/main/res/raw/'
    workingDir '..'
    commandLine 'python', 'scripts/convertToOGG.py', srcDir, destDir
}

gradle.projectsEvaluated {
    copyRes.dependsOn resizeImageIcon
    convertToOGG.dependsOn copyRes

    preBuild.dependsOn copyRes, convertToOGG
}

Ceux-ci ne fonctionnent plus par défaut dans l'IDE.Ce sont des dépendances de la marche de Prebuild, mais ne courez pas si j'exécute manuellement l'étape de Prebuild dans l'IDE:

Executing tasks: [preBuild]

Configuration on demand is an incubating feature.
Relying on packaging to define the extension of the main artifact has been deprecated and is scheduled to be removed in Gradle 2.0
:Bb:preBuild
:libraries:bbengine:preBuild
:libraries:facebook:preBuild

BUILD SUCCESSFUL

Total time: 2.296 secs

C'est comme le bloc de gradle.ProjectsValuated n'est plus exécuté.Étrangement si je l'exécute dans un terminal, cela fonctionne:

pickles@sirius /workspace/bb/code/trunk/bb $ ./gradlew preBuild
Relying on packaging to define the extension of the main artifact has been deprecated and is scheduled to be removed in Gradle 2.0
:Bb:resizeImageIcon
/workspace/babybot/code/trunk/BbProject
RESIZE IMAGE:  Bb/src/main/buildAssets/oversize/image_icon.png
(1024, 1024) RGBA
Targets:  5
Bb/src/main/buildAssets/res/drawable-xxhdpi/ic_launcher.png (144, 144)
Saved a (144, 144) version to Bb/src/main/buildAssets/res/drawable-xxhdpi/ic_launcher.png
Bb/src/main/buildAssets/res/drawable-xhdpi/ic_launcher.png (96, 96)
Saved a (96, 96) version to Bb/src/main/buildAssets/res/drawable-xhdpi/ic_launcher.png
Bb/src/main/buildAssets/res/drawable-hdpi/ic_launcher.png (72, 72)
Saved a (72, 72) version to Bb/src/main/buildAssets/res/drawable-hdpi/ic_launcher.png
Bb/src/main/buildAssets/res/drawable-mdpi/ic_launcher.png (48, 48)
Saved a (48, 48) version to Bb/src/main/buildAssets/res/drawable-mdpi/ic_launcher.png
Bb/src/main/buildAssets/res/drawable-ldpi/ic_launcher.png (36, 36)
Saved a (36, 36) version to Bb/src/main/buildAssets/res/drawable-ldpi/ic_launcher.png
:Bb:copyRes UP-TO-DATE
:Bb:convertToOGG
Skipping chunk of type "LIST", length 106
Opening with wav module: WAV file reader
Encoding "audio_robot_jump.wav" to 
         "audio_robot_jump.ogg" 
at quality 3.00
    [ 79.6%] [ 0m00s remaining] / 

Done encoding file "audio_robot_jump.ogg"

    File length:  0m 02.0s
    Elapsed time: 0m 00.1s
    Rate:         39.5641
    Average bitrate: 48.3 kb/s

:Bb:preBuild
:libraries:bbengine:preBuild
:libraries:facebook:preBuild

BUILD SUCCESSFUL

Total time: 15.619 secs

Quelqu'un peut-il aider?Merci

Était-ce utile?

La solution

Je l'ai réparé en changeant:

gradle.projectsEvaluated {
    copyRes.dependsOn resizeImageIcon
    convertToOGG.dependsOn copyRes

    preBuild.dependsOn copyRes, convertToOGG
}

à

copyRes.dependsOn resizeImageIcon
convertToOGG.dependsOn copyRes

preBuild.dependsOn copyRes, convertToOGG

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top