An unknown server-side error occurred while processing the command. Original error: Cannot verify the signature of ‘C:\Users\smt\AppData\Local\Temp\202331-8376-1c21f0u.6iaq\appium-uiautomator2-server-v4.21.1.apk’. Original error: Error: A JNI error has occurred, please check your installation and try again Exception in thread “main” 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 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:756) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:468) at java.net.URLClassLoader.access$100(URLClassLoader.java:74) at java.net.URLClassLoader$1.run(URLClassLoader.java:369) at java.net.URLClassLoader 1. r u n ( U R L C l a s s L o a d e r . j a v a : 363 ) a t j a v a . s e c u r i t y . A c c e s s C o n t r o l l e r . d o P r i v i l e g e d ( N a t i v e M e t h o d ) a t j a v a . n e t . U R L C l a s s L o a d e r . f i n d C l a s s ( U R L C l a s s L o a d e r . j a v a : 362 ) a t j a v a . l a n g . C l a s s L o a d e r . l o a d C l a s s ( C l a s s L o a d e r . j a v a : 418 ) a t s u n . m i s c . L a u n c h e r 1.run(URLClassLoader.java:363) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:362) at java.lang.ClassLoader.loadClass(ClassLoader.java:418) at sun.misc.Launcher 1.run(URLClassLoader.java:363)atjava.security.AccessController.doPrivileged(NativeMethod)atjava.net.URLClassLoader.findClass(URLClassLoader.java:362)atjava.lang.ClassLoader.loadClass(ClassLoader.java:418)atsun.misc.LauncherAppClassLoader.loadClass(Launcher.java:355) at java.lang.ClassLoader.loadClass(ClassLoader.java:351) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:601)
原因:
查看了一下\android-sdk_r24.4.1-windows\android-sdk-windows\build-tools,
发下里面只有一个30.0.0-preview的包,用命令adb version查了一下sdk版本只有29.0.6
解决方法:
1.点击\android-sdk_r24.4.1-windows\android-sdk-windows里面的SDK Manager.exe打开Android SDK Manager找出最适合的版本进行下载
2.删除\android-sdk_r24.4.1-windows\android-sdk-windows\build-tools里的30.0.0-preview的包
继续报错,如下:
An unknown server-side error occurred while processing the command. Original error: Cannot verify the signature of ‘C:\Users\smt\AppData\Local\Temp\202331-7588-1pvvw6a.ff3x\appium-uiautomator2-server-v4.21.1.apk’. Original error: Could not find ‘apksigner.jar’ in [“D:\A.安装包\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\apksigner.jar”,“D:\A.安装包\android-sdk_r24.4.1-windows\android-sdk-windows\emulator\apksigner.jar”,“D:\A.安装包\android-sdk_r24.4.1-windows\android-sdk-windows\cmdline-tools\latest\bin\apksigner.jar”,“D:\A.安装包\android-sdk_r24.4.1-windows\android-sdk-windows\tools\apksigner.jar”,“D:\A.安装包\android-sdk_r24.4.1-windows\android-sdk-windows\tools\bin\apksigner.jar”,“D:\A.安装包\android-sdk_r24.4.1-windows\android-sdk-windows\apksigner.jar”,“D:\A.安装包\android-sdk_r24.4.1-windows\android-sdk-windows\build-tools\30.0.0-preview\apksigner.jar”,“D:\A.安装包\android-sdk_r24.4.1-windows\android-sdk-windows\build-tools\30.0.0-preview\lib\apksigner.jar”]. Do you have Android Build Tools installed at ‘D:\A.安装包\android-sdk_r24.4.1-windows\android-sdk-windows’?
原因:
\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\这里面没有apksigner.jar
解决方法:
将\android-sdk_r24.4.1-windows\android-sdk-windows\build-tools\29.0.3\lib下的apksigner.jar复制到\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\下