lunedì 28 marzo 2011

Application install Failed due to INSTALL_FAILED_CONTAINER_ERROR

Recently discovered a new error when installing my application on my G1 (with Froyo 2.2.2)

The eclipse error was:
Installation error: INSTALL_FAILED_CONTAINER_ERROR


than I solve it with this steps:

1. Open adb with shell, type:
adb shell
(I get # sing)
NOTE If you get $ sign type:
su
and you'll become a super user (# sign).
2. Remove the nasty (temp) file
rm /mnt/secure/asec/smdl2tmp1.asec


that's all.

mercoledì 14 luglio 2010

Froyo Build - First Fastboot

Now I'm able to build froyo image, but I have an error flashing it.
The error is :


fastboot update Dream.zip -w
archive does not contain 'boot.sig'
archive does not contain 'recovery.sig'
archive does not contain 'system.sig'
--------------------------------------------
Bootloader Version...: 0.95.3000
Baseband Version.....: 2.22.19.26I
Serial Number........: HT91RL(XXXXXX)
--------------------------------------------
checking product... OKAY [ 0.006s]
checking serialno... OKAY [ 0.009s]
checking version-bootloader... OKAY [ 0.012s]
checking version-baseband... FAILED

Device version-baseband is '2.22.19.26I'.
Update requires '2.22.26.07'.

finished. total time: 0.070s


The solution is:
Open the board-info.txt and replace
require version-baseband=2.22.26.07
with this
require version-baseband=2.22.19.26I> 



Happy flashing

Dr.Luiji

lunedì 12 luglio 2010

How to use VirtualBox USB passthrough (Windows host to Ubuntu guest)

I've had some problems with the ADB via VirtualBox USB passthrough. My configuration is: Windows 7 (host) to Ubuntu 10.04 64-bit (guest) and my VirtualBox version is 3.2.6.

This article[^] solve my problem.

Many thanks commandar

Dr.Luiji

venerdì 9 luglio 2010

How to: Install VirtualBox Guest Additions into Ubuntu

If you try to install VirtualBox Guest Additions in Ubuntu 10.04 32-bit or 64-bit, you'll have some problems with administrator privileges.

The fast way is open it with the autorun prompt. The steps are 2.

  1. Install the VirtualBox Guest Additions from the VirtualBox menu. Now in the Ubuntu's Destop you will find the CD link, something like VBOXADDITIONS_XXXX

  2. Right click on the VBOXADDITIONS_XXXX icon on Desktop and select 'Open with Autorun Prompt'. Insert your password.

Wait the end of installation (about one minute) and restart your SO.

Have a nice day

Froyo Build - 64-bit SO is preferred

I found this post on google groups.


Build Error during Make

Where Jean-Baptiste M. "JBQ" Queru said:
Java6 is not available in 32-bit on all platforms. 
Given that all of Google's development and testing happens on builds
created on 64-bit machines, there's some level of risk in letting
device manufacturers use 32-bit environments as we don't know what
happens in those cases. Java6 allows us to standardize on 64-bit and
eliminate that risk.


And I found an Issue that is exactly mine (10 hours ago).
Android Build issue with Ubuntu 10.04

I can't wait the answer I switch to 64 environment.

giovedì 8 luglio 2010

Froyo Build - JDK 6 is the correct version

To build the files you need the java 6. The Android documents are out of date.
This is the error if you build with the java 5
 
You are attempting to build with the incorrect version
of java.
Your version is: java version "1.5.0_19".
The correct version is: 1.6.

Jean-Baptiste Queru answer to my question: JDK 5 or 6?

So I install JDK 6.0 under Ubuntu 10.04 32 bit with these command-line:


sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get update
sudo apt-get install sun-java6-jdk


Froyo Build - Set bin directory is in your path on Ubuntu 10.04

If you haven't the bin directory is in your path, add it with these commands

  • Open the user .bashrc

    sudo gedit ~/.bashrc


  • Add at the end the bin file this line

    PATH=~/bin:"${PATH}"


  • Save and exit.

Froyo Build - Intrepid (8.10) on Ubuntu 10.04

The third step to set up your Linux development is not needed if you are not a Intrepid ( 8.10) users.

$ sudo apt-get install lib32readline5-dev 

Froyo Build - Install JDK 5.0 on Ubuntu 10.04

Intro


Recently I've decided to build the Android system image (Froyo) for my ADP1 from the lastest Android Open Source Project (AOSP).
I try to build it on Ubuntu Linux 10.04 LTS Desktop Edition 32-bit (x86).

If you'll follow the steps in Getting the Source probably you'll find some issues.
The first issue will be in the first step (Setting up your machine), installing the packages for Sun JDK 5.
The command below it gives you an error about JDK 5.

sudo apt-get install git-core gnupg sun-java5-jdk flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev

E: Couldn't find package sun.java5.jdk

So, before of this command you have to use the cure to enable JDK5 and below you can find all the instruction.

Install JDK 5.0


These are the steps to solve the problem.
  1. Open the sources.list with GEdit or with your preferred editor

    sudo gedit /etc/apt/sources.list

  2. Enable the package including in the list the Sun JDK 5. Add this line at the end of file.

    deb http://ir.archive.ubuntu.com/ubuntu jaunty-updates main multiverse

  3. Update you package

    sudo aptitude update

  4. Now you may install it with all the others packages

    sudo apt-get install git-core gnupg sun-java5-jdk flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev

    or alone

    sudo apt-get install sun-java5-jdk

That's all. Now you can continue with the Android's document.
Have a nice day.

giovedì 9 luglio 2009

Get the version information of an extern assembly

We have more ways to get the information of an assembly, the most two I use are:
  1. Only for .NET assembly
    System.Reflection.Assembly AssemblyFileInfo = System.Reflection.Assembly.Load(FileAppPath);
    Console.WriteLine (AssemblyFileInfo.GetName().Version);

  2. For all .NET and native assembly
    FileVersionInfo AssemblyFileVersion = System.Diagnostics.FileVersionInfo.GetVersionInfo(FileAppPath);
    Console.WriteLine(AssemblyFileVersion.FileVersion)

martedì 9 giugno 2009

Application Path

Sometime I need to retrieve the application path, here I add the four methods I use frequently.

  1. The simple way through windows forms:
    using
    System.Windows.Forms;
    String sAppPath1 = Application.StartupPath;
  2. From the binary over reflection:
    String sAppPath2 = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase );
  3. Using the file informations:
    FileInfo executableFileInfo = new FileInfo (Application.ExecutablePath);
    String sAppPath3 = executableFileInfo.DirectoryName;
  4. When my program is started from another:
    System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
