Titanium Alloy with Android Emulator on Windows 10 - windows

I'm having huge problems with Titanium Alloy on Windows 10. I am using the Atom editor to write my apps. Whenever I execute ti build, enter the command up to 10(!!!) times until an Android device can be found.
For the Android emulator I get an error message as follows:
[Error] Failed to install apk on "emulator-5554"
[Error] Error: device not found
I tried the commands ti build -p android, ti build -p android -T emulator and ti build -p android -T emulator -C emulator-5554 --log-level info. I also tried starting the emulator manually from avd.exe. I deleted the AVD and created a new one, too
When a device (USB debugging enabled) is connected, i tried ti build -p android -T device and ti build -p android -T device -C XT1032, where XT1032 is the name of the device. I get an error message as follows:
[ERROR] Unable to find any devices
I didn't try so far if the device will be found after some more tries.
When executing the commands, I tried all 4 combinations:
emulator off, device disconnected
emulator off, device connected
emulator on, device disconnected
emulator on, device connected
I uninstalled Titanium, Android SDK, NodeJS and Java and deleted all folders of them. I removed all registry entries, too. Then I installed everything again, Titanium at last. Same problem.
I am using Java 32 bit (v8.0.1020.14), NodeJS v4.2.6 (also tried v6.3.0, but v4.2.x is recommend), Android SDK (SDK Tools v25.1.7, SDK Platform-tools 24.0.1 and SDK Build-tools 21.1.2. I also tried SDK Build-tools 24.0.1, but 21.x.x is recommend) and Titanium (SDK v6.0.0.v20160719180254, CLIv5.0.9).
I modified my environment variables as follows:
PATH:
C:\android-sdk\tools;C:\android-sdk\platform-tools;C:\android-sdk\ndk-bundle;C:\Program Files (x86)\Java\jdk<version>\bin
JAVA_HOME:
C:\Program Files (x86)\Java\jdk<version>
ANDROID_SDK_HOME:
C:\android-sdk
I had to set ANDROID_SDK_HOME and C:\android-sdk\ndk-bundle, otherwise the NDK and the AVDs wouldn't be found by ti setup check.
Here is a screenshot of ti setup check: link to image
I don't know why https://www.google.com is unreachable. Furthermore, Intel HAXM is installed. I even reinstalled it without success. The previous installation of Titanium could find it...
Thanks for your help!
TLDNR: my Titanium Alloy installation has problems finding devices. It only works from time to time without any obvious pattern

The process terminates after building the APK file. If the emulator is running, it is possible to manually install the APK. Use this command in the Command Line:
<Android SDK folder>\platform-tools\adb.exe -s emulator-5554 install -r -d <project path>\<project folder>\build\android\bin\<project name>.apk
The project name is equal to the project folder name. After installing the APK, the application can be started manually in the emulator.
Nonetheless, there are still a lot of issues when developping on Windows 10... I think this forces me to switch to a MAC.

Related

How can I launch Android Emulator without android studio on Mac M1

