Nativescript emulator installation headaches - android

I've been trying to get emulators to work for NativeScript on my brand new clean Windows 10 laptop for three days and nothing is working.
To be more accurate, I think I was able to get the 'emulator-5554' to launch, but it doesn't not load the Groceries app.
I have all the Angular requirements installed since I also build Angular SPAs and they work fine. I read and followed all these articles, and I still can't get emulators to work.
I even installed GenyMotion, but it is not detected. I have not installed Android Studio since I'll be developing with Visual Studio Code, so I used the Android CLI to install the SDK.
https://docs.nativescript.org/start/general-requirements
https://docs.nativescript.org/start/introduction
https://docs.nativescript.org/start/cli-basics
https://docs.nativescript.org/tooling/android-virtual-devices?_ga=2.188319272.1221867054.1547512018-618552819.1547075699
https://docs.nativescript.org/start/quick-setup
https://docs.nativescript.org/start/ns-setup-win - this was my primary emulator setup
I have also read many SO posts and none have solved my problem.
Is there some documentation somewhere that is simple and clear, with step by step instructions on how to get emulators installed that will work with Nativescript? What am I missing?
BTW, when I connect my Samsung Galaxy S8 Active phone to my laptop, it's not recognized by the tns device command either.
I can't believe it's this difficult to get emulators to work. I also can't believe that the Nativescript documentation has left this information out of their instructions.

This might not be the answer most are looking for, but this is what was wrong with my installation and this is how I fixed it:
I noticed that the docs all had $./advmanager [someArg] and I had to be sudo for commands to execute. So I ran sudo chown -R myUser:myUser /usr/local/android thus changing all owner:group permissions from root to myUser.
then I could run ./avdmanager create.... (full command below) without having to be superuser
restarted Nativescript Sidekick
I know this is kinda stupid, but I worked out that if the AVD was created as root, the Sidekick program running as myUser could not see and access it. This was confirmed when I ran avdmanager list avd as sudo and got a result, but after changing my files' ownership from root to myUser, nothing was listed from the same command.
I recreated my virtual devices (AVDs) as a normal user and Sidekick was able to see them.
edit: the actual line I ran to create the AVD (because I see a lot of variation in these):
$ ./avdmanager create avd --name Pixel -k "system-images;android-28;google_apis;x86" --device "pixel"?
The uppercase and lowercase "pixel"s come from one entry from the output of
$./avdmanager list
id: 17 or "pixel"
Name: Pixel
OEM : Google
---------
Do this "create" step for each device you want to emulate.

Install Android Studio and open it. Then (without starting a new project) click on:
Configure --> AVD Manager.
There you can create virtual devices, which will be recodnized by NativeScript Sidekick and its virtual device launcher.

Related

Device unauthorized after accepting RSA fingerprint

I have been trying to use my Nexus 5 as a debuggable device when working with Android Studio. I have used several different resources to get the device to display the RSA fingerprint (which I have accepted), but the device remains "unauthorized". I am currently running ubuntu 12.04 on a Dell XPS-13.
My desktop computer running Windows 7 has had no issues is instantly recognized and a valid debuggable device.
One issue I had just recognized after weeks of trying to get this to work is that in the AVD manager, under the Compatible column for this device when UNAUTHORIZED it says: No,minSDK(API8) > deviceSDK(API 1). I wonder if this could be related as the device is currently up to date.
Here are some of the things I have tried:
Updated 51-android.rules document with the following line, made executable:
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee2", MODE="0666", GROUP="john"
Series of adb kill/start-server commands
Accepted the RSA fingerprint in one single instance and permanently, deleted the key/re-accepted it.
Checked permissions of usb slot.
Changed device from media device to camera and back (this actually sometimes lets the "adb devices" command return a value of device for the phone, but then the abd process locks and crashes).
I haven't really seen anyone with the issue where they were able to accept the RSA fingerprint but the device remains unauthorized, or that the AVD manager reports deviceSDK(API 1).
Any help is greatly appreciated, thanks!
Edit: It should be noted that I'm a bit of a linux noob so keep that in mind.
I have also experienced this problem after upgrading from an earlier version of Android Studio to the latest 1.0 release.
My phone was in the "Unauthorized" state and the compatible column said
"No, minSdk(API18) > deviceSdk(API1)"
I fixed my issue with the following steps:
Firstly, when I upgraded Android Studio I inadvertently moved the SDK directory.
To make sure your SDK folder and environment variables match up, open the command prompt and run the following command:
echo %ANDROID_SDK_HOME%
If your SDK is in a different location correct the environment variable using the command:
setx ANDROID_SDK_HOME "C:\Android\sdk"
Now we know the SDK is pointing to the correct place at the command prompt navigate to the "sdk\platform-tools" directory and issue the commands
adb devices
adb kill-server
Notice in the image my device in the "unauthorized" state.
Now on the phone itself navigate to the developer options page and select "Revoke USB debugging authorization".
Now head back over to Android Studio and select "Run -> Run app" menu option.
Now, when you attempt to run your application your phone should pop up with the following dialog:
When you see this you should be home and dry. Now when you start adb it should be authorized.
Finally, if you are upgrading Android Studio from a beta make sure that your target SDK and minimum SDK are set correctly. Right-click on the app folder and select "Open Module Settings".
Hope this helps..

