Little Fixes

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

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.

resolution: 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:https://developer.chrome.com/multidevice/webview/gettingstartedAdd 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”:

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.