Android Developers Blog

Welcome to eSupersun's Blog! The topics here are mostly focusing on the development of Android games, iPhone games and mobile games. If you're interested in the development of mobile games and like to share your ideas, please click here to join the top Mobile Game Developers Forum community.

Monday, September 2, 2013

.Net Development: Solutions to a Few Common Issues

Issue 1
Unable to create the virtual directory. Could not find the server on the local machine. Creating a virtual directory is only supported on the local IIS server.
Unable to start debugging on the web server. IIS does not list a web site that matches the launched URL.
Unable to start debugging on the Web server IIS does not include a corresponding Web site URL starts.

Solution
1.Check Local Machine IP
Open a Command Prompt, type command ‘ipconfig/all’ to check ip, gateway and dns information. Specify your machine ip address and dns if applicable.

2. Add Entry in Hosts File
Locate to the directory c:\windows\system32\drivers\etc\hosts
            Add entry (IP address and host name) as below:
# localhost name resolution is handled within DNS itself.
127.0.0.1       localhost
192.168.0.10 pavilion

3. Check the ASPNET2.0 Already Installed
If not installed the ASPNET2.0 on your machine, then open a command prompt, navigate to "c:\windows\microsoft.net\framework\v2.0.50727", run the command below to install aspnet v2.0.
ASPNET_REGIIS -i

4.Configure IIS7 Manager
command>inetmgr, open the IIS7 Manager. Set application pools for your sites.


Right click ‘Default Web Site’->’Site Bindings’, make sure the port and the IP Address are configured correctly.


Then open your project in MS VS, go Project->Properties, click on the tab ‘Web’, set Local IIS web server, and then press the button ‘Create Vitual Directory’. Rebuild your project.


Go back to the IIS Manager. Right click your site->Manage Application->Browser  to view your site.


Issue 2
The local IIS URL http://192.168.1.100/9KBuild specified for Web project 9KBuild has not been configurated. In order to open this project the virtual directory needs to be configurate. Would you like to create the virtual directory now?
You press yes, but a warning message pops up:
Creation of the virtual directory http://192.168.1.100/9KBuild failed with the error: Could not find the server ‘http://192.168.1.100’ on the local machine. Creating a virtual directory is only supported on the local IIS server.

Solution:
There’re two options:
1.    Use an edit tool to open the csproj file of your project (ex, 9kbuild.csproj), change the ip address to the correct one (ex 192.168.0.10). Now you can open the 9KBuild project without any problems.
2.    Go to IIS Manager, command->inetmgr, go ‘Default Web Site’->’Site Bindings’, change the ip address back to the one that set in 9KBuild project. Now you can open the 9KBuild project without any problems.

Issue 3

Changes to CSS don't appear immediately when debugging in MS Visual Studio.


Cause:
The browser is caching the CSS. In IE and FF, press F5 to refresh the page that should fix the problem, while in Chrome a message always appears when pressing F5.
Confirm Form Resubmission
The page that you're looking for used information that you entered. Returning to that page might cause any action you took to repeated. Do you want to continue?

Solution:
Right click on your Google Chrome shortcut icon, the click "properties" from the drop down menu and then click “Shorcut”. In the box labeled "taget" add "-disable-prompt-on-repost" to the end of the box. 
For example: 
"C:\Documents and Settings\[Your Account]\Local Settings\Application Data\Google\Chrome\Application\chrome.exe" 

Changes to 
C:\Documents and Settings\[Your Account]\Local Settings\Application Data\Google\Chrome\Application\chrome.exe -disable-prompt-on-repost 

Of course "Your Account" refers to your windows account name. Restart your browser and you're good to go.

Issue 4
Table Broken Issue in Google Chrome: The rightside black border on 9kgames forum shows partially in Chrome, while it’s ok in IE and FF.

Cause:
The HTML table end tag
isn’t compatible with HeadTemplate, ItemTemplate in Chrome, can’t solve this issue directly, use alternative ways.

Solution:
Adding a new line ‘border-right: 1px solid #206020;’ in CSS file should solve the issue.
Code Snippets:

<td class="<%# NINEK.Config.GetBrowser().ToUpper().Contains("CHROME") ? "header1":"header"  %>" align="center" width="18%">

or
<td class="<%=Request.Browser.Browser == "Chrome" ? "header1":"header"  %>" align="center" width="18%">

CSS:
td.header
{
            background-color: #FFFFFF;
            background-image: url(../../images/background/bg_header1.png);
            ……
}

td.header1
{
            border-right: 1px solid #206020;
            background-color: #FFFFFF;
            background-image: url(../../images/background/bg_header1.png);
            ……
}

Rename an Android Project in Eclipse

Changing the name of an Android project in Eclipse is not as easy as in MS Visual Studio, here are some tips & steps to accomplish it.
Ex. Rename an old Android project ‘CrocodileIsland2’ à’OzmanRealm ’

1.Change XMLs
Firstly, locate XML files like AndroidManifest.xml, mainlayout.xml, strings.xml, make sure you rename the corresponding words/text from ‘crocodileisland…’à’ozmanrealm…’ in all those files.

2.Rename Project
Highlight the project ‘CrocodileIsland2’, press F2 to rename the project name, check the option ‘Update references’, then press the ‘OK’ button.


3.Rename Package
Unfold CrocodileIsland2->src->ninek.crocodileisland2 package, press F2 to rename package name. Make sure you select the options as below, then press the ‘OK’ button.


4.Change Folder
Highlight the Project, go Refactor->Move to move the project to a new location physically.


Type the destination path in the location textbox.


Keep in mind, an error may occur after finishing the above steps:
The container Android Private Libraries references non existing library F:\Android\workplace2\CrocodileIsland2\libs\android-support-v4.jar

5.Renew Android Private Libraries
Go Project properties->Java build path->Order and Export, unselect the ‘Android Private Libraries’ checkbox.


Then click the tab ‘Libraries’, unfold the item ‘Android Private Libraries’, add/edit to add android-support-v4.jar from the libs folder under the current project.


Go back to the tab ‘Order and Export’, select the ‘Android Private Libraries’ checkbox, and press OK. Then you’re done!