Browsing the Android category

NativeScript Android publication reminder

You need to have a “strings.xml” file – it’s not made for you in the NativeScript command line.

In it, put the name of your app (as you want it to appear on the user’s phone).

Read the article

NativeScript Android process died and unfortunately stopped working

I received those errors in my NativeScript Android app; where at some points it “unfortunately stopped working” or in the CLI, it said the “process died”.

I re-created a brand new app and slowly copied/pasted pieces in.

I realized that it was my AndroidManifest.xml file that was wrong.

Specifically, I changed the application android:name  and  the activity android:name to something specific to my app (instead of “NativeScript”).   I think NativeScript uses that specific activity.

Don’t change the activity name nor the package name!  It’ll be updated for you when you “release” the app.

Read the article device unauthorized. This adb server’s $ADB_VENDOR_KEYS is not set Try ‘adb kill-server’ if that seems wrong.

I got the above error in Android Studio when trying to put my app on a real phone.

The solution: unplug and re-plug the phone back in.  There will be a prompt for “Always trust this computer?”  Check “yes” and then proceed.  I guess I somehow avoided that dialog box the first time I plugged it in.

Read the article

android cannot resolve method ‘startactivity(android.content.intent)’

I had a webview in Android and I was trying to have it open links in a new browser window. I was getting the error:

android cannot resolve method ‘startactivity(android.content.intent)’


The solution:

I added the part in bold:



View complete source code on GitHub

Read the article

Android Webview sample code

Modified slightly from my previous post on “Basic Android Studio webview example” – this removes the “bounce effect”, which I was able to turn off with:




Read the article

Do things right the first time

I used Adobe’s PhoneGap to make my initial apps – and it was great – but I got an email from Google, saying I had a vulnerable version of Apache Cordova.  Apple had emailed me about a year ago with a similar message (at the time, Google didn’t).  So I had to re-do my apps then (in PhoneGap).  Thinking this might happen again,  I decided to do it in Android Studio.  Lesson learned: don’t take shortcuts!

Here’s my new Android Studio template to display a basic website.  This accounts for NOT displaying the navigation/address bar.

Now, load the local file.

Android Studio: right click on “app” and hit “Show in Explorer”.  In the “app” folder – go to “src” then “main”.  You’ll see a folder for “java” and “res”.  Make a folder “assets”

Place all the HTML/CSS files in there.

Then when you load up the page, use:



I was using jQuery mobile, and there was an error.  I opened it up locally on my computer (Windows, using Chrome), and saw:

Uncaught SecurityError: Failed to execute ‘replaceState’ on ‘History’: A history state object with URL

Solution was found on  Stack Overflow .  Then I had another issue:

Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.

I guess the “real” solution would be to make the website on a remote server, but I didn’t want to do that.  Instead I just changed all my modals (that was apparently using Ajax to display content) into:

<a href=”” onClick=”window.location=’…'”>link</a>

Remember to move over the icons (“show in Explorer” for “mipmap” and place the icons – individually – in there, renaming where applicable).

The other downside from having to convert from PhoneGap to my own version was there’s no longer a splash screen. I previously wrote about it when you’re calling a remote page, but I’m sure there’s a better way for local files.

Read the article

Basic Android Studio webview example

This is (another) example of a basic Android Studio webview example.  It won’t show the navigation/address bar.

package com.diamondium.conjecture;

import android.os.Bundle;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class MainActivity extends Activity {

private WebView webview ;

protected void onCreate(Bundle savedInstanceState) {

webview =(WebView)findViewById(;

webview.setWebViewClient(new WebViewClient());
webview .getSettings().setJavaScriptEnabled(true);
webview .getSettings().setDomStorageEnabled(true);




<RelativeLayout xmlns:android=””

android:layout_alignParentEnd=”true” />



And in the manifest.xml file, add in:

<uses-permission android:name=”android.permission.INTERNET” />

As a child to manifest (I put it above “application”).

Read the article

I just switched from an Android to an iPhone

The first thing I wanted to do was set up my Contacts.  I had managed my contact in Gmail/Google Contacts.  I put people into “Groups” (labels).  I ignored the “My Contacts” (default label) and created two custom ones: “Show” and “Hide”.  Obviously “Show” is people I want to see in my phone; “Hide” is for people who I want to keep their number, incase they text me it would display a name – but I don’t want to see those people all the times when I compose a new message / make a phone call.
I couldn’t figure it out.  I ended up re-setting my iPhone because in the “setup” process  there is a step for “Import from Android” (that I missed seeing the first time).
What I ended up doing was going into the Google Contact Manager and exporting two separate lists in the vCard format.  Then (on my dekstop), I went to iCloud and create the two groups, and imported the two lists (separately).
Then in the iPhone settings, I went into Contacts and will manage which group appears under “iCloud” – not under “Gmail.”

Read the article