android - ionic : compileSdkVersion is not specified - Could not find method leftShift()

标签 android cordova ionic-framework gradle

我刚刚使用 Ionic 4 启动了我的应用程序。目前我从未对您在启动项目时拥有的原始代码(带有侧边菜单)进行任何修改。 在出现许多其他错误之后,我遇到了这个我不知道如何修复的错误。 它发生在我尝试:

ionic cordova build android

    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.

我将这一行添加到 config.xml 中:

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

没有运气。

build.gradle 第 148 行开始于:

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

最佳答案

设法通过添加平台 android@8 而不是仅安装版本 7 的 android 使其工作

关于android - ionic : compileSdkVersion is not specified - Could not find method leftShift(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54986839/

相关文章:

android - 使用 ProgressBar.setProgressDrawable 的问题

iphone - OpenGL ES : Is it more efficient to turn lights off and on, 或只是为我的粒子分配发射率?

objective-c - Cordova 插件与 C 库通信

android - Cordova平台添加android怪异问题

android - 使用 fileTransfer 下载 Ionic 4

android studio 不创建抽屉导航 Activity

androidquery AjaxStatus -103 错误

android - 如何避免在 Android 上启动 phonegap 应用程序时显示标题栏?

ios - phonegap-plugin-push 获取不是 FCM token 的 APN token

javascript - ionic : how to use cssClass in $ionicPopup?