When I run ionic capacitor run android
with the more recent @capacitor package versions in “package.json”, I get an error:
[capacitor] D:\Src\GeneralRV\mobile\builds\20220414\android>"C:\Other Programs\Java\jdk-18/bin/java.exe" "-Xmx64m" "-Xms64m" "-Dorg.gradle.appname=gradlew" -classpath "D:\Src\GeneralRV\mobile\builds\20220414\android\\gradle\wrapper\gradle-wrapper.jar" org.gradle.wrapper.GradleWrapperMain "assembleDebug"
[capacitor]
[capacitor] > Configure project :app
[capacitor] WARNING:Using flatDir should be avoided because it doesn't support any meta-data formats.
[capacitor]
[capacitor] FAILURE: Build failed with an exception.
[capacitor]
[capacitor] * Where:
[capacitor] Build file 'D:\Src\GeneralRV\mobile\builds\20220414\node_modules\@capacitor\android\capacitor\build.gradle'
[capacitor]
[capacitor] * What went wrong:
[capacitor] Could not compile build file 'D:\Src\GeneralRV\mobile\builds\20220414\node_modules\@capacitor\android\capacitor\build.gradle'.
[capacitor] > startup failed:
[capacitor] General error during conversion: Unsupported class file major version 62
Below is more information that I think is significant. Output of “ionic info”:
Ionic:
Ionic CLI : 6.19.0 (C:\Other Programs\nodejs\node_modules\@ionic\cli)
Ionic Framework : @ionic/react 6.0.1
Capacitor:
Capacitor CLI : 3.4.3
@capacitor/android : 3.4.3
@capacitor/core : 3.4.3
@capacitor/ios : 3.4.3
Utility:
cordova-res : 0.15.4
native-run : 1.5.0
System:
NodeJS : v16.14.2 (C:\Other Programs\nodejs\node.exe)
npm : 8.5.0
OS : Windows 10
Here are the relevant lines in package.json:
"@capacitor/android": "3.4.3",
"@capacitor/app": "1.1.1",
"@capacitor/core": "3.4.3",
"@capacitor/haptics": "1.1.4",
"@capacitor/ios": "3.4.3",
"@capacitor/keyboard": "1.2.2",
"@capacitor/status-bar": "1.0.8",
IMPORTANT (I think): If I change those lines to the following and run npm install
, and change nothing else, the command works:
"@capacitor/android": "3.3.3",
"@capacitor/app": "1.0.7",
"@capacitor/core": "3.3.3",
"@capacitor/haptics": "1.1.3",
"@capacitor/ios": "3.3.4",
"@capacitor/keyboard": "1.2.0",
"@capacitor/status-bar": "1.0.6",
By “change nothing else”, I mean: same shell, same folder, same command, etc. For me, this is reproducible. And it seems to be totally out of my control.
The full output of the error when I run with the --verbose
argument is:
[capacitor] √ Copying web assets from build to android\app\src\main\assets\public in 326.94ms
[capacitor] √ Creating capacitor.config.json in android\app\src\main\assets in 1.95ms
[capacitor] √ copy android in 386.51ms
[capacitor] √ Updating Android plugins in 8.97ms
[capacitor] [info] Found 4 Capacitor plugins for android:
[capacitor] @capacitor/app@1.1.1
[capacitor] @capacitor/haptics@1.1.4
[capacitor] @capacitor/keyboard@1.2.2
[capacitor] @capacitor/status-bar@1.0.8
[capacitor] 2022-04-15T12:49:47.476Z capacitor:android:update Searching 1 source files in 'D:\\Src\\GeneralRV\\mobile\\builds\\20220414\\node_modules\\@capacitor\\app\\android\\src\\main' by /^@(?:CapacitorPlugin|NativePlugin)[\s\S]+?class ([\w]+)/gm regex
[capacitor] 2022-04-15T12:49:47.484Z capacitor:android:update Searching 'D:\\Src\\GeneralRV\\mobile\\builds\\20220414\\node_modules\\@capacitor\\app\\android\\src\\main\\java\\com\\capacitorjs\\plugins\\app\\AppPlugin.java' for package by /^package ([\w.]+);?$/gm regex
[capacitor] 2022-04-15T12:49:47.484Z capacitor:android:update 'com.capacitorjs.plugins.app.AppPlugin' is a suitable plugin class
[capacitor] 2022-04-15T12:49:47.492Z capacitor:android:update Searching 6 source files in 'D:\\Src\\GeneralRV\\mobile\\builds\\20220414\\node_modules\\@capacitor\\haptics\\android\\src\\main' by /^@(?:CapacitorPlugin|NativePlugin)[\s\S]+?class ([\w]+)/gm regex
[capacitor] 2022-04-15T12:49:47.501Z capacitor:android:update Searching 'D:\\Src\\GeneralRV\\mobile\\builds\\20220414\\node_modules\\@capacitor\\haptics\\android\\src\\main\\java\\com\\capacitorjs\\plugins\\haptics\\HapticsPlugin.java' for package by /^package ([\w.]+);?$/gm regex
[capacitor] 2022-04-15T12:49:47.502Z capacitor:android:update 'com.capacitorjs.plugins.haptics.HapticsPlugin' is a suitable plugin class
[capacitor] 2022-04-15T12:49:47.510Z capacitor:android:update Searching 2 source files in 'D:\\Src\\GeneralRV\\mobile\\builds\\20220414\\node_modules\\@capacitor\\keyboard\\android\\src\\main' by /^@(?:CapacitorPlugin|NativePlugin)[\s\S]+?class ([\w]+)/gm regex
[capacitor] 2022-04-15T12:49:47.517Z capacitor:android:update Searching 'D:\\Src\\GeneralRV\\mobile\\builds\\20220414\\node_modules\\@capacitor\\keyboard\\android\\src\\main\\java\\com\\capacitorjs\\plugins\\keyboard\\KeyboardPlugin.java' for package by /^package ([\w.]+);?$/gm regex
[capacitor] 2022-04-15T12:49:47.517Z capacitor:android:update 'com.capacitorjs.plugins.keyboard.KeyboardPlugin' is a suitable plugin class
[capacitor] 2022-04-15T12:49:47.522Z capacitor:android:update Searching 3 source files in 'D:\\Src\\GeneralRV\\mobile\\builds\\20220414\\node_modules\\@capacitor\\status-bar\\android\\src\\main' by /^@(?:CapacitorPlugin|NativePlugin)[\s\S]+?class ([\w]+)/gm regex
[capacitor] 2022-04-15T12:49:47.533Z capacitor:android:update Searching 'D:\\Src\\GeneralRV\\mobile\\builds\\20220414\\node_modules\\@capacitor\\status-bar\\android\\src\\main\\java\\com\\capacitorjs\\plugins\\statusbar\\StatusBarPlugin.java' for package by /^package ([\w.]+);?$/gm regex
[capacitor] 2022-04-15T12:49:47.533Z capacitor:android:update 'com.capacitorjs.plugins.statusbar.StatusBarPlugin' is a suitable plugin class
[capacitor] √ update android in 172.45ms
[capacitor] 2022-04-15T12:49:47.983Z capacitor:android:run Invoking ./gradlew with args: [ 'assembleDebug' ]
[capacitor] × Running Gradle build - failed!
[capacitor] [error]
[capacitor] D:\Src\GeneralRV\mobile\builds\20220414\android>if "Windows_NT" == "Windows_NT" setlocal
[capacitor]
[capacitor] D:\Src\GeneralRV\mobile\builds\20220414\android>set DIRNAME=D:\Src\GeneralRV\mobile\builds\20220414\android\
[capacitor]
[capacitor] D:\Src\GeneralRV\mobile\builds\20220414\android>if "D:\Src\GeneralRV\mobile\builds\20220414\android\" == "" set DIRNAME=.
[capacitor]
[capacitor] D:\Src\GeneralRV\mobile\builds\20220414\android>set APP_BASE_NAME=gradlew
[capacitor]
[capacitor] D:\Src\GeneralRV\mobile\builds\20220414\android>set APP_HOME=D:\Src\GeneralRV\mobile\builds\20220414\android\
[capacitor]
[capacitor] D:\Src\GeneralRV\mobile\builds\20220414\android>for %i in ("D:\Src\GeneralRV\mobile\builds\20220414\android\") do set APP_HOME=%~fi
[capacitor]
[capacitor] D:\Src\GeneralRV\mobile\builds\20220414\android>set APP_HOME=D:\Src\GeneralRV\mobile\builds\20220414\android\
[capacitor]
[capacitor] D:\Src\GeneralRV\mobile\builds\20220414\android>set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
[capacitor]
[capacitor] D:\Src\GeneralRV\mobile\builds\20220414\android>if defined JAVA_HOME goto findJavaFromJavaHome
[capacitor]
[capacitor] D:\Src\GeneralRV\mobile\builds\20220414\android>set JAVA_HOME=C:\Other Programs\Java\jdk-18
[capacitor]
[capacitor] D:\Src\GeneralRV\mobile\builds\20220414\android>set JAVA_EXE=C:\Other Programs\Java\jdk-18/bin/java.exe
[capacitor]
[capacitor] D:\Src\GeneralRV\mobile\builds\20220414\android>if exist "C:\Other Programs\Java\jdk-18/bin/java.exe" goto execute
[capacitor]
[capacitor] D:\Src\GeneralRV\mobile\builds\20220414\android>set CLASSPATH=D:\Src\GeneralRV\mobile\builds\20220414\android\\gradle\wrapper\gradle-wrapper.jar
[capacitor]
[capacitor] D:\Src\GeneralRV\mobile\builds\20220414\android>"C:\Other Programs\Java\jdk-18/bin/java.exe" "-Xmx64m" "-Xms64m" "-Dorg.gradle.appname=gradlew" -classpath "D:\Src\GeneralRV\mobile\builds\20220414\android\\gradle\wrapper\gradle-wrapper.jar" org.gradle.wrapper.GradleWrapperMain "assembleDebug"
[capacitor] Starting a Gradle Daemon, 1 stopped Daemon could not be reused, use --status for details
[capacitor]
[capacitor] > Configure project :app
[capacitor] WARNING:Using flatDir should be avoided because it doesn't support any meta-data formats.
[capacitor]
[capacitor] FAILURE: Build failed with an exception.
[capacitor]
[capacitor] * Where:
[capacitor] Build file 'D:\Src\GeneralRV\mobile\builds\20220414\node_modules\@capacitor\android\capacitor\build.gradle'
[capacitor]
[capacitor] * What went wrong:
[capacitor] Could not compile build file 'D:\Src\GeneralRV\mobile\builds\20220414\node_modules\@capacitor\android\capacitor\build.gradle'.
[capacitor] > startup failed:
[capacitor] General error during conversion: Unsupported class file major version 62
[capacitor]
[capacitor] java.lang.IllegalArgumentException: Unsupported class file major version 62
(stack trace omitted for length limit)
[capacitor]
[capacitor] 1 error
[capacitor]
[capacitor]
[capacitor] * Try:
[capacitor] 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.
[capacitor]
[capacitor] * Get more help at https://help.gradle.org
[capacitor]
[capacitor] Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
[capacitor]
[capacitor] You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
[capacitor]
[capacitor]
[capacitor] BUILD FAILED in 9s
[capacitor] See https://docs.gradle.org/7.2/userguide/command_line_interface.html#sec:command_line_warnings
[capacitor]
[capacitor] D:\Src\GeneralRV\mobile\builds\20220414\android>if "1" == "0" goto mainEnd
[capacitor]
[capacitor] D:\Src\GeneralRV\mobile\builds\20220414\android>rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
[capacitor]
[capacitor] D:\Src\GeneralRV\mobile\builds\20220414\android>rem the _cmd.exe /c_ return code!
[capacitor]
[capacitor] D:\Src\GeneralRV\mobile\builds\20220414\android>if not "" == "" exit 1
[capacitor]
[capacitor] D:\Src\GeneralRV\mobile\builds\20220414\android>exit /b 1
[capacitor]
[ERROR] An error occurred while running subprocess capacitor.
capacitor.cmd run android --target Pixel_4_API_30_Android_11_ exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
ionic:utils-process onBeforeExit handler: 'process.exit' received +0ms
ionic:utils-process onBeforeExit handler: running 2 functions +0ms
ionic:utils-process error while killing process tree for 66448: Error: Command failed: taskkill /pid 66448 /T /F
ionic:utils-process ERROR: The process "66448" not found.
ionic:utils-process
ionic:utils-process at ChildProcess.exithandler (node:child_process:399:12)
ionic:utils-process at ChildProcess.emit (node:events:526:28)
ionic:utils-process at maybeClose (node:internal/child_process:1092:16)
ionic:utils-process at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5) {
ionic:utils-process killed: false,
ionic:utils-process code: 128,
ionic:utils-process signal: null,
ionic:utils-process cmd: 'taskkill /pid 66448 /T /F'
ionic:utils-process } +373ms
ionic:utils-process onBeforeExit handler: error from function: Error: Command failed: taskkill /pid 66448 /T /F
ionic:utils-process ERROR: The process "66448" not found.
ionic:utils-process
ionic:utils-process at ChildProcess.exithandler (node:child_process:399:12)
ionic:utils-process at ChildProcess.emit (node:events:526:28)
ionic:utils-process at maybeClose (node:internal/child_process:1092:16)
ionic:utils-process at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5) {
ionic:utils-process killed: false,
ionic:utils-process code: 128,
ionic:utils-process signal: null,
ionic:utils-process cmd: 'taskkill /pid 66448 /T /F'
ionic:utils-process } +2ms
ionic:utils-process error while killing process tree for 59928: Error: Command failed: taskkill /pid 59928 /T /F
ionic:utils-process ERROR: The process "59928" not found.
ionic:utils-process
ionic:utils-process at ChildProcess.exithandler (node:child_process:399:12)
ionic:utils-process at ChildProcess.emit (node:events:526:28)
ionic:utils-process at maybeClose (node:internal/child_process:1092:16)
ionic:utils-process at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5) {
ionic:utils-process killed: false,
ionic:utils-process code: 128,
ionic:utils-process signal: null,
ionic:utils-process cmd: 'taskkill /pid 59928 /T /F'
ionic:utils-process } +4ms
ionic:utils-process onBeforeExit handler: error from function: Error: Command failed: taskkill /pid 59928 /T /F
ionic:utils-process ERROR: The process "59928" not found.
ionic:utils-process
ionic:utils-process at ChildProcess.exithandler (node:child_process:399:12)
ionic:utils-process at ChildProcess.emit (node:events:526:28)
ionic:utils-process at maybeClose (node:internal/child_process:1092:16)
ionic:utils-process at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5) {
ionic:utils-process killed: false,
ionic:utils-process code: 128,
ionic:utils-process signal: null,
ionic:utils-process cmd: 'taskkill /pid 59928 /T /F'
ionic:utils-process } +4ms
ionic:utils-process processExit: exiting (exit code: 1) +1ms
Any direction for me on how to get past this? I know that for now I can stick with the earlier package versions, but at some point I’ll have to update.
Thanks.