Getting compileSdkVersion is not specified. Please add it to build.gradle

huangapple go评论110阅读模式
英文:

Getting compileSdkVersion is not specified. Please add it to build.gradle

问题

Here are the translated parts of your content:

在构建APK时出现以下错误:

配置项目':app'时发生问题。

com.android.builder.errors.EvalIssueException:未指定compileSdkVersion。请将其添加到build.gradle中。

在build.gradle中已经添加了:
compileSdkVersion cordovaConfig.COMPILE_SDK_VERSION

还在config.xml文件中添加了:

有人可以帮我解决问题吗?

Ionic信息

Ionic:

Ionic CLI:5.4.16(C:\Users\anshi\AppData\Roaming\npm\node_modules\ionic) Ionic Framework:@ionic/angular 5.9.4 @angular-devkit/build-angular:12.1.4 @angular-devkit/schematics:12.2.18 @angular/cli:12.2.18 @ionic/angular-toolkit:4.0.0

Cordova:

Cordova CLI:11.0.0 Cordova平台:android 11.0.0 Cordova插件:cordova-plugin-ionic-keyboard 2.2.0,cordova-plugin-ionic-webview 4.2.1以及其他23个插件

工具:

cordova-res:0.15.4 native-run(可用更新:1.7.1):1.5.0

系统:

Android SDK工具:26.1.1(C:\Users\username\AppData\Local\Android\Sdk) NodeJS:v16.13.0(C:\Program Files\nodejs\node.exe) npm:6.14.18 操作系统:Windows 10

英文:

Getting this error while building apk

A problem occurred configuring project ':app'. > com.android.builder.errors.EvalIssueException: compileSdkVersion is not specified. Please add it to build.gradle

In build.gradle already added compileSdkVersion cordovaConfig.COMPILE_SDK_VERSION

Also in config.xml file added <preference name="android-targetSdkVersion" value="30" />

Can anyone help me what's the issue

Ionic Info

Ionic:

Ionic CLI : 5.4.16 (C:\Users\anshi\AppData\Roaming\npm\node_modules\ionic) Ionic Framework : @ionic/angular 5.9.4 @angular-devkit/build-angular : 12.1.4 @angular-devkit/schematics : 12.2.18 @angular/cli : 12.2.18 @ionic/angular-toolkit : 4.0.0

Cordova:

Cordova CLI : 11.0.0 Cordova Platforms : android 11.0.0 Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 23 other plugins)

Utility:

cordova-res : 0.15.4 native-run (update available: 1.7.1) : 1.5.0

System:

Android SDK Tools : 26.1.1 (C:\Users\username\AppData\Local\Android\Sdk) NodeJS : v16.13.0 (C:\Program Files\nodejs\node.exe) npm : 6.14.18 OS : Windows 10

答案1

得分: 0

安装模块

npm i @ionic/cordova-builders
英文:

Install module

npm i @ionic/cordova-builders

答案2

得分: 0

文件是否存在于你的node_modules目录中?
node_modules/@ionic/cordova-builders/package.json

你是否按照文档中的说明使用ng add @ionic/cordova-builders添加了构建器?https://www.npmjs.com/package/@ionic/cordova-builders

我认为这与你的问题无关。但是最新版本的构建工具是33。我相信cordova-android 11默认构建目标SDK-32。构建工具26用于targetSDK-26。我认为你应该添加较新版本的构建工具(或使用较低版本的cordova-android)。

英文:

Is the file present in your node_modules?
node_modules/@ionic/cordova-builders/package.json

have you added the builders with: ng add @ionic/cordova-builders as per docs? https://www.npmjs.com/package/@ionic/cordova-builders

I don't think this is related to your issue. But the newest version of build tools is 33. cordova-android 11 builds by default for target-SDK-32 I believe. build-tools 26 is for targetSDK-26. I think you should add the newer versions of build tools (or use a lower version of cordova-android)

huangapple
  • 本文由 发表于 2023年1月5日 14:06:43
  • 转载请务必保留本文链接:https://go.coder-hub.com/75014415.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定