'Titanium.API.INFO' is not displaying in console - android

I am using Windows 7.
but Ti.API.INFO not displaying in console. I changed log level also but still its not display in console can some one help how to show info..
Android device is working fine but not displaying INFO in it also.
and emulator is not launching also.
Ti.API.info('splash function run');

Maybe you can find your answer in this post
Now, my 2 cents, sometimes there is a problem running the emulator when you have your phone plugged at the same time. You could try unplugging your device first.
But perhaps, debugging with the emulator isn't what you want. I recommend to start the ddms tool. And use a query to search what you need, like one of these: tag:ti, tag:tia, tag:tiapi
In order to do that, open a terminal and go to your android sdk folder, cd tools, and run ddms command. You can find where is your android sdk folder looking into Titanium Studio -> Preferences -> Studio -> Platforms -> Android.
Edit
Another option is to run titanium commands from a terminal pointing to your project folder:
cd "path/to/your/project/folder"
# in case of using the emulator
ti build -p android
# in case of using your device
ti build -p android -T device

Android device does not show console on titanium for seeing the result on android one possible solution could be alert that results
alert('I am alert');
Thanks

Related

How to use Android Studio with WSL (bash) as your shell Terminal?

Is it possible to use Android Studio and configure Windows Subsystem for Linux as a Terminal? I really don't like to work with Windows cmd.exe, but when I try to switch to bash.exe, which seems to work, it cannot build the project because there are missing e.g. Android/sdk/build-tools/27.0.3/aidl'.
This file is there, but it is with .exe suffix as it was downloaded for Windows. Any workaround to use *unix like bash for Terminal in Android Studio while being on Windows 10?
Yes, it is possible. I'm doing it right now. I have an Ubuntu app as WSL and figured out that it's accessible at C:\Windows\System32\bash.exe
So, open Android Studio and navigate to File -> Settings -> Tools -> Terminal. There fill Shell paht with C:\Windows\System32\bash.exe and voilà!
Now, when you open a new terminal it will use the WSL you have installed in your machine.
I'm using Android Studio 4.0.1.
I'm setting this up right now and hit your question from Google looking for advice. So with that caveat, let me explain what I did to get it running and if you have follow up questions we may need to experiment together to find the answers.
First, I installed VcXserv: https://sourceforge.net/projects/vcxsrv/. This X Server for windows allows you to run graphical linux applications in WSL. You'll just need to export the display variable in your ~/.bashrc since that isn't done normally in WSL:
$ echo "export DISPLAY=:0" >> ~/.bashrc
Then you have to run XLaunch from the start menu. It takes you through the config dialogs (just choose the defaults) and it puts an icon in the notification area you can check to make sure it's running.
Then, you want to download the Linux version of Android Studio 3.1. Extract it into the WSL filesystem somewhere (I used ~/apps). Then from your bash shell you can run android-studio/bin/studio.sh and the window will appear and begin the unboxing dialogs.
This is as far as I've gotten, right now it's downloading the SDK. I still am not sure how adb over usb is going to work or tested the emulator. I'll update this if I learn more.
Update unfortunately, VcXserv is crashing when the main Android Studio window launches. I'm going to file a bug report on it and try some other X servers if I have time later.

ERROR Android emulator gets killed in Android Studio

