WARN net.spy.memcached.transcoders.SerializingTranscoder: Caught IOException decoding bytes of data

1

I started to get a weird exception
java.io.InvalidClassException: package.com.something.Some_Hibernate_Table; no valid constructor
at java.io.ObjectStreamClass.checkDeserialize(ObjectStreamClass.java:730)
.
.
.
Some_Hibernate_Table

The stack trace was very weird, it hinted at a launch stack, and a exception from a table other than what I was sending data to. Infact after doing some debugging, step by step, this exception happened on a get on a SomeOther_Hibernate_Table.

Crazy root cause.. 🙂
Old code
List tableRow = null ;
if (isCacheable) {
tableRow value = cache.get(key) ;
return tableRow
}
String rowQuery = “Select * from ” + tableName + ” where ” + column + “=” + “\”” + key + “\””;
Query rowResult = currentSession().createSQLQuery(rowQuery);
tableRow = rowResult.list();

The cache returns a Object, but hibernate.createSQLQuery returns a List. So to keep things clean, the fix below.
Object value = cache.get(key) ;
if (isCacheable) {
if (value != null) {
tableRow = new ArrayList() ;
tableRow.add(value);
return tableRow;
}
}
String rowQuery = “Select * from ” + tableName + ” where ” + column + “=” + “\”” + key + “\””;
Query rowResult = currentSession().createSQLQuery(rowQuery);
tableRow = rowResult.list();

Advertisements

Hibernate Class cast expection when reading items from createSQLQuery().list

0

Got some good advice from https://forum.hibernate.org/viewtopic.php?p=2393573
From
String tableQuery = “Select * from ” + tableName ;
Query tableResult = null;
List table = null;
tableResult = currentSession().createSQLQuery(tableQuery);
table = tableResult.list();

I modified the code to
String tableQuery = “Select {t.*} from ” + tableName + ” t”;
Query tableResult = null;
List table = null;
tableResult = currentSession().createSQLQuery(tableQuery).addEntity(“t”, tableClass);
table = tableResult.list();

SecurityException Binder invocation to an incorrect interface (Inapp Billing)

3

Self Advertisement
—–Start of Advertisement——-
BUILD CAR POOL SOLUTIONS ON ANY DEVICE TO RUN ANYWHERE (www.mcruiseon.com). Introducing mCruiseOn, the java library /json api’s that you can use to build a car pool solution. Be the next avego.com, carpooling.com, zimride.com. mCruiseOn is your one stop API on EC2.
——End of Advertisement——-

I got this annoying exception when I tried to run the “In app billing” sample app. I followed all the required steps but kept getting this exception at load time.

I did the following
1) Setup a Market account
2) Renamed the package to not have “android” or “example”
3) Added the public key from the market profile to Security.java
4) Built/Signed the app
5) Added “inapp products” to the market place
6) Uploaded as draft app
7) Uninstalled the sample on the device
8) Installed it on the device
9) Ensured that market place was > 2.3.5
10) Setup a test account. And this test account should not be the account registered for this developer. Else it can be a security issue (buying your own product).
When I load, I get this annoying exception. Absolutely no help on any website.

Finally after a few hours of pulling out some more of my hair, I finally think of a root cause. The main reason that its a security issue can be only because of the public key or the test account. Thats it, it was the test account.

Root Cause 1
My registered account (A) with market place was my primary account with all the app’s, contacts and my life in short. The test account was my other gmail account (B), which did not have any apps. So, catch 22.

If I setup (A) as my primary account on android phone (samsung, which does not take its updates from google android, buts its own builds), then I land up in a Security Exception since A cannot be used as a test account. And the primary account on the device is considered as the test account when the sample in app billing app runs.

If I setup (B) as my primary account on the android phone, market application is 2.1, and not enough for the sample app to run. So you see, catch 22.

Solution was simple. I registered B as my market account (one more cost to my budget :)). But google being really nice, refunded my fee’s for A.

Mind you A was a new account, no apps published on this account and nothing pending for payment. It was a brand new account.

Root Cause 2
The public key can change when google activates/cancels accounts. So just reverify the public key and your Security.java file.

Root Cause 3 (THE worst of the root causes)
The AIDL file is referred from your BillingService.java file. Also remember that we modified the package name to “not” contain android ? The BillingService is “INCORRECTLY” referring to the older package (com.android…..).
Now, how do I know this ? Well, details are in the fine print. On the “http://developer.android.com/guide/market/billing/billing_integrate.html” page its mentioned that if you need debugging information set DEBUG = true in Consts.java. I did that and found a warning , before the SecurityException in LogCat.

Set Debug=true in Consts.java

Hope you understood it. If not, please comment on the blog, I’ll respond.

Configure your mac (or ubuntu) for sending debugging (android) reports

0

Recently I blogged about setting up your mac for “non development work” so that you can test your android app’s without a android app. A very important part to this the ability to send crash reports. As we all know android has some wonderful tools for debugging. So for your business managers who care only about your requirements and delivery, sending effective crash reports is very important.

Think of it like this, if you send a effective crash report the developer can fix issues quicker smarter and “Exactly” for what you faced. Its a 2 way street really. Right ?

That said, the developer too needs to add debug information to the debugger. Android has a debugger called “ddms”. Lets get to it.

– Download this file “http://dl.google.com/android/android-sdk_r10-mac_x86.zip” to a directory
– Extract all files
– cd android-sdk-mac_x86/tools
– ./ddms
– Wait a while for the log to update
– Reproduce the issues, wait for the app to crash.
– Click on the “scrolling text below”
– “Select All” text
– Copy Paste into a text file
– Send the text file to all your developers.

Hope this helps. Please comment if you it does not.

android emulator INSTALL_FAILED_INSUFFICIENT_STORAGE

0

Kept getting this annoying message when I tried to install a app close to 20Mb.

Installation error: INSTALL_FAILED_INSUFFICIENT_STORAGE

Simple fix actually, In your Run or Debug Configuration, Target tab, scroll down, in the edit box of “additional emulator command line options” add the below

-partition-size 1024

Restart your emulator, should work.