Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

native-run doesn't walk symlinks in SDK packages, thus cannot detect API levels #305

Open
pencilcheck opened this issue Apr 16, 2023 · 0 comments
Labels

Comments

@pencilcheck
Copy link

pencilcheck commented Apr 16, 2023

Version:

1.7.2

Description:

Native-run can't find the installed API levels in my SDK when it is perfectly fine in Android studio.

And as a bonus, I dig through the source code, turns out it is walking through every folders and find package.xml to find api-level string in them
https://github.com/ionic-team/native-run/blob/88a49944427f1bd4a33e6f53d511f9c49330ebe6/src/android/utils/sdk/index.ts

In here, it uses readdirp to list directories to walk through, but the walk is missing folders such as platforms, sources, system-images and those folders are all symlinked (due to how android studio does things).

This is very annoying, definitely a bug.

Command Output:

  native-run:android:utils:sdk:resolveSDKRoot Looking for $ANDROID_HOME +0ms
  native-run:android:utils:sdk:resolveSDKRoot Looking for $ANDROID_SDK_ROOT +2ms
  native-run:android:utils:sdk:resolveSDKRoot Using $ANDROID_SDK_ROOT at /usr/local/Cellar/android-sdk/24 +2ms
  native-run:android:utils:sdk:resolveEmulatorHome Looking for $ANDROID_EMULATOR_HOME +0ms
  native-run:android:utils:sdk:resolveEmulatorHome Looking at $HOME/.android +1ms
  native-run:android:utils:sdk:resolveEmulatorHome Using $HOME/.android/ at /Users/penn/.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 /Users/penn/.android/avd +1ms
  native-run:android:utils:sdk:findAllSDKPackages Walking /usr/local/Cellar/android-sdk/24 to discover SDK packages +0ms
  native-run:android:utils:sdk:getSDKPackage Parsing /usr/local/Cellar/android-sdk/24/emulator/package.xml +0ms
  native-run:android:utils:sdk:getSDKPackage Parsing /usr/local/Cellar/android-sdk/24/platform-tools/package.xml +0ms
  native-run:android:utils:sdk:getSDKPackage Parsing /usr/local/Cellar/android-sdk/24/tools/package.xml +0ms
  native-run:android:utils:sdk:getSDKPackage Parsing /usr/local/Cellar/android-sdk/24/build-tools/30.0.2/package.xml +0ms
  native-run:android:utils:sdk:getSDKPackage Parsing /usr/local/Cellar/android-sdk/24/build-tools/34.0.0-rc3/package.xml +0ms
  native-run:android:utils:sdk:getSDKPackage Parsing /usr/local/Cellar/android-sdk/24/cmdline-tools/latest/package.xml +0ms
  native-run:android:utils:sdk:getSDKPackage Parsing /usr/local/Cellar/android-sdk/24/patcher/v4/package.xml +0ms
  native-run:android:utils:sdk:api:getAPILevels Discovered installed API Levels: [] +0ms
SDK Location:         /usr/local/Cellar/android-sdk/24
AVD Home:             /Users/pencilcheck/.android/avd


Tools:

Android Emulator  emulator  32.1.12
Android SDK Build-Tools 30.0.2  build-tools;30.0.2  30.0.2
Android SDK Build-Tools 34-rc3  build-tools;34.0.0-rc3  34.0.0
Android SDK Command-line Tools (latest)  cmdline-tools;latest  9.0
Android SDK Platform-Tools  platform-tools  34.0.1
Android SDK Tools  tools  26.1.1
SDK Patch Applier v4  patcher;v4  1

SDK Info:

  native-run:android:utils:sdk:resolveSDKRoot Looking for $ANDROID_HOME +0ms
  native-run:android:utils:sdk:resolveSDKRoot Looking for $ANDROID_SDK_ROOT +2ms
  native-run:android:utils:sdk:resolveSDKRoot Using $ANDROID_SDK_ROOT at /usr/local/Cellar/android-sdk/24 +2ms
  native-run:android:utils:sdk:resolveEmulatorHome Looking for $ANDROID_EMULATOR_HOME +0ms
  native-run:android:utils:sdk:resolveEmulatorHome Looking at $HOME/.android +1ms
  native-run:android:utils:sdk:resolveEmulatorHome Using $HOME/.android/ at /Users/penn/.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 /Users/penn/.android/avd +1ms
  native-run:android:utils:sdk:findAllSDKPackages Walking /usr/local/Cellar/android-sdk/24 to discover SDK packages +0ms
  native-run:android:utils:sdk:getSDKPackage Parsing /usr/local/Cellar/android-sdk/24/emulator/package.xml +0ms
  native-run:android:utils:sdk:getSDKPackage Parsing /usr/local/Cellar/android-sdk/24/platform-tools/package.xml +0ms
  native-run:android:utils:sdk:getSDKPackage Parsing /usr/local/Cellar/android-sdk/24/tools/package.xml +0ms
  native-run:android:utils:sdk:getSDKPackage Parsing /usr/local/Cellar/android-sdk/24/build-tools/30.0.2/package.xml +0ms
  native-run:android:utils:sdk:getSDKPackage Parsing /usr/local/Cellar/android-sdk/24/build-tools/34.0.0-rc3/package.xml +0ms
  native-run:android:utils:sdk:getSDKPackage Parsing /usr/local/Cellar/android-sdk/24/cmdline-tools/latest/package.xml +0ms
  native-run:android:utils:sdk:getSDKPackage Parsing /usr/local/Cellar/android-sdk/24/patcher/v4/package.xml +0ms
  native-run:android:utils:sdk:api:getAPILevels Discovered installed API Levels: [] +0ms
SDK Location:         /usr/local/Cellar/android-sdk/24
AVD Home:             /Users/pencilcheck/.android/avd


Tools:

Android Emulator  emulator  32.1.12
Android SDK Build-Tools 30.0.2  build-tools;30.0.2  30.0.2
Android SDK Build-Tools 34-rc3  build-tools;34.0.0-rc3  34.0.0
Android SDK Command-line Tools (latest)  cmdline-tools;latest  9.0
Android SDK Platform-Tools  platform-tools  34.0.1
Android SDK Tools  tools  26.1.1
SDK Patch Applier v4  patcher;v4  1
@pencilcheck pencilcheck changed the title native-run is using outdated ways to find api-levels in SDK packages native-run doesn't handle symlinks in SDK, thus missing critical information Apr 16, 2023
@pencilcheck pencilcheck changed the title native-run doesn't handle symlinks in SDK, thus missing critical information native-run doesn't walk symlinks in SDK packages, thus cannot detect API levels Apr 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant