我正在尝试使用.aab
将Ionic v 5编译为gradlew bundle
,但收到错误消息。
我可以使用ionic cordova build android
和ionic cordova build android --prod --release
,但是由于Google控制台仅接受.aab,因此我使用了gradle,但它不起作用。
下面是错误信息
> Configure project :CordovaLib
publishNonDefault is deprecated and has no effect anymore. All variants are now published.
> Configure project :app
Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead.
+-----------------------------------------------------------------
| cordova-android-support-gradle-release: 27.+
+-----------------------------------------------------------------
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
at build_cnc5naln5i7uh2x22c0faw97o.run(C:\Users\App Source Code\Kun Fat\platforms\android\app\build.gradle:151)
FAILURE: Build failed with an exception.
* What went wrong:
Task 'bundle' is ambiguous in root project 'android'. Candidates are: 'bundleAppClassesDebug', 'bundleAppClassesDebugAndroidTest', 'bundleAppClassesDebugUnitTest', 'bundleAppClassesRelease', 'bundleAppClassesReleaseUnitTest', 'bundleDebug', 'bundleRelease'.
* Try:
Run gradlew tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
我厌倦了使用gradlew bundleRelease构建成功但没有生成.aab的问题。
我如何使用gradle从Ionic生成.aab。
以下是我的 ionic 信息
Ionic:
Ionic CLI : 5.2.3 (C:\Users\olade\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : @ionic/angular 4.11.10
@angular-devkit/build-angular : 0.803.24
@angular-devkit/schematics : 8.1.3
@angular/cli : 8.1.3
@ionic/angular-toolkit : 2.0.0
Cordova:
Cordova CLI : 9.0.0 (cordova-lib@9.0.1)
Cordova Platforms : android 7.1.4
Cordova Plugins : not available
Utility:
cordova-res : not installed
native-run : 0.2.8
System:
Android SDK Tools : 26.1.1 (C:\Users\olade\AppData\Local\Android\Sdk)
NodeJS : v12.16.1 (C:\Program Files\nodejs\node.exe)
npm : 6.13.1
OS : Windows 10
最佳答案
我遇到了同样的问题。解决方案已更新为android @ 8。
这是有关如何执行此操作的更多详细信息:
列出您的平台:
ionic cordova platform list
使用以下方法删除android:
ionic cordova platform rm android
添加android @ 8:
ionic cordova platform add android@8
运行命令:
ionic cordova build android --prod --release
然后:
gradlew bundle
关于android - 我在Ionic 5中遇到Gradlew软件包错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60654829/