Little simple things where I lost some time finding out the resolution when developing for Android.
Emulator with PANIC error:
PANIC: Could not open: C:\Users\
This error happens all the time in windows environment. The most cause is because your username has some non-english characters like “éáç…”, and Android SDK uses your home folder in the operating system as a default to create the emulators.
make a copy of the avd folder and configure the ini file to point to the new folder.
Go to the emulator folder (for instance: c:\users\usernamewithnonenglishlike-áéíç\.android\avd\)
Copy the “avd” folder to another folder without non-english characters (c:\myAvds\…")
Don’t remove the original
In the original folder open the “init” file: (for instance: c:\users\usernamewithnonenglishlike-á\.android\avd\AVD_for_2_7in_QVGA.ini)
Change the path value to the new folder:
- Start the emulator, it must work now!
PS: Another way is creating manually the AVD and place it in a custom folder:
<em>android create avd -n myVirtualDevice -t 2 -p customfolder\avd</em>
Associate the resource layout (xml file) with the Activity java class:
In the activity java file just add a line to link to the resource file.
Create your resource file or “design file” at res\layout\your_resource.xml
- use only lowercase characters combined with numbers and “_”
- In the Activity Java Class, in the “onCreate” method, use “setContentView(R.layout.your_resource) like the code below.
Can’t configure Android SDK in IntelliJ 12 when creating a new project
Intellij doesn’t have configured any jdk, so we must configure at least one!
- Create the project without the Android SDK configured.
- Add some jdk (1.5, 1.6, 1.7) in File->Project Structure
- Then choose Android SDK for your project!