Closed fjellandermedia closed 3 years ago
Can someone please help me with this. I've tried countless things: tweaked gradle version, kotlin version, updated everything in Android Studio, removing and reinstalling the cordova platform, reinstalling cordova, and more. I always get the same error message. Everything works on cordova-android@8.1.0 but not on cordova-android@9.0.0.
Please provide the output of cordova info
Cordova Packages:
cli: 10.0.0
common: 4.0.2
create: 3.0.0
lib: 10.0.0
common: 4.0.2
fetch: 3.0.0
serve: 4.0.0
Project Installed Platforms:
android: 9.0.0
Project Installed Plugins:
Environment:
OS: macOS Catalina 10.15.7 (19H2) (darwin 19.6.0) x64
Node: v12.13.0
npm: 6.14.8
android Environment:
android:
ERROR: Command failed with ENOENT: android list target spawn android ENOENT
Project Setting Files:
config.xml:
<?xml version='1.0' encoding='utf-8'?>
package.json:
--- Start of Cordova JSON Snippet --- { "plugins": {}, "platforms": [ "android" ] } --- End of Cordova JSON Snippet ---
Do you have android API 29 installed?
You can install it via Android Studio SDK Manager.
Make sure you have the android platform 29 installed under SDK Platforms
and build tools 29 under SDK Tools
. You may need to check Show Package Details
to see specific versions for each item. Cordova is specifically tested against build tools version 29.0.2
.
Given that you're missing an executable, you may also need to install the command line tools, also available under SDK Tools
tab. I believe it's a separate entry now and not automatically included with the android platform.
Yes, I have it installed. I earlier had build-tools 29.0.3 but I now unistalled it and installed build-tools 29.0.2 instead. It didn't work, however.
The first time I try to build after a reinstall of the android platform I get this error message:
Gabriels-MacBook-Pro:test gabriel$ cordova build android Checking Java JDK and Android SDK versions ANDROID_SDK_ROOT=/Users/gabriel/Library/Android/sdk (recommended setting) ANDROID_HOME=/Users/gabriel/Library/Android/sdk (DEPRECATED) Using Android SDK: /Users/gabriel/Library/Android/sdk
BUILD SUCCESSFUL in 1s 1 actionable task: 1 executed Subproject Path: CordovaLib Subproject Path: app Starting a Gradle Daemon, 4 stopped Daemons could not be reused, use --status for details
FAILURE: Build failed with an exception.
Where: Build file '/Users/gabriel/Documents/cordova/test/platforms/android/app/build.gradle' line: 20
What went wrong: A problem occurred evaluating project ':app'.
Uninitialized object exists on backward branch 45 Exception Details: Location: com/android/tools/build/jetifier/core/proguard/ProGuardTypesMap.
([Lkotlin/Pair;)V @101: goto Reason: Error exists in the bytecode Bytecode: 0x0000000: 2b12 bfb8 008d 2a2b 4d3a 0d03 3e2c 3a04 0x0000010: bb00 2459 2cbe b700 2cc0 002e 3a05 0336 0x0000020: 0619 043a 0719 07be 3608 0336 0915 0915 0x0000030: 08a2 0037 1907 1509 323a 0a19 0519 0a3a 0x0000040: 0b3a 0e03 360c 190b b600 d419 0bb6 00d7 0x0000050: b800 b6b8 0065 3a0f 190e 190f b900 5902 0x0000060: 0057 8409 01a7 ffc8 1905 c000 5b3a 0e19 0x0000070: 0d19 0ec0 004e b800 6bb7 00b7 b1
Stackmap Table: full_frame(@45,{UninitializedThis,Object[#220],Object[#220],Integer,Object[#220],Object[#46],Integer,Object[#220],Integer,Integer,Top,Top,Top,UninitializedThis},{}) same_frame(@104)
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 6s Command failed with exit code 1: /Users/gabriel/Documents/cordova/test/platforms/android/gradlew cdvBuildDebug -b /Users/gabriel/Documents/cordova/test/platforms/android/build.gradle
All consecutive times I get the error message in my first post.
Given that you're missing an executable, you may also need to install the command line tools, also available under SDK Tools tab. I believe it's a separate entry now and not automatically included with the android platform.
I had one instance of the command line tools installed, I now try to install some of the others.
Does this work without kotlin?
Try turning kotlin off by using
<preference name="GradlePluginKotlinEnabled" value="false" />
False should be the default value for this setting.
Does this work without kotlin?
Try turning kotlin off by using
<preference name="GradlePluginKotlinEnabled" value="false" />
False should be the default value for this setting.
In the config.xml?
In the config.xml?
Yes
I tried it. After a reinstallation of cordova-android it doesn't show the first error anymore. It does however still show the
com.android.build.gradle.internal.VariantManager
error i mentioned in my first post.
Thank you very much for investigating this with me. I very much appriciate it!
I tried it. After a reinstallation of cordova-android it doesn't show the first error anymore. It does however still show the
com.android.build.gradle.internal.VariantManager
error i mentioned in my first post.
Thank you very much for investigating this with me. I very much appriciate it!
Well now I'm going to start blaming gradle...
First I want to make sure you're using a compatible java version though. Can you run java -version
and give me the output.
Also print out the information from the following command:
/Users/gabriel/Documents/cordova/test/platforms/android/gradlew -v
This is now resolved! I think it was the java version. I had (if memory serves) 1.8.0_20, so I realize now it was quite old. I downloaded the latest 1.8 and now I have 1.8.0_271 and this error is no more.
Thank you very much Norman, for your time. I very much appriciate it! I wish there was anything I could do for you.
Glad I could help :)
_I am having the same issue, Java version I am using "1.8.0271"
Ionic:
Ionic CLI : 6.12.4 (C:\Users\Administrator\AppData\Roaming\npm\node_modules\@ionic\cli)
Cordova:
Utility:
System:
Issue Type
Description
Build fails, even on new projects. It works with cordova-android@8.1, but not on cordova-android@9.0. This is the output:
I have updated to latest Cordova CLI and latest SDK:s and build tools in Android Studio.
Command or Code
Environment, Platform, Device
Macbook Pro, macOS 10.15.6
Version information
Checklist