After updating to Android Studio 2 when I try to run my application and choose an emulator, I wait for the emulator to start and it suddenly gets killed. I can see the emulator process for some minutes but never the GUI. In Android studio, I get the error
android studio Error while waiting for the device: The emulator process for AVD was killed
This happens even if I run the emulator outside Android Studio. I have tried both an Android 6 and an Android 4.4-based emulator.
Running on a Windows 7 x64 PC. Similar post to another StackOverflow post which was closed. I have tried various ram, VM heap, and resolution settings.
I hit this issue trying to run Android API 30. In the end, I had to upgrade Android Emulator to 30.1.5 (it was 30.1.2 before this).
I had the same issue, the problem was there is not enough space in my disk drive.. you can see details about your specific situation in layer 'Event Log' this layer regularly is at the bottom on Android studio, it was my output Log:
"02:45 PM Emulator: emulator: ERROR: Not enough space to create userdata partition. Available: 3310.363281 MB at /home/user/.android/avd/my_Nexus_5X_API_27.avd, need 7372.800000 MB."
I had just 7 GB free, so just delete some GB's in my D.D. and it's working fine.
For me it seems it was a problem that OpenGL didn't work on my machine. I fixed it as follows:
Go to: Tools > Android > AVD Manager
Press the "edit" (pencil) icon next to your AVD
Change "Graphics" to "Software".
Check the free space of the emulator installation drive is more than 5 GB
Install the Intel x86 Emulator Accelerator worked for me.
This worked for me:
Tools -> SDK Manager -> SDK Tools (tab) -> Deselect 'Android Emulator' -> OK
Now, when you try to run your app, or launch device from AVD Manager, it will give the 'Install Emulator' error -> Click Ok.
This will automatically download the correct version.
For Android Studio v4.1 and above:
Menu -> Android Studio -> Preferences -> Tools -> Emulator
Uncheck Launch in a tool window option.
This issue happens when you have two Android SDK installations on your machine and the environment variable "ANDROID_HOME" points to the wrong location.
To fix it go to Android Studio settings, find the proper Android SDK location, update the environment variable and restart Android Studio / your PC.
I resolved the same issue by updating the Android Emulator.
Steps:
1. In Android Studio Go to TOOLS
2. SDK Manager
3. Android SDK
4. SDK Tools
5. Update the Android Emulator.
Then it will Run.
Check this for reference https://stackoverflow.com/a/64384372/13952516
Faced a similar issue, tried the above solutions as well and it didn't work.
Would like to suggest a simple solution which could help if the above suggestions didn't address the issue.
Solution - Try cleaning up space in the system. My problem was I had only 1GB left while trying to launch the emulator after cleaning up space got 8GB and was able to launch the emulator.
In android studio version 4.0 (WINDOWS), I could find the solution by just checking android studio welcome screen and clicking on the "Events" dropdown AFTER trying to launch the emulator (hence after getting the error):
the events section clearly shows that ANDROID_SDK_ROOT was not set in my system.
In a nutshell, whenever you see such error when starting the emulator, just check the "events" section in the welcome to android studio screen to find the real problem.
Beware that if ANDROID_HOME is not set properly, it will still tell you that ANDROID_SDK_ROOT is broken.
In my case, after installing the Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019 (both x86 and x64 version), the issue is solved.
But wait! Why did I know this? I will tell you my experience.
When your program meets a bug, the first thing you need to do is finding the log to debug. But where is the log file that records all the events of the Android emulator? Click Help→Show log in Explorer. And then a new window is oepned, where a file called idea.log is located, and that log file is what we are looking for.
But this file may has recorded too much verbose info, so let's do following processes to get a more simple one:
·Exit Android Studio
·Delete the idea.log
·Open Android Studio
·Click Tools→ AVD Manerger
·Start one of emulators you have created, and needless to say, the error will occur again. But the idea.log will be created and the error is recorded into the log file now!
·Exit Android Studio.
·Open the idea.log and begin to analyze it.
·Search "emulator", and in my case there are 2 messages catching my eyes:
INFO - manager.EmulatorProcessHandler - Emulator: E:\cache\SDK\emulator\emulator.exe -netdelay none -netspeed full -avd Nexus_5_API_22
INFO - manager.EmulatorProcessHandler - Emulator: Process finished with exit code -1073741515 (0xC0000135)
Obviously, the "exit code 1073741515" is something important, and actually many people have asked what it means in StackOverFlow, but unfortunately, I can't find any useful info about it. So let's pass it and focus on the first message.
Open the command line (Press "Win"+"R" → Enter "CMD" → Click "OK"), copy the above message E:\cache\SDK\emulator\emulator.exe -netdelay none -netspeed full -avd Nexus_5_API_22
and paste it to the command line. Press Enter.
I totally didn't know what this command meaned, but it's reasonable to deduce that Android Studio ran this command and resulted in the error, so I will try to reproduce the issue.
After that, an error window pop up, saying "...VCRUNTIME140_1.dll is missing...". I know I have been close to the answer. So I serch "VCRUNTIME140_1.dll Missing" on google, and people said that "downloading and installing both the x86 and x64 versions of the Microsoft Visual C++ 2015 - 2019 Redistributable will resolve this problem".
So I download both the x86 and x64 version and install them. After doing this, I run the emulator again, and everything goes well.
You need to update the following tools.
Please check your free space on your disk also. I had a same problem and finally I got I need to free up space to fix this.
If you're on the Apple Silicon (M1) chip, make sure you're using an ARM64-based emulator:
If you're not, create a new Virtual Device and use the arm64-v8a image from Other images.
Go to: Tools > Android > AVD Manager and Press the "edit" (pencil)
icon next to your AVD , Change "Graphics" to "Software".
work on my Windows 10 machine and ubuntu 18.04
If your username is not in ascii/ has spaces then this may help, as I tried all of the solutions here and couldn't fix this problem:
Note: I found this solution on this video, suggested by a user called "tatachka", this is her comment (she kindly let me share it here).
For example, I had this path
c:\Users\Таня.android\avd\Nexus_One_API_24.avd My name in Windows is
Таня, written in Cyrillic in windows encoding (cp1251). I changed the
path to e:\Distribu\AVD.android\avd\Nexus_One_API_24.avd I moved
files from disk C there and edited Nexus_One_API_24.ini changing the
path in it and everything worked.
How to change the folder path: My computer -> properties -> advanced
system parameters -> environment variables - > lower 'New...' button:
variable name: ANDROID_SDK_HOME variable value: e:\Distribu\AVD
(in my case)
After the reboot, a new folder(.android) appears in the folder
e:\Distribu\AVD containing the 'avd' folder
EDIT: For clarification, the idea here is that you don't want the path to have non-ascii characters. I moved it to C:\programs_that_cant_read_hebrew (and preformed the other steps) and it worked just fine.
EDIT: changed "English" to "ascii/ spaces" after the comments
I get this same error if you upgrade the emulator to version 30+ and run mac < 10.15
You see the real error if you run it from commandline
~/Library/Android/sdk/emulator/emulator -avd <name>
emulator: Android emulator version 30.5.3.0 (build_id 7196367) (CL:N/A)
dyld: Library not loaded: /System/Library/Frameworks/IOUSBHost.framework/Versions/A/IOUSBHost
You can fix this to upgrade to Big Sur or downgrade the emulator with these steps.
wget https://dl.google.com/android/repository/emulator-darwin-6885378.zip
unzip emulator-darwin-5395263.zip
mv ~/Library/Android/sdk/emulator ~/Library/Android/sdk/previous-emulator
mv emulator ~/Library/Android/sdk/emulator
cp ~/Library/Android/sdk/previous-emulator/package.xml ~/Library/Android/sdk/emulator/package.xml
Check if it succeed:
cd ~
~/Library/Android/sdk/emulator/emulator -version
28.0.25.0
~/Library/Android/sdk/emulator/emulator -list-avds
Source https://groups.google.com/g/flutter-dev/c/uEthfwjZBAQ/m/HSFqTgYsAgAJ
Edited April 8th 2021: I updated the emulator link to a newer version as mentioned in the comments
My case was: GOOGLE PLAY.
My virtual device was Pixel 4...
As shown on pic, Pixel4 has Google Play support, so that it give this error: " The emulator process for AVD Pixel4 was killed."
It gives error on Android Studio 4.1.1.
So that, I created a new virtual device(Pixel 4XL) and selected "SOFTWARE" for emulated performance...
Because this device doesnt have Google Play support, it worked for me.
Simple solution 2021
Go to AVD Manager
Find the emulator you are trying to use and then click on the down arrow
Select the option Show on Disk
delete every file that ends with .lock
Runs again the emulator and after this will initialize
goto tools>android>sdkmanager and update emulator and install related API level.It worked for me
This was working for me. You must update to android studio to latest version and then follow step below to update sdk tool:
Tools -> SDK Managers
Select Android SDK
Tab on SDK Tools
Check to update options available.
Press ok button
After that this procedure will take you some minutes, after it completed, everything will works fine.
I know so many people have given answers to this question many have valid points as well.
I have tried all the above possible ways, but it was not working, after reading logs from the android studio, I came to know it was a storage issue, for the emulator keep 11 GB space free and it will work.
Despite the question has been asked specifically for Windows, I will give my answer for MacOS 11.4 Big Sur, since this thread is the first hit on google when searching for this issue, and none of the answers already given solved the problem for me.
I found the solution to my problem here - for retention reasons, i will repeat the detailed steps anyway:
open Terminal and go to the directory /Users/<username>/Library/Android/sdk/emulator/qemu/darwin-x86_64/
create an xml file named entitlements.xml with the following content:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.hypervisor</key>
<true/>
</dict>
</plist>
resign the emulator
codesign -s - --entitlements entitlements.xml --force qemu-system-x86_64
start the simulator
For me it was a problem of available space left in my computer and deleting unnecessary files solved the problem. Causes are vary from situations and you should see event tab which detailed event log are showed.
To summarize the above:
Install and reinstall HAXM 7.5.6 (only available version) under 'Android SDK' settings. Try downloading it manually, even other versions (they don't work with Android SDK), installing it from the Android/Sdk folder, etc. sc query intelhaxm in cmd should show if it is running correctly.
Virtualization is enabled in your BIOS and has been tested
Made sure the PATH variables are correct (ANDROID_HOME / ANDROID_SDK_ROOT) but NOT (ANDROID_SDK_HOME) to the folder in your settings per Here. Otherwise, you will see EVENTS on the Android Studio splash screen.
Try unchecking / rechecking Launch in a tool window in Emulator settings (and even Enable Device Frame in AVD settings)
Try rebuilding in several different combinations of android, different phones, etc (but with same levels and packages ... 30 for example)
Try Rebooting in several different configurations
Make sure all SDK Tools are up-to-date, and even try a fresh install of Android Studio. However, tried removing all of them, and adding them back.
Check your space, try to have 25GB maybe or more free
Check for Virtual Box, Antivirus Software, etc.
Open Android Studio with Administrator privileges
RUNNING ON DUAL MONITORS / DOCKING STATION ?
A) Run the emulator with everything unplugged, then plug back in your monitor! (Odd I know)... OR Better yet...
B) Create a New Hardware Profile, which will enable you to change Graphics: Automatic to Software.
In Android Studio Go to Help -> Show logs in explorer
Try to run the Emulator again of the errors are as below :
handleCpuAcceleration: feature check for hvf
cannot add library vulkan-1.dll: failed
cannot add library vulkan-1.dll: failed
Then install Microsoft VS Code and go to below path
C:\Users<User>\AppData\Local\Programs\Microsoft VS Code
Copy the vulkan-1.dll and paste in below path
C:\Users<User>\AppData\Local\Android\emulator\lib64
For me this solutions worked
For me, just deleting ANDROID_SDK_HOME from the environment variable list solved the problem
I tried every single answer in here but none of them worked, but finally I got it working when I run it on an emulator device with Android API 28. I think the problem is the emulator device couldn't run Android API 30.
I think this is problem of Android studio 2 Update or Problem to solve please Update also Android sdk version also then work properly.

