Ubuntu16下NativeScript安卓虚拟设备无法访问/未授权问题求助
Hey there, let's work through this NativeScript issue you're hitting on Ubuntu 16. You mentioned you've got the AVD running, developer options and USB debug enabled, but tns doctor is throwing errors—let's break down the fixes step by step.
tns doctor Issues with NativeScript & Android Virtual Device on Ubuntu 16 First off, your truncated tns doctor hint mentions iOS limitations (which makes sense, since you're on Ubuntu), but the actual problem is almost certainly related to Android SDK configuration or AVD detection. Here's how to fix it:
1. Verify Android SDK Environment Variables
NativeScript relies on correct environment variables to find your Android SDK. Let's make sure these are set properly:
- Open your shell config file (use
~/.zshrcif you use Zsh instead of Bash):nano ~/.bashrc - Add these lines (replace the
ANDROID_HOMEpath with your actual SDK location—usually~/Android/Sdkor/opt/android-sdk):export ANDROID_HOME=~/Android/Sdk export PATH=$PATH:$ANDROID_HOME/tools export PATH=$PATH:$ANDROID_HOME/platform-tools export PATH=$PATH:$ANDROID_HOME/emulator - Save and refresh the config:
source ~/.bashrc - Confirm the variables work:
You should see your SDK path printed out.echo $ANDROID_HOME
2. Ensure ADB Recognizes Your Virtual Device
Even if your AVD launches, adb might not be picking it up. Check with:
adb devices
If you see your emulator listed (something like emulator-5554), you're good. If not, restart the adb service:
adb kill-server adb start-server
Then re-launch your AVD and run adb devices again to confirm.
3. Re-Run tns doctor & Fix Remaining Issues
Now run the doctor command again:
tns doctor
If there are still specific errors (like missing SDK components), follow the prompts to install what's needed. For Ubuntu 16, we recommend sticking with API 29 or newer stable SDK versions for better compatibility.
4. Extra Fixes If Above Steps Fail
- Use x86/x86_64 AVDs: NativeScript has poor support for ARM-based emulators, so switch to an x86/x86_64 system image when creating your AVD.
- Install 32-bit dependencies: Ubuntu 16's 64-bit system needs these for Android tools:
sudo apt-get install lib32stdc++6 lib32z1
内容的提问来源于stack exchange,提问作者Raphael Hippe