I'm trying to start the emulator with this command emulator -avd Pixel_4_API_30 but it gives me an error:
[8633370112]:ERROR:android/android-emu/android/qt/qt_setup.cpp:28:Qt library not found at ../emulator/lib64/qt/lib
Could not launch '/Users/primulax/../emulator/qemu/darwin-x86_64/qemu-system-aarch64': No such file or directory
Android Studio specs:
Build #AI-203.7717.56.2031.7935034, built on November 21, 2021
Runtime version: 11.0.10+0-b96-7249189 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 12.2
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 8
Registry: external.system.auto.import.disabled=true
Non-Bundled Plugins: org.jetbrains.kotlin
✅ I was able to run with ~/Library/Android/sdk/emulator/emulator -avd Pixel_4_API_30 with this command
Use ~/Library/Android/sdk/emulator/emulator instead of ~/Library/Android/sdk/tools/emulator on MacOS, for Ubuntu use ~/Android/Sdk/emulator/emulator.
I just experienced the same issue on a freshly setup machine, emulator installed through SDK manager and all.
The error message says it all actually: If you go to /Users/primulax/../emulator/qemu/ on your machine, you'll notice that of course there is no darwin-x86_64 directory, but darwin_aarch64, since you are on an M1 machine. Whatever the reason is the emulator looks in the wrong directory, if you just duplicate the darwin_aarch64 folder and name your copy darwin-x86_64, it works as intended. Not ideal, but it's a workaround until this path-problem is fixed.
Edit: Please take a look at #Andrew Stromme's comment. Of course symlinking is a much more elegant solution to this problem!
If you have Android Studio installed, you can run the emulator from terminal without having started Android Studio first.
First of all, run
cd ~/Android/Sdk/tools && ./emulator -list-avds
to get a list of all the available Android virtual devices that you have installed.
Then, copy the name of the virtual device you want to use and run
cd ~/Android/Sdk/tools && ./emulator -avd YOUR_DEVICE_NAME
where you replace "YOUR_DEVICE_NAME" with the name of a virtual device that was listed in the installed virtual devices list.
This info and more that you may find useful can be found in the official documentation.
Now for the error you get it's most possibly due to a wrong file path. It seems that others have also faced this issue and a bug has been opened before here. The most common solution proposed is to launch emulator from the
/path/to/android-sdk/tools
directory in command line.
Also, before trying this or any other solution listed in this issue tracker, firstly make sure that you have installed from the SDK Manager the Android Emulator in SDK Tools.

NativeScript Installation Issues

I was just trying to install NavtiveScript, for this I followed the official installation guide available at
http://docs.nativescript.org/angular/start/quick-setup but I am stuck at "Step 3: Install iOS and Android requirements"
When I run the below command in Command Prompt (with administrative privileges)
#powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://www.nativescript.org/setup/win'))"
Everything seems to be installed without any issue. But when I try to verify the installation through command, "tns doctor" I returns below warnings:
D:\>tns doctor
WARNING: adb from the Android SDK is not installed or is not configured properly.
For Android-related operations, the NativeScript CLI will use a built-in version of adb.
To avoid possible issues with the native Android emulator, Genymotion or connected
Android devices, verify that you have installed the latest Android SDK and
its dependencies as described in http://developer.android.com/sdk/index.html#Requirements
TIP: To avoid setting up the necessary environment variables, you can use the chocolatey package manager to install the Android SDK and its dependencies.
WARNING: The Android SDK is not installed or is not configured properly.
You will not be able to build your projects for Android and run them in the native emulator.
To be able to build for Android and run apps in the native emulator, verify that you have
installed the latest Android SDK and its dependencies as described in http://developer.android.com/sdk/index.html#Requirements
TIP: To avoid setting up the necessary environment variables, you can use the chocolatey package manager to install the Android SDK and its dependencies.
NOTE: You can develop for iOS only on Mac OS X systems.
To be able to work with iOS devices and projects, you need Mac OS X Mavericks or later.
Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK 22 or later.
Run $ android to manage your Android SDK versions.
You need to have the Android SDK Build-tools installed on your system. You can install any version in the following range: '>=23 <=24'.
Run android from your command-line to install required Android Build Tools.
You need to have Android SDK 22 or later and the latest Android Support Repository installed on your system.
Run $ android to manage the Android Support Repository.
Can anyone please guide?
I am using Windows 10, and have Visual Studio 2015 (update 3) and Visual Studio Code installed on my machine.
The command line of installing Android also didn't work for me and gave me the same errors as you. I figured out this by downloading and installing Android Studio. After your installation, you should be able to find the location of the android sdk, which is /Users/myMacUserName/Library/Android/sdk in my situation. And you could select all the needed things through SDK Manager. In the terminal, you then do 'export ANDROID_HOME=/Users/myMacUserName/Library/Android/sdk' instead of the command from NativeScript installtion instruction 'export ANDROID_HOME=/usr/local/opt/android-sdk'. After all these, you should be okay with the Android SDK errors.
https://developer.android.com/studio/index.html
Install the android studio from the above link and then after that run the studio and install the desired android sdk packages from within the studio.

React-Native running on Android device from AppleOS, no udev directory