'Visual Studio Emulator for Android' devices are not listed in the Android Device Monitor

I can start the VS Emulator devices just fine, but they simply don't show up in ADB/Android studio.
I searched and found a similar SO question (same issue, only I installed the standalone emulator) but OP provided a workaround and I would like to know how to actually fix it so it shows up every time as intended instead of having to connect it manually (and as per SO etiquette didn't want to ask there in the comments).
I also found a "solution" in a Microsoft FAQ post which instructs you to edit a registry key under
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Android SDK Tools
but the 'Android SDK Tools' is nowhere to be found under 'Wow6432Node' in my registry, which could very well be the cause of the problem to begin with. I'm not sure if it's missing because of the Android Studio/SDK installation or something else, but for example Genymotion devices connect to ADB without any problems. (I always feel uneasy about adding anything to registry manually, but maybe I should add the 'PATH' myself?)
I installed everything just today on a fresh Windows 10 installation and didn't mess with anything in the registry myself.
Any help is appreciated. Thanks in advance!
I experienced this issue when i moved my android SDK (due to disc space reasons).
If you open regedit and go to the following registry entry:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Android SDK Tools
and edit the value Path to look at your new android sdk location it should work.
you may have to call:
adb kill-server
adb start-server
and relaunch your emulator again to get adb devices to see it but it should show up in the end
You may also need to restart your machine just to be safe
In my case I didn't have that entry in registry. But all you need to do is just create the key Android SDK Tools that entry under
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node
Then add the two keys as shown (right click -> New -> String Value). Add the correct path to your Android SDK. Here is what it should look like:
Once you add those entries
adb kill-server
adb start-server
Restart the Visual Studio Emulator for Android then run adb devices and hopefully it should just appear.
Copy Your ANDROID SDK PATH for me it look like this :
Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Android SDK Tools.
Note: if Android SDK Tools folder doesn't exist, Create it under WOW6432Node, And open it, And Create a String Value name it Path :)
Modify the Path registry variable to match the path to your Android SDK.
Restart the emulator and you should now be able to see the emulator connected to ADB and associated Android tools.
You can read this answers :
Nativescript project running with Visual Studio Emulator

Android Studio and android device monitor

I just switched from Eclipse to Android Studio. For what I saw since now the new IDE has a lot more features than Eclipse, and I like using the new IDE for my app development work.
I just can't understand one thing: in Eclipse, there is the very useful DDMS perspective, from where you read Logcat and do a lot of other things, like using the very useful dump view hierarchy function, which allows you to take a dump of the UI and inspect it to understand what is shown where in your layout.
I'm not seeing nothing similar in Android Studio, and after making a lot of research it seem that the only way you have to do this is opening the Android device monitor from the "Tools" menu.
But doing this way the ADB connection get broken, because it is being used by Android Studio, and Android Device Monitor wants to use it. The result is that if you are debugging your app you can't open android device monitor unless you want to lose your debug status.
I think this is not acceptable and I'm sure there must be some better way to use Android Device Monitor tools together with Android, is that possible?
Thank you
Actually I found a solution, I don't know if it is the best way (I keep thinking that android studio MUST integrate device monitor in a better way )
As stated in the question, starting device monitor from the menu tools causes android studio disconnect the device, but if you open the android studio's built in terminal (View > Tool Windows > terminal) and just type "monitor" it starts device monitor without detaching the device from android studio (you will get a warning on device monitor saying that there was a problem attaching the debugger, but don't care about that)
hope this will help some one
There are several ways you can find the DDMS tool using android studio. Eclipse is not needed for that as the tool is a separate program that comes with the android SDK.
Click on the Android Device Monitor Icon in the toolbar in Android Studio
Open the monitor.bat file (on a windows machine, this is located in [path-to-sdk]/sdk/tools)
Type monitor in the terminal in Android Studio or in any command prompt. (thanks SimonVeloper)
Open it via the tools menu. Tools->Android->Android Device Monitor (thanks sebweisgerber)
This will open the DDMS tool and will automatically connect to connected devices.
Normally you will be able to view your logcat output through this tool and not in android studio anymore. If this doesn't work for you make sure your devices is properly connected and restart the tool.
To open the Android device monitor simultaneously with Adb, Run the montior through the command prompt instead of visting to the Tools->Android->Android device monitor
To run via the Command line interface navigate to the :
Android/Sdk/tools/ and then run the monitor (for linux run -> sudo ./monitor)
Android studio ,Android device monitor opens but you cannot display Logcat or device another functionality,Just go to your android studio tools option tick Enable ADB integration then you can open other ADM screen.This worked for me.
I faced problem in android device monitor . I could not find file explorer menu , device list in android device monitor so i
deleted hidden *.android* folder in the home directory in linux using the following command:
`$ sudo -r ./android`
After deleting this hidden folder your android device monitor will be set to default state.