Happy coding.

martedì 17 marzo 2009

Creating attractive UIs on Windows Mobile devices

Next week Alex Yakhnin will show us how to customize built-in controls that come with .NET CF, such as TextBox, DataGrid, ListView etc...

The first webcast of the series was great, this second will be better and more interesting. Stay tuned.

venerdì 9 gennaio 2009

iPod touch UI



I continue my journey in the fascinating world of mobile with a new article on TheCodeProject iPod touch UI[^].

Here you can see a new way to work with Alpha blending and a way to work with WMP OCX on mobile. The article focus on
  • C#
  • CF .NET
  • Resolution-aware and Orientation-aware
  • Dynamic graphic text resize
  • Mouse gesture
  • Intercepting button
  • Work with Windows Media Player OCX on Windows Mobile.

I hope you enjoy during the reading like me during the develop.

venerdì 19 dicembre 2008

iPhoneUI on msdn

Now you can find my iPhoneUI (codeproject article) on the msdn.
here[^], take a look.

iPhoneUI on codeplex

Many thanks to dkackman that add my iPhone UI to codeplex.
He put a modified version up on codeplex and begins a fascinating trip into it.
You can find it directly here: http://www.codeplex.com/iPhoneUI/[^] take a look.

lunedì 15 dicembre 2008

OfficeServ Unico is out

OfficeServ Unico is one of my last work on mobile.
TELCEN (my company) prepared for Samsung a commercial software that turns smartphone into a single terminal capable of handling all types of communications, GSM-UMTS-HSDPA and VoIP.

I'll add the direct link to Samsung, where you can see the product, here[^].

sabato 13 dicembre 2008

martedì 9 dicembre 2008

String & P/Invoke with C#

Sometime I hear about c# problem with the P/Invoke and string.
Here I add a very simple usage of it, it describe C++ CString and c# String.

1. SetWindowText
First I begin with a sample really simple. How to set a string of a dialog. I invoke the SetWindowTextW.
You can define this for mobile app
[DllImport ("coredll.dll", EntryPoint="SetWindowTextW")]
private static extern void SetWindowText(IntPtr hWnd, string lpString);
You can define this for desktop app
[DllImport("user32.dll"), EntryPoint="SetWindowTextW")]
private static extern bool SetWindowText(IntPtr hWnd, string lpString);

