Appium 运行脚本时提示:Exception in thread "main" brut.androlib.AndrolibException: Could not decode arsc file,求解决,非常感谢

ellaw · 2014年12月10日 · 最后由 qixnGitHub 回复于 2016年12月26日 · 2782 次阅读

Starting Node Server
info: Welcome to Appium v1.2.4 (REV 71584425ecf777349e3215f0f18e71e7782acfb6)
info: Appium REST http interface listener started on 127.0.0.1:4723
info: [debug] Non-default server args: {"address":"127.0.0.1","logNoColors":true,"platformName":"Android","platformVersion":"18","automationName":"Appium"}
info: Console LogLevel: debug
info: [37m-->[39m [37mPOST[39m [37m/wd/hub/session[39m [90m{"desiredCapabilities":{"app":"C:\Users\**\workspace\appiumtraining\apps\BiliPlayer.apk","appPackage":"tv.danmaku.bili","appActivity":".LancherActivity","platformVersion":"4.4","platformName":"Android","deviceName":"emulator-5554"}}[39m
info: [debug] Using local app from desired caps: C:\Users*
\workspace\appiumtraining\apps\BiliPlayer.apk
info: [debug] Creating new appium session f651a9b4-8034-4a6e-86c2-8ac90966236b
info: Starting android appium
info: [debug] Using fast reset? true
info: [debug] Preparing device for session
info: [debug] Checking whether app is actually present
info: [debug] Checking whether adb is present
info: [debug] Using adb from C:\Users*
\android-sdks\platform-tools\adb.exe
info: Retrieving device
info: [debug] Trying to find a connected android device
info: [debug] Getting connected devices...
info: [debug] executing: "C:\Users*
\android-sdks\platform-tools\adb.exe" devices
info: [debug] 1 device(s) connected
info: Found device emulator-5554
info: [debug] Setting device id to emulator-5554
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing: "C:\Users*
\android-sdks\platform-tools\adb.exe" -s emulator-5554 wait-for-device
info: [debug] executing: "C:\Users*
\android-sdks\platform-tools\adb.exe" -s emulator-5554 shell "echo 'ready'"
info: [debug] Starting logcat capture
info: [debug] Getting device API level
info: [debug] executing: "C:\Users*
\android-sdks\platform-tools\adb.exe" -s emulator-5554 shell "getprop ro.build.version.sdk"
info: [debug] Device is at API Level 19
info: Device API level is: 19
info: [debug] executing: "C:\Users*
\android-sdks\platform-tools\adb.exe" -s emulator-5554 shell "getprop persist.sys.language"
info: [debug] Current device language: en
info: [debug] java -jar "C:\Program Files\Appium\node_modules\appium\node_modules\appium-adb\jars\appium_apk_tools.jar" "stringsFromApk" "C:\Users*
\workspace\appiumtraining\apps\BiliPlayer.apk" "C:\Windows\Temp\tv.danmaku.bili" en
info: [debug] No strings.xml for language 'en', getting default strings.xml
info: [debug] java -jar "C:\Program Files\Appium\node_modules\appium\node_modules\appium-adb\jars\appium_apk_tools.jar" "stringsFromApk" "C:\Users*
*\workspace\appiumtraining\apps\BiliPlayer.apk" "C:\Windows\Temp\tv.danmaku.bili"
warn: Error getting strings.xml from apk
info: [debug] Exception in thread "main" brut.androlib.AndrolibException: Could not decode arsc file
at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:54)
at brut.androlib.res.AndrolibResources.getResPackagesFromApk(AndrolibResources.java:540)
at brut.androlib.res.AndrolibResources.loadMainPkg(AndrolibResources.java:76)
at brut.androlib.res.AndrolibResources.getResTable(AndrolibResources.java:68)
at io.appium.apktools.StringsXML.run(StringsXML.java:84)
at io.appium.apktools.Main.main(Main.java:31)
Caused by: java.io.IOException: Expected: 0x001c0001, got: 0x00000000
at brut.util.ExtDataInput.skipCheckInt(ExtDataInput.java:48)
at brut.androlib.res.decoder.StringBlock.read(StringBlock.java:43)
at brut.androlib.res.decoder.ARSCDecoder.readPackage(ARSCDecoder.java:100)
at brut.androlib.res.decoder.ARSCDecoder.readTable(ARSCDecoder.java:81)
at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:49)
... 5 more

info: [debug] executing: "C:\Users*\android-sdks\platform-tools\adb.exe" -s emulator-5554 shell "echo '{}' > /data/local/tmp/strings.json"
info: [debug] Checking whether aapt is present
info: [debug] Using aapt from C:\Users*
\android-sdks\build-tools\21.1.1\aapt.exe
info: [debug] processFromManifest: "C:\Users*\android-sdks\build-tools\21.1.1\aapt.exe" dump xmltree "C:\Users*\workspace\appiumtraining\apps\BiliPlayer.apk" AndroidManifest.xml
info: [debug] Set app process to: tv.danmaku.bili
info: [debug] Not uninstalling app since server not started with --full-reset
info: [debug] Checking app cert for C:\Users*\workspace\appiumtraining\apps\BiliPlayer.apk: java -jar "C:\Program Files\Appium\node_modules\appium\node_modules\appium-adb\jars\verify.jar" "C:\Users*\workspace\appiumtraining\apps\BiliPlayer.apk"
info: [debug] App already signed.
info: [debug] Zip-aligning C:\Users*\workspace\appiumtraining\apps\BiliPlayer.apk
info: [debug] Checking whether zipalign is present
info: [debug] Using zipalign from C:\Users*
\android-sdks\build-tools\21.1.1\zipalign.exe
info: [debug] zipAlignApk: "C:\Users*\android-sdks\build-tools\21.1.1\zipalign.exe" -f 4 "C:\Users*\workspace\appiumtraining\apps\BiliPlayer.apk" "C:\Users*\AppData\Local\Temp\appium1141110-2008-1rrns0y.tmp"
info: [debug] MD5 for app is 6324a563d4dacd24c1ad91005c857e97
info: [debug] executing: "C:\Users*
\android-sdks\platform-tools\adb.exe" -s emulator-5554 shell "ls /data/local/tmp/6324a563d4dacd24c1ad91005c857e97.apk"
info: [debug] Getting install status for tv.danmaku.bili
info: [debug] Getting device API level
info: [debug] executing: "C:\Users*\android-sdks\platform-tools\adb.exe" -s emulator-5554 shell "getprop ro.build.version.sdk"
info: [debug] Device is at API Level 19
info: [debug] executing: "C:\Users*
\android-sdks\platform-tools\adb.exe" -s emulator-5554 shell "pm list packages -3 tv.danmaku.bili"
info: [debug] App is installed
info: App is already installed, resetting app
info: [debug] Running fast reset (stop and clear)
info: [debug] executing: "C:\Users*\android-sdks\platform-tools\adb.exe" -s emulator-5554 shell "am force-stop tv.danmaku.bili"
info: [debug] executing: "C:\Users*
\android-sdks\platform-tools\adb.exe" -s emulator-5554 shell "pm clear tv.danmaku.bili"
info: [debug] Forwarding system:4724 to device:4724
info: [debug] executing: "C:\Users*\android-sdks\platform-tools\adb.exe" -s emulator-5554 forward tcp:4724 tcp:4724
info: [debug] Pushing appium bootstrap to device...
info: [debug] executing: "C:\Users*
\android-sdks\platform-tools\adb.exe" -s emulator-5554 push "C:\Program Files\Appium\node_modules\appium\build\android_bootstrap\AppiumBootstrap.jar" /data/local/tmp/
info: [debug] Pushing settings apk to device...
info: [debug] executing: "C:\Users*\android-sdks\platform-tools\adb.exe" -s emulator-5554 install "C:\Program Files\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk"
info: [debug] Pushing unlock helper app to device...
info: [debug] executing: "C:\Users*
\android-sdks\platform-tools\adb.exe" -s emulator-5554 install "C:\Program Files\Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk"
info: Starting App
info: [debug] Attempting to kill all 'uiautomator' processes
info: [debug] Getting all processes with 'uiautomator'
info: [debug] executing: "C:\Users*\android-sdks\platform-tools\adb.exe" -s emulator-5554 shell "ps 'uiautomator'"
info: [debug] No matching processes found
info: [debug] Running bootstrap
info: [debug] spawning: C:\Users*
\android-sdks\platform-tools\adb.exe -s emulator-5554 shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap
info: [debug] [90m[UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1[39m
info: [debug] [90m[UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=[39m
info: [debug] [90m[UIAUTOMATOR STDOUT] io.appium.android.bootstrap.Bootstrap:[39m
info: [debug] [90m[UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner[39m
info: [debug] [90m[UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer[39m
info: [debug] [90m[UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap[39m
info: [debug] [90m[UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1[39m
info: [debug] [90m[UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 1[39m
info: [debug] [BOOTSTRAP] [debug] Socket opened on port 4724
info: [debug] [BOOTSTRAP] [debug] Appium Socket Server Ready
info: [debug] [BOOTSTRAP] [debug] Loading json...
info: [debug] [BOOTSTRAP] [debug] json loading complete.
info: [debug] Waking up device if it's not alive
info: [debug] Pushing command to appium work queue: ["wake",{}]
info: [debug] [BOOTSTRAP] [debug] Registered crash watchers.
info: [debug] [BOOTSTRAP] [debug] Client connected
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"wake","params":{}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: wake
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":true,"status":0}
info: [debug] executing: "C:\Users*\android-sdks\platform-tools\adb.exe" -s emulator-5554 shell "dumpsys window"
info: [debug] Writing dumpsys output to C:\Program Files\Appium\node_modules\appium.dumpsys.log
error: Unhandled error: Error: EPERM, operation not permitted 'C:\Program Files\Appium\node_modules\appium.dumpsys.log'
at Object.fs.openSync (fs.js:427:18)
at Object.fs.writeFileSync (fs.js:966:15)
at C:\Program Files\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:1480:8
at null. (C:\Program Files\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:172:9)
at ChildProcess.exithandler (child_process.js:635:7)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Process.ChildProcess._handle.onexit (child_process.js:810:5) context: [POST /wd/hub/session {"desiredCapabilities":{"app":"C:\Users\
*\workspace\appiumtraining\apps\BiliPlayer.apk","appPackage":"tv.danmaku.bili","appActivity":".LancherActivity","platformVersion":"4.4","platformName]

共收到 7 条回复 时间 点赞

虽然不知是啥,但是本着消灭零回复的原则,可以先看看 C:\Program Files\Appium\node_modules\appium.dumpsys.log 里面有啥

我也是一样的问题,部分 apk 出问题,有的就可以

这个问题已经把我搞崩溃了,求大神释义

#1 楼 @link1220 我也有同样的强迫症.

@ellaw @kidloving 你们都遇到过?

我看是 2 个 error. 先试试把安装目录放到没有空格的目录下试试.

@ellaw 请问你这个问题最后怎么解决的,我也遇到了,导致 APP 无法正常打开,出现 ANR

求问最后的解决办法?

我也出现了,appium 版本 1.4.16.1,将 jdk1.6 改成了 1.7 就好了

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册