appium报错:Original error: Error: A JNI error has occurred, please check your installation and try again appiumdesktop运行正常

Sue:~ sue$ appium

[Appium] Welcome to Appium v1.18.3

[Appium] Appium REST http interface listener started on 0.0.0.0:4723

[debug] [HTTP] Request idempotency key: e15ff03b-e8a3-415f-9ce8-5c7aa86a5037

[HTTP] → POST /wd/hub/session

[HTTP] {“capabilities”:{“firstMatch”:[{“platformName”:“Android”,“appium:appPackage”:“com.vonedao”,“appium:appActivity”:“.activity.SplashActivity”}]},“desiredCapabilities”:{“platformName”:“Android”,“appPackage”:“com.vonedao”,“appActivity”:“.activity.SplashActivity”}}

[debug] [W3C] Calling AppiumDriver.createSession() with args: [{“platformName”:“Android”,“appPackage”:“com.vonedao”,“appActivity”:“.activity.SplashActivity”},null,{“firstMatch”:[{“platformName”:“Android”,“appium:appPackage”:“com.vonedao”,“appium:appActivity”:“.activity.SplashActivity”}]}]

[debug] [BaseDriver] Event ‘newSessionRequested’ logged at 1603629065117 (20:31:05 GMT+0800 (GMT+08:00))

[Appium]

[Appium] ======================================================================

[Appium] DEPRECATION WARNING:

[Appium]

[Appium] The ‘automationName’ capability was not provided in the desired

[Appium] capabilities for this Android session

[Appium]

[Appium] Setting ‘automationName=UiAutomator2’ by default and using the

[Appium] UiAutomator2 Driver

[Appium]

[Appium] The next major version of Appium (2.x) will require the

[Appium] ‘automationName’ capability to be set for all sessions on all

[Appium] platforms

[Appium]

[Appium] In previous versions (Appium <= 1.13.x), the default was

[Appium] ‘automationName=UiAutomator1’

[Appium]

[Appium] If you wish to use that automation instead of UiAutomator2, please

[Appium] add ‘automationName=UiAutomator1’ to your desired capabilities

[Appium]

[Appium] For more information about drivers, please visit

[Appium] Introduction - Appium and explore the

[Appium] ‘Drivers’ menu

[Appium]

[Appium] ======================================================================

[Appium]

[Appium] Appium v1.18.3 creating new AndroidUiautomator2Driver (v1.59.0) session

[debug] [BaseDriver] W3C capabilities and MJSONWP desired capabilities were provided

[debug] [BaseDriver] Creating session with W3C capabilities: {

[debug] [BaseDriver] “alwaysMatch”: {

[debug] [BaseDriver] “platformName”: “Android”,

[debug] [BaseDriver] “appium:appPackage”: “com.vonedao”,

[debug] [BaseDriver] “appium:appActivity”: “.activity.SplashActivity”

[debug] [BaseDriver] },

[debug] [BaseDriver] “firstMatch”: [

[debug] [BaseDriver] {}

[debug] [BaseDriver] ]

[debug] [BaseDriver] }

[BaseDriver] Session created with session id: ae806967-1255-4532-86f7-13981ecf4a3d

[UiAutomator2] Starting ‘com.vonedao’ directly on the device

[ADB] Found 3 ‘build-tools’ folders under ‘/Users/sue/Library/Android/sdk’ (newest first):

[ADB] /Users/sue/Library/Android/sdk/build-tools/30.0.0

[ADB] /Users/sue/Library/Android/sdk/build-tools/29.0.2

[ADB] /Users/sue/Library/Android/sdk/build-tools/28.0.3

[ADB] Using ‘adb’ from ‘/Users/sue/Library/Android/sdk/platform-tools/adb’

[debug] [ADB] Running ‘/Users/sue/Library/Android/sdk/platform-tools/adb -P 5037 start-server’

[AndroidDriver] Retrieving device list

[debug] [ADB] Trying to find a connected android device

[debug] [ADB] Getting connected devices

[debug] [ADB] Connected devices: [{“udid”:“8fc3d699”,“state”:“device”}]

[AndroidDriver] Using device: 8fc3d699

[ADB] Using ‘adb’ from ‘/Users/sue/Library/Android/sdk/platform-tools/adb’

[debug] [ADB] Running ‘/Users/sue/Library/Android/sdk/platform-tools/adb -P 5037 start-server’

