Improve parsing of adb errors
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- android, typescript
- 领域
- mobile-dev, tooling
调研方向
从 android/utils/adb.js 开始,尤其关注详细堆栈跟踪中显示的 installApk 入口点,并跟踪 adb 的安装输出如何变成报告的错误。完成的标准是显示具体的 INSTALL_FAILED_OLDER_SDK 消息,而不是仅显示 ERR_UNKNOWN;payload 不会指明测试文件。
由索引模型根据 Issue 内容生成。
描述
Version:
0.2.9
Description:
When installing an APK that requires a newer Android SDK version, an ERR_UNKNOWN error is displayed, but adb specifically displays an INSTALL_FAILED_OLDER_SDK error.
I've tried looking for the 'adb' source code in order to find a list of known errors, but I couldn't find anything, so I've created this issue in the hope that someone knows where those errors are listed so that we can improve the output in case of 'adb' errors.
Command Output:
native-run without --verbose
$ native-run android --app app-debug.apk
No hardware devices found, attempting emulator...
Selected emulator emulator-5554
Installing app-debug.apk...
ERR_UNKNOWN: Non-zero exit code from adb: 1
Default adb command output
$ adb install app-debug.apk
Performing Streamed Install
adb: failed to install app-debug.apk: Failure [INSTALL_FAILED_OLDER_SDK: Failed parse during installPackageLI: /data/app/vmdl2031034771.tmp/base.apk (at Binary XML file line #8): Requires newer sdk version #25 (current version is #24)]
Default adb command exit code
$ echo $?
1
native-run with --verbose
$ native-run android --app app-debug.apk --verbose
native-run:android:utils:sdk:resolveSDKRoot Looking for $ANDROID_HOME +0ms
native-run:android:utils:sdk:resolveSDKRoot Looking for $ANDROID_SDK_ROOT +1ms
native-run:android:utils:sdk:resolveSDKRoot Using $ANDROID_SDK_ROOT at /opt/Android/SDK +2ms
native-run:android:utils:sdk:resolveEmulatorHome Looking for $ANDROID_EMULATOR_HOME +0ms
native-run:android:utils:sdk:resolveEmulatorHome Looking at $HOME/.android +0ms
native-run:android:utils:sdk:resolveEmulatorHome Using $HOME/.android/ at /home/user/.android +0ms
native-run:android:utils:sdk:resolveAVDHome Looking for $ANDROID_AVD_HOME +0ms
native-run:android:utils:sdk:resolveAVDHome Looking at $HOME/.android/avd +0ms
native-run:android:utils:sdk:resolveAVDHome Using $HOME/.android/avd/ at /home/user/.android/avd +0ms
native-run:android:utils:sdk:getSDKPackage Parsing /opt/Android/SDK/platform-tools/package.xml +0ms
native-run:android:utils:adb:getDevices Invoking adb: '/opt/Android/SDK/platform-tools/adb' [ 'devices', '-l' ] +0ms
native-run:android:utils:adb:parseAdbDevices Parsing adb devices from output lines: [ 'List of devices attached',
native-run:android:utils:adb:parseAdbDevices 'emulator-5554 device product:sdk_google_phone_x86_64 model:Android_SDK_built_for_x86_64 device:generic_x86_64 transport_id:2',
native-run:android:utils:adb:parseAdbDevices '',
native-run:android:utils:adb:parseAdbDevices '' ] +0ms
native-run:android:utils:adb:getDeviceProperties Invoking adb: '/opt/Android/SDK/platform-tools/adb' [ '-s', 'emulator-5554', 'shell', 'getprop' ] +0ms
native-run:android:utils:adb:getDevices Found adb devices: [ { serial: 'emulator-5554',
native-run:android:utils:adb:getDevices state: 'device',
native-run:android:utils:adb:getDevices type: 'emulator',
native-run:android:utils:adb:getDevices connection: null,
native-run:android:utils:adb:getDevices properties:
native-run:android:utils:adb:getDevices { product: 'sdk_google_phone_x86_64',
native-run:android:utils:adb:getDevices model: 'Android_SDK_built_for_x86_64',
native-run:android:utils:adb:getDevices device: 'generic_x86_64',
native-run:android:utils:adb:getDevices transport_id: '2' },
native-run:android:utils:adb:getDevices manufacturer: 'unknown',
native-run:android:utils:adb:getDevices model: 'Android SDK built for x86_64',
native-run:android:utils:adb:getDevices product: 'sdk_google_phone_x86_64',
native-run:android:utils:adb:getDevices sdkVersion: '24' } ] +34ms
native-run:android:utils:avd:getAVDINIs Discovered AVD ini files: [ '/home/user/.android/avd/A10_-_Pixel_XL.ini',
native-run:android:utils:avd:getAVDINIs '/home/user/.android/avd/A7_-_Pixel_XL.ini' ] +0ms
No hardware devices found, attempting emulator...
native-run:android:utils:run:selectVirtualDevice Found running emulator: emulator-5554 +0ms
Selected emulator emulator-5554
native-run:android:utils:adb:getDeviceProperty Invoking adb: '/opt/Android/SDK/platform-tools/adb' [ '-s', 'emulator-5554', 'shell', 'getprop', 'dev.bootcomplete' ] +0ms
native-run:android:utils:adb:waitForBoot Device emulator-5554 is booted! +0ms
Installing app-debug.apk...
native-run:android:utils:adb:installApk Invoking adb: '/opt/Android/SDK/platform-tools/adb' [ '-s', 'emulator-5554', 'install', '-r', '-t', 'app-debug.apk' ] +0ms
native-run:android:utils:adb:installApk adb install: 'adb: failed to install app-debug.apk: Failure [INSTALL_FAILED_OLDER_SDK: Failed parse during installPackageLI: /data/app/vmdl1076703040.tmp/base.apk (at Binary XML file line #8): Requires newer sdk version #25 (current version is #24)]' +494ms
native-run Caught fatal error: { Error: Non-zero exit code from adb: 1
native-run at ChildProcess.p.on.code (/opt/node-global/lib/node_modules/native-run/dist/android/utils/adb.js:130:24)
native-run at ChildProcess.emit (events.js:198:13)
native-run at maybeClose (internal/child_process.js:982:16)
native-run at Socket.stream.socket.on (internal/child_process.js:389:11)
native-run at Socket.emit (events.js:198:13)
native-run at Pipe._handle.close (net.js:606:12) code: undefined, exitCode: 1, data: undefined } +0ms
ERR_UNKNOWN: Non-zero exit code from adb: 1
SDK Info:
$ native-run android --sdk-info
SDK Location: /opt/Android/SDK
AVD Home: /home/user/.android/avd
API Level: 29
Packages: Android SDK Platform 29 platforms;android-29 3
Google APIs Intel x86 Atom System Image system-images;android-29;google_apis;x86 8
Google Play Intel x86 Atom_64 System Image system-images;android-29;google_apis_playstore;x86_64 8
Sources for Android 29 sources;android-29 1
API Level: 25
Packages: Android SDK Platform 25 platforms;android-25 3
Google APIs Intel x86 Atom System Image system-images;android-25;google_apis;x86 16
Google APIs Intel x86 Atom_64 System Image system-images;android-25;google_apis;x86_64 16
Sources for Android 25 sources;android-25 1
API Level: 24
Packages: Android SDK Platform 24 platforms;android-24 2
Google APIs Intel x86 Atom System Image system-images;android-24;google_apis;x86 25
Google APIs Intel x86 Atom_64 System Image system-images;android-24;google_apis;x86_64 25
Sources for Android 24 sources;android-24 1
Tools:
Android Emulator emulator 29.2.1
Android SDK Build-Tools 29.0.2 build-tools;29.0.2 29.0.2
Android SDK Platform-Tools platform-tools 29.0.5
Android SDK Tools tools 26.1.1
SDK Patch Applier v4 patcher;v4 1
- 主要语言
- TypeScript
- 星标
- 141
- 派生
- 35
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
ionic-team/native-run 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
ionic-team/native-run#409 ·
-
难度 3/5 1-2 天 新手友好度 66/100
ionic-team/native-run#410 · 1 条评论 ·
-
tools not found?未关闭android
难度 4/5 3-5 天 新手友好度 25/100
ionic-team/native-run#395 ·
-
android
难度 3/5 1-2 天 新手友好度 28/100
ionic-team/native-run#390 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 38/100
ionic-team/native-run#389 ·
查看 ionic-team/native-run 的全部 Issue
相似的 Issue
-
check:passed streams:remove
难度 1/5 1 小时以内 新手友好度 67/100
维护者通常 1 天内回复
-
bug priority-p1
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 88/100
-
beginner blocked
难度 2/5 1-3 小时 新手友好度 82/100
hiero-ledger/hiero-sdk-js#4670 ·
维护者通常 1 天内回复
-
[Exploratory] Expense - 2 selected drop-down is shown twice when selecting hold from more option.未关闭Monthly Not a priority
难度 2/5 1-3 小时 新手友好度 65/100
Expensify/App#106080 · 1 条评论 ·
维护者通常 1 天内回复