kinyerakenneth / lastfm-java

Automatically exported from code.google.com/p/lastfm-java
BSD 2-Clause "Simplified" License
0 stars 0 forks source link

Getting "caching failed" exception when invoking methods on Android #30

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm getting the "caching failed" exception by just adding a line which invokes 
a method, like:
User.getTopArtists(user, key);
I've tried two different keys and various usernames, with no luck.
On an blank Java project, the API works perfectly.

I'm using the Android SDK on Eclipse, and the code is running on Android 2.2.

Oddly enough, some of the methods actually work, such as getLovedTracks() and 
getRecentTracks().

Is there any incompatibility with Android, or any specific changes I should 
make for the API to work with Android?

Original issue reported on code.google.com by marcelod...@gmail.com on 2 Aug 2011 at 11:24

GoogleCodeExporter commented 9 years ago
> Is there any incompatibility with Android, or any specific changes I should 
make for the API to work with Android?

Do you have permissions to write to the file system/the specific directory the 
cache is being written into on Android?
If not you will have to use a different cache implementation or none at all 
(null).

Some methods will work anyway because they won't get cached by default.

Original comment by jannikov...@gmail.com on 3 Aug 2011 at 1:37

GoogleCodeExporter commented 9 years ago
Thanks for the quick answer!

The problem isn't on the permissions, but Android seems to be very picky about 
File I/O.

The rest of the API seems to work when I call setCache(null), and that was what 
I really needed.

Thanks, and sorry for taking up your time!

Original comment by marcelod...@gmail.com on 3 Aug 2011 at 4:14

GoogleCodeExporter commented 9 years ago
closed then

Original comment by jannikov...@gmail.com on 3 Aug 2011 at 11:48

GoogleCodeExporter commented 9 years ago
Could some one tell about where to call setCache(null) .

Original comment by masood....@gmail.com on 21 Mar 2012 at 12:07

GoogleCodeExporter commented 9 years ago
anywhere, just before you make any web service calls

Original comment by jannikov...@gmail.com on 21 Mar 2012 at 3:00

GoogleCodeExporter commented 9 years ago
Can You tell us how You do it? Or give a code, which will resolve it? I have 
not setCache()...

Original comment by Mikosss1...@gmail.com on 4 Jul 2012 at 10:44

GoogleCodeExporter commented 9 years ago
hey pls explain me!
WHERE can i call setCache(null)???
its really urgent for me

thanks

Original comment by p...@spectralmind.com on 27 Nov 2012 at 12:37

GoogleCodeExporter commented 9 years ago
Just add this line somewhere in your code that will get run prior to calling 
any of the api methods:
Caller.getInstance().setCache(null);

If you still want cache support, try something like this in your main 
Activity's onCreate() method:
Caller.getInstance().setCache(new FileSystemCache(getCacheDir()));

Original comment by KurtHard...@gmail.com on 14 Dec 2012 at 5:46

GoogleCodeExporter commented 9 years ago
Hi,
I call Caller.getInstance().setCache(null);
before call the API methods, but I still get "caching failed" exception.
Any idea ?

Original comment by m.vnc...@gmail.com on 18 Feb 2013 at 3:12

GoogleCodeExporter commented 9 years ago
Just set the Cache to FilesystemCache with the adnroid files DIR of your app. 
Worked for me..

Caller.getInstance().setCache(new FileSystemCache(getFilesDir()));

Original comment by tiran...@gmail.com on 5 Apr 2013 at 6:05