[debug] [ADB] Setting device id to 8fc3d699

[debug] [ADB] Running ‘/Users/sue/Library/Android/sdk/platform-tools/adb -P 5037 -s 8fc3d699 shell getprop ro.build.version.sdk’

[debug] [ADB] Current device property ‘ro.build.version.sdk’: 27

[debug] [ADB] Device API level: 27

[AndroidDriver] No app sent in, not parsing package/activity

[debug] [ADB] Running ‘/Users/sue/Library/Android/sdk/platform-tools/adb -P 5037 -s 8fc3d699 wait-for-device’

[debug] [ADB] Running ‘/Users/sue/Library/Android/sdk/platform-tools/adb -P 5037 -s 8fc3d699 shell echo ping’

[debug] [AndroidDriver] Pushing settings apk to device…

[debug] [ADB] Getting install status for io.appium.settings

[debug] [ADB] Running ‘/Users/sue/Library/Android/sdk/platform-tools/adb -P 5037 -s 8fc3d699 shell dumpsys package io.appium.settings’

[debug] [ADB] ‘io.appium.settings’ is installed

[debug] [ADB] Getting package info for ‘io.appium.settings’

[debug] [ADB] Running ‘/Users/sue/Library/Android/sdk/platform-tools/adb -P 5037 -s 8fc3d699 shell dumpsys package io.appium.settings’

[debug] [ADB] The version name of the installed ‘io.appium.settings’ is greater or equal to the application version name (‘3.2.1’ >= ‘3.2.1’)

[debug] [ADB] There is no need to install/upgrade ‘/usr/local/lib/node_modules/appium/node_modules/_io.appium.settings@3.2.1@io.appium.settings/apks/settings_apk-debug.apk’

[debug] [ADB] Getting IDs of all ‘io.appium.settings’ processes

[debug] [ADB] Running ‘/Users/sue/Library/Android/sdk/platform-tools/adb -P 5037 -s 8fc3d699 shell ‘pgrep --help; echo $?’’

[debug] [ADB] Running ‘/Users/sue/Library/Android/sdk/platform-tools/adb -P 5037 -s 8fc3d699 shell pgrep -f ([[:blank:]]|^)io.appium.settings([[:blank:]]|$)’

[debug] [AndroidDriver] io.appium.settings is already running. There is no need to reset its permissions.

[debug] [ADB] Running ‘/Users/sue/Library/Android/sdk/platform-tools/adb -P 5037 -s 8fc3d699 shell appops set io.appium.settings android:mock_location allow’

[debug] [Logcat] Starting logs capture with command: /Users/sue/Library/Android/sdk/platform-tools/adb -P 5037 -s 8fc3d699 logcat -v threadtime

[debug] [UiAutomator2] Forwarding UiAutomator2 Server port 6790 to local port 8200

[debug] [ADB] Forwarding system: 8200 to device: 6790

[debug] [ADB] Running ‘/Users/sue/Library/Android/sdk/platform-tools/adb -P 5037 -s 8fc3d699 forward tcp:8200 tcp:6790’

[UiAutomator2] Server package at ‘/usr/local/lib/node_modules/appium/node_modules/_appium-uiautomator2-server@4.16.0@appium-uiautomator2-server/apks/appium-uiautomator2-server-v4.16.0.apk’ is not writeable. Will copy it into the temporary location at ‘/var/folders/gb/8979mt_n53517wv8yhn_7d7m0000gn/T/2020925-736-1dxya4c.jknn’ as a workaround. Consider making this file writeable manually in order to improve the performance of session startup.

[UiAutomator2] Server package at ‘/usr/local/lib/node_modules/appium/node_modules/_appium-uiautomator2-server@4.16.0@appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk’ is not writeable. Will copy it into the temporary location at ‘/var/folders/gb/8979mt_n53517wv8yhn_7d7m0000gn/T/2020925-736-1dxya4c.jknn’ as a workaround. Consider making this file writeable manually in order to improve the performance of session startup.

[debug] [ADB] Getting install status for io.appium.uiautomator2.server

[debug] [ADB] Running ‘/Users/sue/Library/Android/sdk/platform-tools/adb -P 5037 -s 8fc3d699 shell dumpsys package io.appium.uiautomator2.server’

[debug] [ADB] ‘io.appium.uiautomator2.server’ is installed

[debug] [ADB] Getting package info for ‘io.appium.uiautomator2.server’

