I am attempting to learn to code via flutter (I'm a total noob) and I am having some troubles with my emulator when I am trying to test my code. I am using Visual Studio Code, and when i try to boot my emulator, the phone will appear but the screen is completely blank. the power button (on the emulator) is unresponsive and I get an error "emulator didn't respond in..."
I have literally been fighting with this for hours and I could really use a knowledgeable hand. Can anybody help me troubleshoot, by chance? I have searched here, but nothing matches exactly what I'm going through and I haven't been able to solve it yet.
errors with android emulator
My computer spec:
Processor Intel(R) Core(TM) i5-1035G7 CPU # 1.20GHz 1.50 GHz
Installed RAM 16.0 GB (15.7 GB usable)
Device ID 45818A1F-CFA5-4E12-AB9C-8192B75D2308
Product ID 00325-96713-52283-AAOEM
System type 64-bit operating system, x64-based processor
Pen and touch No pen or touch input is available for this display
Okay, so this probably seems obvious, but I seemed to struggle with this at the beginning since my course has me learning in VSCode, but I went into the android studio instead and I have deleted the old emulator and created a new one. It's taking a while to finish loading, but the screen is operating and I think my problems are likely solved.
So I guess no, I never figured out why it wasn't working, nor did I get it to work. but the end result is the same.
How long Do I have to wait for this emulator to start my first time. And I am so tired of waiting. I tried to change my RAM to 1024 it didn't work it gave me error and emulator fails now I am with RAM 512 . And now it is for a long time what can I DO? How long this going to take?!!
Emulator is always slower than a device it is good if you can find a device to use. Otherwise you will get bored happened to me. If you don't have a device stay till the emulator starts. I hope a new version of eclipse also would help a little to make emulator work faster. For me also for the first time it really took a considerable time.
Every time I run a project from ADT to test on a virtual Android device it takes 90+ seconds to upload and another 15+ seconds to "install" it on the device.
Why does it take so long?
Any timeouts I should watch out for? (The eclipse console stays silent.)
Note: project.apk size is about 5MB and computing resources on the development machine are plentiful (i.e. CPU usage is around 5-10%, disk queue length about 0.05 and couple gigs of free RAM available during the "upload" and "install").
Not really a solution, but a workaround was found in a similar question:
Slow uploads to running Android emulator
It appears, when the Android emulator is idle its network connection is capped at 2 Mbps
and when you wake it by clicking and swiping around the bandwidth magically increases to around 10 Mbps! (At least so on my fairly modern system.)
This obviously makes a difference for uploading largish apps to the emulator.
Solution:
Go to Run -> Run Configurations... -> Target Tab -> Additional Emulator Command Line Options. Add there:
-netspeed full -netdelay none
After doing this the time for uploading went from 2 minutes to 8 seconds.
Edit:
I have also found that quitting Skype makes my emulator upload much faster.
I have set up my DDMS to work with the emulator and display the processes running etc. but in the Dev Tools of my emulator it firstly wont let me tick the Show CPU Usage box, and secondly I do not seem to have an option to display the FPS which apparently, according to sources on the internet, is possible to do.
Has anyone had this trouble and know how I can solve it and display CPU usage and FPS as my android game is running?
Thanks
To get an idea of what CPU speed your emulator is emulating try this:
1) start a shell session (adb shell),
2) then run "cat /proc/cpuinfo" to get the BogoMIPS.
Here’s more information on this.
What strategies can be used in general to decrease build times for any Xcode project? I'm mostly interested in Xcode specific strategies.
I'm doing iPhone development using Xcode, and my project is slowly getting bigger and bigger. I find the compile / link phases are starting to take more time than I'd like.
Currently, I'm:
Using Static Libraries to make it so
most of my code doesn't need to be
compiled everytime I clean and build
my main project
Have removed most resources from my
application, and test with a hard
coded file system path in the iPhone
simulator whenever possible so my
resources don't have to constantly be
packaged as I make changes to them.
I've noticed that the "Checking Dependencies" phase seems to take longer than I'd like. Any tips to decrease that as well would be appreciated!
Often, the largest thing you can do is to control your inclusion of header files.
Including "extra" header files in source code dramatically slows down the compilation. This also tends to increase the time required for dependency checking.
Also, using forward declaration instead of having headers include other headers can dramatically reduce the number of dependencies, and help all of your timings.
I wrote an extensive blog post about how I improved the iOS development cycle at Spotify:
Shaving off 50% waiting time from the iOS Edit-Build-Test cycle
It boiled down to:
1) Stop generating dSYM bundles.
2) Avoid compiling with -O4 if using Clang.
Personally I switched compiler to LLVM-Clang for my Mac development projects and have seen a dramatic decrease in build times. There's also the LLVM-GCC compiler but I'm not sure this would help with build times, still that's something you can try too if LLVM-Clang does not work for iPhone app compilation.
I'm not 100% sure LLVM is supported for development on the iPhone but I think I remember reading in a news feed that it is. That's not an optimization you can implement in your code but it's worth the try!
The number of threads Xcode will use to perform tasks defaults to the same number of cores your CPU has. For example, a Mac with an Intel Core i7 has two cores, so by default Xcode will use a maximum of two threads. Since compile times are often I/O-bound rather than CPU-bound, increasing the number of threads Xcode uses can provide a significant performance boost for compiles.
Try configuring Xcode to use 3, 4 or 8 threads and see which one provides the best performance for your use case.
You can set the number of processes Xcode uses from Terminal as follows:
defaults write com.apple.Xcode PBXNumberOfParallelBuildSubtasks 4
Please see Xcode User Defaults for more information.
If you're not using 8GB of RAM, upgrade now.
I just upgraded my macbook pro from 4GB to 8GB. My project build time went from 2:10 to 0:45. I was floored by the improvement. It also makes web browsing for research snappier and general Xcode performance when indexing, etc.
Easy answer: add another machine running Xcode on your local network. Xcode incorporates distcc to do distributed compiles. It can even use Bonjour to find other build hosts, which simplifies the process of configuring this greatly. For large builds, distributing can get you a speed increase that is nearly linearly proportional to the number of build machines (2 machines takes half the time, three takes a third and so on).
To see how to set this up, you can consult this development doc. It also features other useful build time improvement strategies, such as using precompiled headers and predictive builds.
Edit: Sadly, it appears Apple has removed this feature as of Xcode 4.3: http://lists.apple.com/archives/xcode-users/2012/Mar/msg00048.html
Xcode 5 has a server version which can do CI, but I doubt this will confer any benefit for ad hoc developer builds. However, there are some unannounced features that should dramatically speed up build times.
I used a script to make use of a RAM drive, together with some "forward declarations" optimizations my project clean build time went from 53 seconds to 20 seconds.
I was tempted to get the Gui on the AppStore, but opted rather to
go for command line. I put the script as part of git repository.
To see the build times, enter this in a terminal:
"defaults write com.apple.dt.Xcode ShowBuildOperationDuration YES"
Restart Xcode to notice the build times in the toolbar.
(this is my non clean build time using objective-c)
Adjust the script to your liking. - Note the script clears
the derived data folder.
#!/bin/sh
#2 GIG RAM
GIGA_BYTES=$((2*1024*1024*1024))
# a sector is 512 bytes
NUMSECTORS=$((${GIGA_BYTES}/512))
#ram disk
mydev=`hdiutil attach -nomount ram://$NUMSECTORS`
newfs_hfs $mydev
# make mount point
MOUNT_POINT=/Users/your_user_name/Library/Developer/Xcode/DerivedData
# *******************************************
# ** WARNING - MOUNT POINT WILL BE DELETED **
# *******************************************
rm -rf ${MOUNT_POINT}
mkdir -p ${MOUNT_POINT}
# mount
mount -t hfs $mydev ${MOUNT_POINT}
echo unmount $(MOUNT_POINT)
To see the effect and to control the RAM Drive:
mount - see mount points
umount mount_point - unmount point
diskutil list - see disks
diskutil eject /dev/diskX - eject the disk
df -ahl - see free space
NOTE:
I essentially use the hdiutil provided by macOs.
I tried switching the -kernel option (no swapping to disk) on but failed on my machine, saying it is not implemented.
Maybe the new OS coming soon we will see even more improvements as the new file system copy feature is really fast, and possibly makes this script redundant.
One huge tip to halve compile times (for iOS projects at least) is to set Build Settings / Architectures / Build Active Architecture Only to YES.
What this does (especially with the advent of 64-bit iPads/64-bit compiler) is to not build the binary for the architectures you're not currently using.
Make sure you remember to re-enable this setting on submission to the app store, or your binary will not validate.
You mentioned using static libs for your most-often used files to prevent compilation. You can accomplish something similar by putting headers to your code that it's frequently used but not in your static libs in the precompiled header. At least they'll only be compiled once.
Care must be taken to avoid issues if you have multiple compilation types across your project (e.g. Obj-C, Obj-C++, C++).
Hey there, I would recommend you to optimize your project's physical structure. There's some good reading about this ( at least in the C++ world ) , but I do objective-C and the same principles often apply.
Here's a great article about project's physical structure optimization, which tends to improve compile times
Games From Within: Physical Structure Part 1
Good luck :)
one word: TmpDisk
Use TmpDisk to Create a 1.5Gb RAM disk
Change Xcode > Preferences > Location > Derived Data to /Volumes/1.5Gb/xcode data
Enjoy the speed!
Quick Note Regarding 'Throw more hardware at it' approach..
SUMMARY: I experienced a SMALL speed increase from making a SIGNIFICANT hardware upgrade
Test: Build/Run the exact same project on cloned macbooks (where the only difference should be their hardware)
Old Macbook Air (1.86GHZ Core 2 Duo ONLY 2GB RAM)
vs
Brand New Macbook Pro (2.3GHZ Core i7 8GB RAM)
BUILDING ON IPHONE 3GS
Macbook Air 1:00 - 1:15
Macbook Pro ~1:00
=> 0 to 0:15 of speed increase
BUILDING ON IPHONE 4S
Macbook Pro ~0:35
Macbook Air ~0:50
=> ~15 seconds of speed increase **Partially tested: There DOES apear to a significant difference between build times for the SIMULATOR between the 2 machines
In my continued experience.. you WILL get a significant increase when making big changes in PHONE hardware (i.e. build time on a 3GS vs iphone 5 (or 4 for that matter)).. at least in my experience, the limiting factor was the phone hardware (not the computer hardware).
SO.. to get the fastest build time.. option1) write code and run in the simulater on a fast computer OR option 2) build on the device with the lastest iphone
If your whole project gets rebuilt every time you hit run, that's probably the bug in XCode 7.0 <= 8.1 giving you a hard time.
Creating the user defined build setting HEADERMAP_USES_VFS to YES cut the macbook compile time from 75 seconds each time, to 25 seconds. See Xcode 8 does full project rebuild for more info.
I switched to Hackintosh with a 5960x CPU, overclocked to 4.4GHz only to bring down Xcode compile time. That's 8 cores and 16 threads. Total cost $3000 for a computer that crushes all macs. However I've spent at least 10 days getting it set up, first with Yosemite, the. I had six months downtime when I couldn't update macOS while Xcode required a newer os. I just got it running sierra and life is good again.
My 2,8 GHz i7 double core 16 GB RAM MacBook Pro compiles my project in 75 seconds, the Hackintosh in 20 seconds. (Swift, dlib, opencv c++ in the project)
However the biggest problem is Xcode doesn't seem to use multiple threads when compiling swift. This is the bottleneck, I hope they will fix it soon.