The instructions for how to run a react-native project on an android device is located at: https://facebook.github.io/react-native/docs/running-on-device-android.html
After determining your USB device, the instructions state to do the following command:
echo SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", MODE="0666", GROUP="plugdev" |
sudo tee /etc/udev/rules.d/51-android-usb.rules
The problem is that there is not a /etc/udev directory on my Mac. So obviously this fails.
Apparently MacOS doesn't support udev.
So how do I get this to work? If I ignore the udev part and use the command react-native run-android then it wants to run on an emulator. I experimented with --variant and just adding the values from adb devices, but no success.
--edit--
I should note that adb devices works fine, so does lsusb. The phone prompted to trust the computer, so I know that debugging is setup correctly. Just trying to figure out how to tell react-native to launch the app on the device (instead of an emulator).

Nativescript - error on tns run android

I'm trying to run android emulator with the command tns run android. This starts the emulator but it keeps stuck on Android logo and I get the following error:
(...)
BUILD SUCCESSFUL
Total time: 17.013 secs
Project successfully built.
Using C:\(...)\sample-Groceries\platforms\android\build\outputs\apk\sampleGroceries-debug.apk
Starting Android emulator with image Nexus6
Waiting for emulator device initialization..............
Cannot run your app in the native emulator. Increase the timeout of the operation with the --timeout option or try to restart your adb
server with 'adb kill-server' command. Alternatively, run the Android
Virtual Device manager and increase the allocated RAM for the virtual
device.
(...)
Here is my Android Virtual Device configured:
AVD Manager
Note: I can run the application on my phone anyway, but not on my PC.
Finally I found the problem.
In Android Virtual Device Manager, there was an error I didn't see:
AVD Manager error
Here is a solution which I found to be useful.
enter image description here
You just have to manually activate the emulator, which you can do using android studio or command line. Using the command line, you have to run this command
emulator -avd avd_name [ {-option [value]} … ]
for ex:
/Android/sdk/emulator/emulator -avd test
Once the emulator starts you can run this command
tns run android
I started having similar issue after updating to the latest Android Studio and latest emulators. I switched the VM Heap to 64, and it worked for me. May be worth giving that a try.
Open your Android Virtual Device Manager and download the latest
emulator. That will fix the error.
I had the same problem. I fixed that by:
Open emulator manually from Android Studio (double-click on position in AVD Manager list)
Run tns run android
Works for macOS Sierra.

sqlite in the xamarin android player

I have clicked on Tools -> Android -> Android Device Monitor in VS 2015 and got the following error, but my xamarin android player works fine.
Is there a way to access to local database (sqlite) in the xamarin android player simulator not on the physical device?
Update:
I am using adb and getting the following error
Failed to load the JNI shared library "C:/XXXXX/jvm.dll"`.
This is a sign of a mixed 32/64 Java bit Java install and/or the wrong version is installed.
Xamarin on Windows requires a Windows x86 version of v1.7
It is essential to install the 32-bit version of the Java JDK even if you're using 64-bit Windows. It is also important that v1.7 of the Java JDK is installed (although it is fine to have 1.8 or newer installed at the same time).
So I would start by installing Java v1.7, since the error is pointing to v1.6 and retrying to open the Android Device Monitor.
Installing the Java SDK (JDK)
The JDK can be downloaded from any browser by visiting Oracle’s website and browsing to the section with the heading Java SE Development Kit 7u79
Ref: https://developer.xamarin.com/guides/android/getting_started/installation/windows/manual_installation/#Installing_the_Java_SDK_JDK
Solution 1:
I run tools->android-> android adb command prompt in visual studio
I have followed the followings to access the database
step1. >adb shell
step2. >cd data/data
step3. >ls -l|grep "com.xxxx"
step4. >cd "com.xxxx"
Then I used the following to copy sql file to my workstation
adb shell "run-as com.xxxx chmod 666 /data/data/com.xxxx/files"
adb pull /data/data/com.xxxx/files/xx.sql
adb shell "run-as com.xxxx chmod 600 /data/data/com.xxxx/files"
Then I have downloaded sqlite browser to open the file and see the tables.
Solution 2:
Alternatively, you can go to following directory and double click the exe file
C:\Users\XXXXX\AppData\Local\Android\ANDROI~1\tools\lib\monitor-x86_64\monitor.exe

Resources