Installing AOSP on nexus 7 (Wifi)

I am stuck flashing android to my nexus 7.
Steps to build image:
branch: refs/tags/android-4.4.2_r1
lunch : aosp_flo-userdebug
What i´ve done so far after building the image:
Like descibed in docs:
http://source.android.com/source/building-running.html
sudo fastboot flashall -w -p /home/stefan/bin/out/target/product/flo/
Gives me the following error:
could not load android-info.txt: No such file or directory.
So no luck with that, tried searching google but didnt find anything.
Downloaded an official rom 4.4.2 (KOT49H) from the nexus driver page:
https://developers.google.com/android/nexus/drivers
Deleted everything in the update package (zip) and putted my files in.
Then did sudo sh flash-all.sh
This method do flash the rom onto the device, but it also wont boot.
It hangs on the google splash screen.....
Is there anybody who can tell me how to properly flash my AOSP rom to device?
Your number 2 definitely will not work, and you shouldn't bother going down that route.
So the first issue you might have is you may be trying to build the wrong image, there are two Nexus 7s. Grouper is the designation for the first generation Nexus 7 and Flo is the designation of the 2013 Nexus 7, so make sure you have those right.
The second issue you may be having is the build may be failing. Are you sure that your make completed successfully? Your final message should say something similiar to
Install system fs image: out/target/blah/blah/blah/system.img
If you didn't see a line like that your build failed in which case you should diagnose that.
The third issue is you may be pointing at the wrong file. The line you are giving expects a full package, and you may not have created one. Try doing this instead:
sudo su
. build/envsetup.sh
lunch aosp_flo-userdebug
fastboot flashall -w
This will look for the generated files from the build automatically without you having to point at them, so long as you have selected the proper lunch option. Another issue you may be having is you may be confusing your shell with sudo, I am guessing you haven't bothered setting up the proper USB Permissions (see configuring USB access on the AOSP Build Guide. If you don't want to bother setting up USB permissions, then just initialize your environment as the super user after you have built when you need to flash (not before, or all your files will belong to root!)

AVD Manager, why can't I create an AVD?

For some reason, I cannot create an AVD. I went through AVD Manager - Cannot Create Android Virtual Device and attempted the solutions, and I also fiddled with the different settings in the manager, including changing the name to Device. I made sure that the system images are installed, and I followed the instructions for using the Intel Atom. Why is the OK greyed out?
I even ran the AVD Manager from eclipse, from the exe, and from monitor.bat
For reference, I did install the Atom's image:
For some reason, running the AVD via command line worked, but I couldn't check Use Host GPU. Thanks to Rusher who got this from https://stackoverflow.com/a/22213144/1896169 . See Running Your App | Android Developers for instructions on running via command line:
From the command line, change directories to <sdk>/tools/ and execute:
android avd
In other words, typing this into command line should work:
cd whateverThePathToYourSDKIs/tools/
android avd
You can only use either Snapshot or Host GPU.
Snapshot or Host GPU they can not be used simultaneously.
now try to start avd from avd manager.

Cordova run android is taking forever to install app on device

Ok, I have created and run various Cordova apps in the past, but since the last 2 weeks I have more and more issues with getting any app to install on my device. I have an LGE975 (LG Optimus G) phone, and there are already 5 Cordova apps installed on it.
Sometimes if I just try it 20 times it will work. Today however I have tried to run apps I don't know how many times, but they just won't install, and no error is thrown.
What I've tried so far:
Reinstalling Cordova
Upgrading cordova from 3.1.0-0.1.0 to -0.2.0
Downgrading back to -0.1.0
Rebooting device
Rebooting pc
Running app on platform "android" via command "cmd" /c C:\CordovaProjects\HelloW
orld\platforms\android\cordova\run --device
Buildfile: C:\CordovaProjects\HelloWorld\platforms\android\build.xml
What is it doing during the installation on device? The verbose output of Cordova isn't showing much of where it could go wrong. Also no error is thrown.
Is there anything I can do to fix this?
As suggested in the comment aboive i just runned:
platforms\android\cordova\run --device
and it worked!
It must be a bug or something.
I had the same problem, but it worked when I launched the process from an Administrator command prompt.
(On windows 7, Start -> Search Programs and Files -> type "cmd" -> Right-click on CMD -> Run as Administrator -> run phonegap command)
This is sort of a 'duh' answer, but maybe its an android version update that was applied to your device (phone) and the OS is now slowing things down?
Or, maybe your device is really full on storage space, and you should free up some space to speed things up :)

android problems sending app to emulator from using terminal

I have launched an emulator with a:
android avd
(although the android developers site said do it from platform-tools, i did it from tools because the android command was there ,and not in platform-tools). Anyway the AVD manager appeared and I started one, and it launched just fine.
Then I tried to send my app to the emulator so (following the android developers instructions) I do a:
adb install /newApp.apk
the command prompt jumps to the next line and just blinks.....when i check the emulator nothing has changed...where am i going wrong???
Once you have started the emulator try
adb devices
to check if you can see it
List of devices attached
emulator-5554 device
then you can proceed with the install
adb install <path-to>/newApp.apk
Something looks strange about that path. If the apk is in the same directory you are launching the command from then you don't need that '/'. If this is a linux machine it would be './' for the same directory unless your apk is all the way up on root but that would be bad :)

Categories

Resources