Original error: java.lang.UnsupportedClassVersionError: com/android/apksigner/ApkSignerTool has been compiled by a more recent version of the Java Runtime (class file version 53.0), this version of the Java Runtime only recognizes class file versions up to 52.0
原始错误:java。lang.UnsupportedClassVersionError:com/android/apksigner/ApkSignerTool由最新版本的Java运行时(类文件版本53.0)编译,此版本的Java运行时仅识别高达52.0的类文件版本
An unknown server-side error occurred while processing the command. Original error: Cannot verify the signature of 'D:\Program Files\node-v10.15.3-win-x64\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-v4.17.4.apk'. Original error: java.lang.UnsupportedClassVersionError: com/android/apksigner/ApkSignerTool has been compiled by a more recent version of the Java Runtime (class file version 53.0), this version of the Java Runtime only recognizes class file versions up to 52.0
E at java.lang.ClassLoader.defineClass1(Native Method)
E at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
E at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
E at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
E at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
E at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
E at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
E at java.security.AccessController.doPrivileged(Native Method)
E at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
E at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
E at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
E at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
E at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:495)
E Error: A JNI error has occurred, please check your installation and try again
E Exception in thread "main"
E at getResponseForW3CError (D:\Program Files\node-v10.15.3-win-x64\node_modules\appium\node_modules\appium-base-driver\lib\protocol\errors.js:804:9)
E at asyncHandler (D:\Program Files\node-v10.15.3-win-x64\node_modules\appium\node_modules\appium-base-driver\lib\protocol\protocol.js:380:37)
解决方法:去Android的sdk目录下,删除30.0.0-preview目录即可
环境变量配置:%ANDROID_HOME%\build-tools\29.0.1(29.0.3 都行)
Android SDK 安装
新建环境变量:ANDROID_HOME 值为:F:\Andriod_SDK
在系统变量 Path 的值的前面加入以下内容:
%ANDROID_HOME%\platform-tools;
%ANDROID_HOME%\tools;%ANDROID_HOME%\tools;
%ANDROID_HOME%\build-tools\29.0.3 【这个29.0.3版本就行了,不能过高】
环境检测:在cmd命令终端输入:adb version