How to install an apk on the emulator in Android Studio?

How do you install an apk on the emulator in Android Studio from the terminal?
In Eclipse we did
/home/pcname/android-sdks/platform-tools/adb -s emulator-5554 install /home/pcname/Downloads/apkname.apk
Now how about in Android Studio?
Run simulator -> drag and drop yourApp.apk into simulator screen.
Thats all.
No commands.
EDIT: Even though this answer is marked as the correct answer (in 2013), currently, as answered by #user2511630 below, you can drag-n-drop apk files directly into the emulator to install them.
Original Answer:
You can install .apk files to emulator regardless of what you are using (Eclipse or Android Studio)
here's what I always do: (For full beginners)
1- Run the emulator, and wait until it's completely started.
2- Go to your sdk installation folder then go to platform-tools (you should see an executable called adb.exe)
3- create a new file and call it run.bat, edit the file with notepad and write CMD in it and save it.
4- copy your desired apk to the same folder
5- now open run.bat and write adb install "your_apk_file.apk"
6- wait until the installation is complete
7- voila your apk is installed to your emulator.
Note: to re-install the application if it already existe use adb install -r "your_apk_file.apk"
sorry for the detailed instruction as I said for full beginners
Hope this help.
Regards,
Tarek
For those using Mac and you get a command not found error, what you need to do is
type
./adb install "yourapk.apk"
Start your Emulator from Android Studio Tools->Android-> AVD Manager then select an emulator image and start it.
After emulator is started just drag and drop the APK Very simple.
Just drag APK file to android emulator it will install automatically.
In android studio emulator to run an apk file just drag the apk into the emulator.The emulator will install the apk
Much easier is just to start your emulator, then go to sdk/platform-tools and use adb from there to install apk. Like:
adb install xxx.apk
It will install it on running emulator.
Drag and drop apk if the emulator is launched from Android Studio. If the emulator is started from command line, drag and drop doesn't work, but #Tarek K. Ajaj instructions (above) work.
Note: Installed app won't automatically appear on the home screen, it is in the apps container - the dotted grid icon. It can be dragged from there to the home screen.
For Linux: once emulator is running, the following worked for me.
Because I installed the Android SDK on my home directory, I have the following file structure:
home/Android/Sdk/platform-tools/adb
home/AndroidStudioProjects/Metronome.adk
AndroidStudioProjects is a file folder I made for my Android projects. "Metronome.adk" is the file I want to run.
So, using Terminal from the home directory...
./Android/Sdk/platform-tools/adb install ./AndroidStudioProjects/Metronome.adk
Being a Linux novice, I often forget the need to put the "./" in when trying to locate a file or run a command.
After the command achieves "Success", the app is in the Apps area of the emulator and can be run.
When you start Android studio Look for Profile or Debug apk.
After clicking you get the option to browse for the saved apk and you will be able to later run it using emulator
If Android Studio is already open:
Click on File you can find Profile or Debug apk in this menu too
Just download the apk from talkback website
Drag the downloaded apk to the started emulator, Go to settings on emulator > Search for talkback, you will now find it there
1.Install Android studio.
2.Launch AVD Manager
3.Verify environment variable in set properly based on OS(.bash_profile in mac and environment Variable in windows)
4. launch emulator
5. verify via adb devices command.
6.use adb install apkFileName.apk
Upload your apk file on the cloud , then make a direct download link for downloading and then copy that link and paste it on the emulator browser for download it :) ;
In Android Studio: View - Tool Windows - Gradle
In the Gradle tool window navigate to your :app - Tasks - install
and then execute (by double-clicking): any of your install*tasks: e.g. installDebug, installRelease
Note: the apk will also automatically installed when you Run your application

Categories

Resources