Monthly Archives: January 2016

14 Common Errors Android App Developers Should Be Wary Of

In the second quarter of 2015, the share of Android in the global smartphone market rose to nearly 83%. Although iPhone is still the ‘rich man’s device’ and iPhone-users are more likely to spend money on applications (i.e., higher average revenue per user for developers) than their Android counterparts, the overwhelming dominance of Google’s mobile platform ensures that the TOTAL revenue it generates is higher, or at least close to, that by iOS. In fact, that is the reason why new app developers often prefer working on the Android platform first. Over here, we will do a roundup of some common errors and mistakes that any Android app developer might face while coding:

  1. Bugs in the emulator/device – The ADB, or Android Debug Bridge, handles all code interactions with actual devices and emulators (in Eclipse). The communication can break down at any time – and to rectify the problem, app makers have to click on ‘Window → Open Perspective →…’ and select the ‘DDMS Perspective’ option. After that, click on ‘Reset adb’ (from ‘View’), to restart the Debug Bridge. In case the problem persists, use the ‘adb kill-server’ and ‘adb start-server’ commands.
  2. Emulator does not start up – This is generally caused by a manual error. While coding for Android apps, if a developer makes a mistake (e.g., leaving an extra space) while writing out the path in which the SDK is present – the emulator would not be activated. Double check all the addresses and paths you have specified in your program. Looking for the error at the end in a long program can be frustrating.
  3. Android securityException error – Right from contacts and status of wifi connectivity, to SD card usage and web access – all permissions have to be declared separately in the application Manifest. Failure to do so will lead to the securityException Error being thrown up. Make sure you have followed the right Naming Conventions in your code as well (for all the IDs, variables, etc.).
  4. Problems with the LogCat – LogCat is one of the most useful features of the Android Studio (v.1.5.1 of the IDE was released in December). It allows mobile app developers to check all messages, errors and other exceptions from emulators and devices on a real-time basis. To activate LogCat, you need to browse to Window → Show View → Other →… Android → LogCat. At times, the LogCat can become unresponsive. To rectify matters, simply click on the ‘Restart’ tab. LogCat should be back to working fine.
  5. Version compatibility – Again, more of a developer error than a technical glitch. Testing new app prototypes on devices running on Android Lollipop is all very fine – but due attention has to be given for determining the backward compatibility of the application as well. There are two factors at work here: firstly, the extreme fragmentation in the rollout of Android versions makes it virtually impossible for developers to predict what version MOST or ALL of their targeted users are on; second, the Google Play Store accepts apps that are compatible with Android 2.2 Froyo. The more versions a new app is compatible with, the greater would be its downloads and overall user-base. Just because your application works like a charm on your own Android phone does not mean it will function properly on older devices as well.
  6. ActivityNotFoundException error – In the LogCat, this error can suddenly be generated – and the execution of your app will be halted immediately (or it might simply not start). The entire error message is ‘android.content:ActivityNotFoundException’, and it occurs when the AndroidManifest.xml file does not have all the explicit activities listed on it. Find out which activity(ies) you have not declared in the XML, and correct the error.
  7. Problems with @Override – Experts from the domain of the Android app development have identified the @Override annotation in Java as another probable cause for error. Problems occur when Java 1.6 is not selected as the working Java compiler level. Go to Properties → Java Compiler → Compiler Compliance Level, and set it to Java 1.6 – to get @Override functioning properly. Of course, you have the option of entirely deleting the annotation as well.
  8. StackOverflowError – If the Java code you have written for your Android app has multiple layouts, the StackOverflowError might rear its ugly head. The problem is also likely to occur when the app codes are infinitely recursive (making this both a Java and an Android problem). Whenever the layouts in the code go beyond the available program stack, this error message is thrown – and you will have to make the necessary corrections.
  9. Frequent crashes and freezes – Android Studio, according to most mobile app makers, is a more than worthy alternative to the Eclipse tool. However, the new IDE can crash suddenly and/or the display screen might freeze. If such problems start occurring rather frequently, you should uninstall the /Logs, /ApplicationSupport, /Caches and /Preferences folders from ‘Library’, delete the IDE next, and reinstall it (make sure that you have chosen the latest stable edition of Android Studio). Repeated crashes are clear signs that your existing IDE has become corrupt.
  10. Issues that require Project Cleaning – There are three common types of Android development errors, which can all be resolved by the ‘Clean Project’ option. If the ‘gen’ source folder cannot be opened, the file cannot be accessed/opened, or the project simply cannot be created (mainly due to path errors), click on Project → Clean (from the ‘Projects’ menu). If additional libraries are being used, they need to be cleaned as well. You might have to repeat the process a couple of times to flush out the errors completely.
  11. The ANR error – ANR stands for ‘Application Not Responding’, and this error freezes the entire UI thread, preventing Android app developers from doing any work. Large processes that overuse network functions are most susceptible to this error. Adding a doBackground() as an extension of AsyncTask (which performs additional tasks). If you can ensure that the methods declared in the main thread do minimal work, the ANR problem is not likely to crop up.
  12. Unresponsive Android editor – Bugs and glitches in Android Development Tools (ADT) are the most common cause for this. The Android editor (which should open automatically) can become unresponsive. In such cases, you have to follow the Right Click (on menu) → Open With → Android Menu → Editor method, to manually open the Android editor. However, if the problem persists you might have to delete and reinstall the IDE.
  13. Field references exceeding maximum limit – Those who are into making Android apps can face this problem at the time of compiling their code. The ‘too many build references’ message gets displayed in the build console whenever one bytecode file contains more than 65536 references (which is the method limit). Using a large number of external libraries (the Google Play Services library, for instance) leads to incremental addition of new classes – resulting in this problem. To get things running properly again, developers have to make certain changes in the app gradle file. Going for a multidex configuration is another way to counter this error.
  14. Inadequate storage in emulator – 64M is all the space you get in the Android Virtual Device (AVD). This opens up the risk of large applications not getting installed in the emulator, and the INSTALL_FAILED_INSUFFICIENT_STORAGE notification being displayed. You can either change the data partition system in the AVD or use the ‘Wipe user data’ option (after rebooting the emulator), to clean up space.

While creating Android applications, developers might face problems while trying to delete certain virtual devices as well. In Eclipse, timeout during app deployment is a fairly common issue, and it can be addressed by changing the default timeout settings in the IDE. Trying to enter the same fragment more than once also generates an error message (Binary XML file Duplicate ID). Even the best app developers can face these problems while working on the Android platform, and you should be aware of how to get rid of them quickly.

3D Touch On iPhone 6S – All That You Should Know

While IBM Simon – a handset launched in 1994 – would walk away with the title of first-ever touchscreen phone (it also had a stylus), the entire touch technology on smartphones was revolutionized by Apple. The first generation iPhone showcased how touchscreen could work on, what was at that time, a fairly large display. Since then, the company has constantly raised the bar. Last year, Apple Watch debuted with ‘Force Touch’ – a feature that allows the wearable to differentiate between two types of screen presses. With the latest iPhone 6S and iPhone 6S Plus, multi-touch technology has been bolstered further with 3D Touch – which, according to Phil Schiller, is among the ‘hardest things Apple has ever engineered’. In what follows, we will do a roundup of what 3D Touch is, and how it adds value to the iPhone 6S:

  1. Turning on 3D Touch – First things first: let’s activate 3D Touch on the iPhone. To do so, you have to tap on ‘General → Accessibility → 3D Touch’ (under ‘Settings’) on the device. The switch that gets displayed has to be toggled to ‘ON’, to turn on the 3D Touch feature.

Note: 3D Touch is activated by default on new iPhone 6S models. You need this tip in case you want to switch it off (why would anyone want to do that?) at any time.

2. How does 3D Touch work? - To put it simply, with the help of advanced capacitive sensors and strain gauges. The built-in ‘Taptic Engine’, which also helps in detecting phone vibrations as detected by the haptic technology, powers 3D Touch as well. Reports from users as well as iPhone app developers have confirmed that 3D Touch is significantly more responsive (read: faster) than Force Touch. Every time the screen of the handset is pressed, electronic signals are generated (due to the applied pressure). These are detected by the gauge sensors and the precise placement and degree of force is accurately matched. In all, 3D Touch can discern between three types of interactions – a long press (hold), a soft touch, and a tap.

3. Setting up the sensitivity level – This one is important. Unless a user correctly adjusts the sensitivity of 3D Touch, the technology might not function correctly, and there might be lags. Doing the adjustment is easy – you only have to select one from the ‘Light’, ‘Medium’ and ‘Firm’ options from the sensitivity slider (also present in ‘General → Accessibility → 3D Touch’). The pressure level you choose will determine the amount of force required to activate 3D Touch at any point.

4. Peek and Pop – Software analysts and mobile app development experts have hailed the breakthrough ‘Peek and Pop’ functionality that 3D Touch brings to the table. This is a dual interaction option for interacting with messages and web links on the iPhone 6S in a smarter way. Whenever you press on the link of a website lightly, you get a ‘Peek’ preview of the web page on Safari (remove your finger to get back to the earlier screen). For a full view of the website, simply long-press the link, and you will ‘Pop’ on to the page. The technology also works like a charm for quickly checking emails and messages.

Note: For short emails, a ‘peek’ preview is often sufficient. You can glance at the message without having to move away from your inbox.