Call the function with this code snippet
public bool SetText(IntPtr hWnd, String text)
{
System.text.StringBuilder NewWindowText = new System.text.StringBuilder(text);
return (SetWindowText(hWnd, NewWindowText) != 0);
}
GetWindowText
The second example is one that creates more problems. The fault probably is derived from the fact that many people use the String for these conversions instead of the StringBuild. To do this I need two P/Invoke the first for retrieve the lenght the second to retrieve the text.

You can define this for mobile app
[DllImport("coredll.dll", CharSet = CharSet.Auto, SetLastError = true), EntryPoint="GetWindowTextW")]
static extern int GetWindowText(IntPtr hWnd, StringBuilder lpString, int nMaxCount);
[DllImport("coredll.dll", SetLastError = true, EntryPoint="GetWindowTextLength")]
static extern int GetWindowTextLength(IntPtr hWnd);

You can define this for desktop app
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true), EntryPoint="GetWindowTextW")]
static extern int GetWindowText(IntPtr hWnd, StringBuilder lpString, int nMaxCount);
[DllImport("user32.dll", SetLastError = true, EntryPoint="GetWindowTextLength")]
static extern int GetWindowTextLength(IntPtr hWnd);
Call the function with this code snippet
public string GetText(IntPtr hWnd)
{
int length = GetWindowTextLength(hWnd);
StringBuilder TheWindowText = new StringBuilder(length + 1);
GetWindowText(hWnd, TheWindowText, TheWindowText.Capacity);
return TheWindowText.ToString();
}
If anybody knows any more graceful solution, I'd like to know it.
I hope my suggestions are useful to someone.

martedì 2 dicembre 2008

Simple event logging

With this class your application can write in the event log.
The class use the
System.Diagnostics to write the message into the Event log.

using System.Diagnostics;

public class Logging

{

static string Source = "My Application";

public static void WriteEventLog(string Message, System.Diagnostics.EventLogEntryType EntryType)

{

try

{

if (!EventLog.SourceExists(Source))

{

EventLog.CreateEventSource(Source, "Application");

}

EventLog.WriteEntry(Source, Message, EntryType);

}

catch(Exception ex)

{

System.Diagnostics.Debug.WriteLine(ex.Message);

}

}

}


Usage:

Logging.WriteEventLog(System.Diagnostics.EventLogEntryType.Information,"Message Error");

martedì 25 novembre 2008

File attributes with C#

The class I've posted shows how to use the fiel attributes with c#.
To get file attributes (in .Net) you need more steps, with this class you have immediatly all you need.
I covered the 4 standard attribute but you can extend the class with other attributes. The file is .called FileAttributeEx.cs and this it the code.

using
System;
using System.IO;

namespace FileAttributeEx
{
class FileAttributesEx
{
private string filepath = string.Empty;

public string FilePath
{
get { return filepath; }
set { filepath = value;}
}

public FileAttributesEx() { }
public FileAttributesEx(string path)
{
FilePath = path;
}

public bool isReadOnly ()
{
return (File.GetAttributes(FilePath) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly;
}

public bool isHidden()
{
return (File.GetAttributes(FilePath) & FileAttributes.Hidden) == FileAttributes.Hidden;
}

public bool isArchive()
{
return (
File.GetAttributes(FilePath) & FileAttributes.Archive) == FileAttributes.Archive;
}

public bool isSystem()
{
return (File.GetAttributes(FilePath) & FileAttributes.System) == FileAttributes.System;
}

public void AddSystem()
{
File.SetAttributes(FilePath, File.GetAttributes(FilePath) | FileAttributes.System);
}

public void AddReadOnly()
{
File.SetAttributes(FilePath, File.GetAttributes(FilePath) | FileAttributes.ReadOnly);
}

public void AddHidden()
{
File.SetAttributes(FilePath, File.GetAttributes(FilePath) | FileAttributes.Hidden);
}

public void AddArchive()
{
File.SetAttributes(FilePath, File.GetAttributes(FilePath) | FileAttributes.Archive);
}

public void Clear()
{
File.SetAttributes(filepath, File.GetAttributes(filepath)
& ~(FileAttributes.Archive |
FileAttributes.ReadOnly| FileAttributes.System|FileAttributes.Hidden));
}
}
}

To use it in your project simply, add the file to your project, add a new instance of it and call the metods you need.
Here a sample:

FileAttributesEx fileAttr = new FileAttributesEx(sFileName);

if (fileAttr.isArchive())
//Do something
if (fileAttr.isHidden())
//Do something

fileAttr.Clear();

fileAttr.AddReadOnly();

Have fun.