[debug] [ADB] Running ‘/Users/sue/Library/Android/sdk/platform-tools/adb -P 5037 -s 8fc3d699 shell dumpsys package io.appium.uiautomator2.server’

[debug] [ADB] The installed ‘io.appium.uiautomator2.server’ package is older than ‘/var/folders/gb/8979mt_n53517wv8yhn_7d7m0000gn/T/2020925-736-1dxya4c.jknn/appium-uiautomator2-server-v4.16.0.apk’ (48 < 74 or ‘4.5.5’ < ‘4.16.0’)’

[debug] [UiAutomator2] io.appium.uiautomator2.server installation state: olderVersionInstalled

[debug] [ADB] Checking app cert for /var/folders/gb/8979mt_n53517wv8yhn_7d7m0000gn/T/2020925-736-1dxya4c.jknn/appium-uiautomator2-server-v4.16.0.apk

[ADB] Using ‘apksigner.jar’ from ‘/Users/sue/Library/Android/sdk/build-tools/30.0.0/lib/apksigner.jar’

[debug] [ADB] Starting apksigner: /Library/Java/JavaVirtualMachines/jdk1.8.0_241.jdk/Contents/Home/bin/java -Xmx1024M -Xss1m -jar /Users/sue/Library/Android/sdk/build-tools/30.0.0/lib/apksigner.jar verify --print-certs /var/folders/gb/8979mt_n53517wv8yhn_7d7m0000gn/T/2020925-736-1dxya4c.jknn/appium-uiautomator2-server-v4.16.0.apk

[debug] [UiAutomator2] Deleting UiAutomator2 session

[debug] [UiAutomator2] Deleting UiAutomator2 server session

[debug] [WD Proxy] Matched ‘/’ to command name ‘deleteSession’

[UiAutomator2] Did not get confirmation UiAutomator2 deleteSession worked; Error was: UnknownError: An unknown server-side error occurred while processing the command. Original error: Trying to proxy a session command without session id

[debug] [ADB] Running ‘/Users/sue/Library/Android/sdk/platform-tools/adb -P 5037 -s 8fc3d699 shell am force-stop com.vonedao’

[debug] [Logcat] Stopping logcat capture

[debug] [ADB] Removing forwarded port socket connection: 8200

[debug] [ADB] Running ‘/Users/sue/Library/Android/sdk/platform-tools/adb -P 5037 -s 8fc3d699 forward --remove tcp:8200’

[debug] [BaseDriver] Event ‘newSessionStarted’ logged at 1603629066527 (20:31:06 GMT+0800 (GMT+08:00))

[debug] [W3C] Encountered internal error running command: Error: Cannot verify the signature of ‘/var/folders/gb/8979mt_n53517wv8yhn_7d7m0000gn/T/2020925-736-1dxya4c.jknn/appium-uiautomator2-server-v4.16.0.apk’. Original error: Error: A JNI error has occurred, please check your installation and try again

[debug] [W3C] 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

[debug] [W3C] at java.lang.ClassLoader.defineClass1(Native Method)

[debug] [W3C] at java.lang.ClassLoader.defineClass(ClassLoader.java:756)

[debug] [W3C] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)

[debug] [W3C] at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)

[debug] [W3C] at java.net.URLClassLoader.access$100(URLClassLoader.java:74)

[debug] [W3C] at java.net.URLClassLoader$1.run(URLClassLoader.java:369)

[debug] [W3C] at java.net.URLClassLoader$1.run(URLClassLoader.java:363)

[debug] [W3C] at java.security.AccessController.doPrivileged(Native Method)

[debug] [W3C] at java.net.URLClassLoader.findClass(URLClassLoader.java:362)

[debug] [W3C] at java.lang.ClassLoader.loadClass(ClassLoader.java:418)

[debug] [W3C] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)

[debug] [W3C] at java.lang.ClassLoader.loadClass(ClassLoader.java:351)

[debug] [W3C] at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:495)

[debug] [W3C]

[debug] [W3C] at ADB.checkApkCert (/usr/local/lib/node_modules/appium/node_modules/_appium-adb@8.8.1@appium-adb/lib/tools/apk-signing.js:267:11)

[debug] [W3C] Destroying socket connection

[HTTP] ← POST /wd/hub/session 500 1454 ms - 3273

[quote=“sue, post:1, topic:7447”]
uiautomator2
[/quote]解决方案,更新安卓sdk的build-tool到最新版本即可解决问题