5. Cursor on the screen! – Yep, that’s what 3D touch allows users to do – by converting their iPhone keypad into a fully functional trackpad. Just open any application, and do a firm press on the keypad. The keys will disappear and the area will transform into a smooth trackpad (and will turn grey), with a cursor on the display screen. This feature, understandably, adds a lot to the convenience level of users, while composing messages or reading documents on their devices (no more erroneous cursor placements by finger, so…yay!). In fact, many mobile app developers feel that this feature is the biggest highlight of 3D Touch on iPhone 6S.

6. Multitasking – 3D Touch brings in an entirely new way in which users can toggle between multiple applications they might be using simultaneously. Instead of going through the trouble of double-pressing on the ‘Home’ button (which performs roughly the same function), users can just do a long press on the left edge of the screen. The app switcher/multitasking view will appear (the edges of recently opened applications are displayed). Toggling among them is easy.

7. 3D Touch on third-party applications – That’s right, 3D Touch functionality is not limited to the pre-installed iPhone apps. Leading mobile app companies working on the iOS 9 platform have already started releasing third-party apps with 3D Touch support. The all-new touch technology opens up a myriad of new ways in which people can interact with apps, and the onus now lies with iPhone developers to make full use of it. With Live Photos integration (we will come to ‘Live Photos’ in a bit), image-based apps can offer a truly immersive, engaging experience.

8. Quick Actions – This is precisely what its name suggests – an extensive range of shortcuts, geared to make common iPhone tasks simpler and, of course, quicker. When an app icon is long-pressed, the rest of the screen frosts over, and a contextual menu for shortcuts (which is the ‘Quick Actions’ menu) appears. Selecting what you want to do from this menu is a breeze. Apart from the communication apps of Apple (Mail, Camera, Messages), Quick Actions is available for select external applications (e.g., Dropbox) as well. Right from checking messages and capturing selfies and videos, to viewing maps and browsing the contact list (a press on the Contacts icon brings up your favourite contacts) – a lot of things can be done with this feature. The left-swipe option to delete emails is also a Quick Actions feature.

Note: To delete an app, do not press down on the app icon (which would activate 3D Touch on it). Instead, simply tap on the icon (avoid using any pressure) – and then move or uninstall the app, as per your requirement.

9. Live Photos with 3D Touch – The Live Photos has been one of the best new features of iOS 9, and with 3D Touch – it gets even better. There is a large selection of dynamic wallpapers which can be used as the wallpaper on the Lock Screen of iPhone 6S (or use any of your personal Live Photos). However, the magic of 3D Touch surfaces when users actually press down on a Live Photo to make it, quite literally, ‘come alive’.

10. Force Touch vs 3D Touch – As already pointed out at the start, 3D Touch is faster – thanks to its cutting-edge sensors and strain gauges. Also, while Force Touch on Apple Watch can detect multiple presses on the display screen, 3D Touch can actually tell the differences in the degrees of pressure exerted at multiple points of the iPhone screen – thereby adding an extra layer of responsiveness. The force required to activate Force Touch on Watch is slightly more than that needed to trigger 3D Touch on iPhone 6S.

11. Drawings with the Notes app – The new multi-touch technology on iPhone 6S allows users to show off their creative side as well. On the built-in Notes application, thick lines can be drawn by long presses, while light taps create fine lines (comes in extremely handy while systematically depicting an idea on the go). Once again, iPhone app developers can use this feature to come up with an entirely new type of drawing apps.

12. Peek Zoom – How about pressing the iPhone screen to zoom in? 3D Touch lets users do that as well. Once the Zoom Controller is activated (a hard press does the trick), you only have to enable Peek Zoom, by tapping on ‘Settings → General → Accessibility → Peek Zoom’. Now, whenever the Zoom Controller is pressed, the whole screen zooms in. Remove the pressure, and the screen will zoom out back to normal.

13. Preview and launch videos – This is a classic example of the ‘Peek and Pop’ feature we discussed above. A light press on the video thumbnail displays a preview of the file (directly within the message in which it is located). A long press, on the other hand, launches the video on the iPhone screen. If someone sends you a video file, you can now catch a preview first, before actually playing it.

14. More engaging iOS games – For iOS game developers, 3D Touch opens up a whole new world of possibilities (some games at the App Store are ‘upgraded for 3D Touch’, but they do not quite make full use of the technology…yet). Practically all elements visible onscreen can be turned into game controls. For instance, in an iPhone racing game, a light press can make vehicles go at normal speeds, while a longer hold can accelerate them. Users will take some time to get used to 3D Touch-enabled games – but this is certainly something that will catch on pretty soon.

3D Touch, or the ‘next generation of multi-touch’ as the Cupertino company hails it to be, is currently available only on iPhone 6S/6S Plus. As newer iPhone models are released over the next few years (iPhone 7 is coming this fall), the technology will become more popular. It is also almost certain that 3D Touch will be present on the upgraded second-generation Apple Watch, which is set to arrive in mid-2016. It is a truly great feature, and it takes up the usability value of the latest flagship iPhone by several notches.