Wednesday, May 20, 2015

Android Studio 1.2 problems

Every IDE is terrible. I won't explain my reasoning here. If you're interested, see my computing philosophy.

But the new Android Studio is not the worst of them. As one would expect, there are immediate snags and bugs. I'll document a few, mostly as problem-resolution pairs.

After downloading, installing, and running, you need to manually update the studio: click the little android-with-down-arrow icon (the SDK Manager) and see if anything needs to be installed. Google will probably fix some of the problems below, in future updates. Including this installation updating issue.

Task -- Create a new project only with default values. Your first new app project will have several problems at birth:

problem: a “Rendering Problems” error -- “the following classes could not be instantiated” ...
solution: you need to change the build.gradle classpath to 1.2.3, and rebuild. Then simply close the semi-opaque error window.

problem: “warning: the project encoding (windows-1252) does not match the encoding specified in the gradle build files (utf-8)”
resolution: there’s a link provided within this error window: “open file encoding settings”. Click it. For both the IDE and Project, select “utf-8”.

Task -- build and run:

problem: running an app in the emulator only displays the locked screen
resolution: click the lock and drag upwards

problem: (on Microsoft Windows) emulator window off the top off the screen
solution: click on emulator, then press Alt+Space, then choose Move, then move with arrow keys

Task: add more "activities" (i.e., “screens” or "pages"):

cool thing: try Tools->Android->Navigation editor. Click to add an activity.
but: deleting activities take some attention. You need to check any appropriate XML manifests, delete related code, and refactor.

Task -- add an activity in navigation editor:

problem: one of the least intuitive aspects of the layout editor (which you get to by double-clicking activities in the navigation editor), is that you cannot simply type new text after double-clicking text. The these have to become string resources.
resolution: double-click the box with the text in it. hit the little ellipsis (...) A dialog shows up. Create a new resource (at the bottom), and then say 'ok'. This will take care of it.

Task -- add a radio group:

problem: orientation of radio group container layout.
1. click on the actual radio group on the right, in the component tree
2. look at the properties box, below the component tree
3. change “orientation” property to “horizontal”

problem: layout width & height default is set to “match_parent” in the properties box. making it huge. note this default may be inherited from the layout type. But is still silly.
resolution: change “layout width” & height to “wrap_content”

problem: check a radio button by default
resolution: it's the radio button property ‘checked’. Of course, the programmatic solution would be different.

problem: the palette disappears from layout editor
solution: there’s a tiny little arrow to the top left. click exactly upon it. a “palette” button should show up. then you can double-click on the .xml tab, and if the palette button is still showing, you should be able to mouseover and get a window adjustment arrow on the left, and then you pull it right, and the palette shows up again.

problem: error “resource id cannot be empty string at ‘@+id/’”
solution: change it to @id+/test … in general, id’s map code to activities or fragments in the XML.

Task -- add a web view:

Add the webview from the palette, in the layout editor.

Set height and width with down arrow in properties, to “match_parent”

Create an id, like “webview1”:

Then edit your mainactivity java file.

You add the url in java, in mainActivity:

public class MainActivity extends Activity {
   private WebView mWebView;
   protected void onCreate(Bundle savedInstanceState) {
       mWebView = (WebView) findViewById(;

If you don’t want the browser to launch, before the URL put:

public class MainActivity extends Activity {
   private WebView mWebView;
   protected void onCreate(Bundle savedInstanceState) {
       mWebView = (WebView) findViewById(;
       mWebView.setWebViewClient(new WebViewClient);

… and if the page you’re loading has javascript, you’ll need to add this:

public class MainActivity extends Activity {
   private WebView mWebView;
   protected void onCreate(Bundle savedInstanceState) {
       mWebView = (WebView) findViewById(;
        // Enable Javascript
        WebSettings webSettings = mWebView.getSettings();

problem: the IDE can’t find classes, like WebView, WebViewClient, etc.
solution: click and hover, and accept the IDE’s “alt-enter” option to add the appropriate import.

problem: webpage doesn’t load. get “Failed to load resource: net::ERR_CACHE_MISS …”
solution: in the primary manifest, AndroidManifest.xml, put this line anywhere above the application:

easy misunderstanding: if you use relativeLayout, the ‘below_layout’ property in the activity XML file may be confusing. It refers to the xml id of the fragment laid out above it.

problem: constant emulator runtime errors. “glUtilsParamSize: unknow param” (sic)
solution: live with it. you can get rid of them by stopping the AVD (android virtual device) manager, editing your virtual device, unchecking “Use Host GPU”, killing and restarting the emulator.
but: it seems to actually break (or intolerably slow-down) the emulator
future possibility: some kind of error message filters in Android Studio. Which, for these errors, should be in place by default. I expect this will change in some update, since they’re really annoying.

problem: run doesn’t start the app the first time. it starts the emulator.
solution: run twice

Task -- Installing git:

problem: (Microsoft Windows) When you enable Android VCS with git, it can’t find git.exe, even if you fully installed git with defaults. And the Windows start menu search can’t find it.
solution: I found it here: c:\program files (x86)\Git\bin\git.exe


Blogger shahjee said...

I have to search sites with relevant information on given topic and provide them to teacher our opinion and the article. geforce experience unable to connect to nvidia

11:19 PM  

Post a Comment

<< Home