1
votes

Ionic: compileSdkVersion n'est pas spécifié - Impossible de trouver la méthode leftShift ()

Je viens de démarrer mon application avec Ionic 4. Pour le moment, je n'ai jamais apporté de modification au code d'origine que vous avez (avec le sidemenu) lorsque vous démarrez le projet. Après de nombreuses autres erreurs, j'ai celle-ci que je ne sais pas comment y remédier. Cela se produit lorsque j'essaye de:

ionic cordova build android

task cdvPrintProps << {
    println('cdvCompileSdkVersion=' + cdvCompileSdkVersion)
    println('cdvBuildToolsVersion=' + cdvBuildToolsVersion)
    println('cdvVersionCode=' + cdvVersionCode)
    println('cdvVersionCodeForceAbiDigit=' + cdvVersionCodeForceAbiDigit)
    println('cdvMinSdkVersion=' + cdvMinSdkVersion)
    println('cdvBuildMultipleApks=' + cdvBuildMultipleApks)
    println('cdvReleaseSigningPropertiesFile=' + cdvReleaseSigningPropertiesFile)
    println('cdvDebugSigningPropertiesFile=' + cdvDebugSigningPropertiesFile)
    println('cdvBuildArch=' + cdvBuildArch)
    println('computedVersionCode=' + android.defaultConfig.versionCode)
    android.productFlavors.each { flavor ->
        println('computed' + flavor.name.capitalize() + 'VersionCode=' + flavor.versionCode)
    }
}

J'ai ajouté cette ligne à config.xml:

<preference name="android-targetSdkVersion" value="28" />

Sans chance.

build.gradle ligne 148 commence par:

    FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* Where:
Build file 'D:\workspace\iganalytics\app\platforms\android\app\build.gradle' line: 148

* What went wrong:
A problem occurred evaluating project ':app'.
> Could not find method leftShift() for arguments [build_8ka4my3njl1nfn72j8pdlyfze$_run_closure6@5b9f348] on task ':app:cdvPrintProps' of type org.gradle.api.DefaultTask.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':app'.
> compileSdkVersion is not specified.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================

* Get more help at https://help.gradle.org

BUILD FAILED in 1s
cmd: Command failed with exit code 1 Error output:
FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* Where:
Build file 'D:\workspace\iganalytics\app\platforms\android\app\build.gradle' line: 148

* What went wrong:
A problem occurred evaluating project ':app'.
> Could not find method leftShift() for arguments [build_8ka4my3njl1nfn72j8pdlyfze$_run_closure6@5b9f348] on task ':app:cdvPrintProps' of type org.gradle.api.DefaultTask.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':app'.
> compileSdkVersion is not specified.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================

* Get more help at https://help.gradle.org

BUILD FAILED in 1s
[ERROR] An error occurred while running subprocess cordova.

        cordova build android exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.


4 commentaires

Avez-vous installé la version 28 d'Android SDK dans Android Studio?.


Quelle version de cordova-android et gradle utilisez-vous?


@AnandhSp Oui, j'ai


@JayOrdway Android 7 et gradle 5.2.1


3 Réponses :


4
votes

Géré pour le faire fonctionner en ajoutant la plate-forme android @ 8 au lieu de seulement Android qui installe la version 7


0 commentaires

2
votes

J'ai eu un problème similaire hier et résolu en ajoutant dans le fichier config.xml


1 commentaires

Cela peut ne pas être une bonne solution à long terme, si la condition requise pour le Play Store est 26: developer.android.com/distribute/best-practices/develop/...



2
votes

J'ai rencontré le même problème. La solution était mise à jour vers Android @ 8. Merci @Splinteer. Voici quelques détails supplémentaires sur la façon de procéder:

listez vos plates-formes avec:

ionic cordova platform add android@8

supprimez Android avec:

ionic cordova platform rm android

ajouter android @ 8:

ionic cordova platform list


0 commentaires