Android ORMLite DatabaseConfigUtil and library project - android

I am trying to create a Library project for andorid and I am using ORMLite.
Within my library project I have created ormlite_config.txt within the res/raw folder. However, when I make a jar of the library project, it gets sealed. So I get the following error.
java.alang.RuntimeException: Unable to start activity [activityName]: java.lang.IllegalStateException: Could not load object config file
Caused by: java.sql.SQLException: DatabaseTableConfig reading from stream cannot parse line: [random characters]
I have thought about using app specific config file stored on device and reading that. But with that is that I cannot get the application context when I run the DatabaseConfigUtility.
Has anyone ran into this problem before? Your help will be much appreciated!

in the class where you are extending OrmLiteSqliteOpenHelper you might be creating a constructor where you would call super class constructor just pass NULL in place of your "R.raw.ormlite_config", the ormlite_config file in my raw folder didn't contain any code , I had the EXACT SAME problem and this solved it for me. Hope this helps you.

Related

Any library to read mdict *.MDX files in android?

I have a .mdx file that infact is a dictionary database (some android apps like bluedict can read its data).
I have used Daemon.tools but it could not open it.
I was looking for any library or sources which helps me to read MDX dictionary files in Java, I have found some resources already such as KnIfER/mdict-java but it does not work in Android Studio (it has errors on accumulation_blockId_tree.xxing(new myCpr(position,1)).getKey().value line and it is connot resolve symbol 'value'). Does any one knows a good source about these files and possible libraries which could be used for it?.
Well, actually this is my java project.
the error mentioned is just a problem of jdk version. you can add <> parentheses after myCpr and convert return of xxing to type myCpr<Integer,Integer> .
But now, I have very much reduced usage of rbtree and use more binary list searching.have a look there.

BouncyCastle Error

I am developing an android application. In this application I create my own private key by passing pass phrase, user id and keys. When creating the private key, it says "Error: org.bouncycastle.openpgp.PGPException: cannot create cipher: CAST5/CFB/NoPadding"
I have checked the logcat as well as the warning section in the Eclipse but there is error there. SO why I am getting this error and how to solve it.
Any help is greatly appreciated!
I am using bcpg-jdk15on-150.jar and bcprov-jdk15on-150.jar,
which I have downloaded from http://www.bouncycastle.org/latest_releases.html
EDIT
the solution of renaming one or both the jar files does not work. When I run the application it says Unable to execute dex: Multiple dex files define Lorg/bouncycastle/apache/bzip2/BZip2Constants;
and Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lorg/bouncycastle/apache/bzip2/BZip2Constants;
I think there is a problem with the duplication of some files within the two jar files. Can anyone suggest me a solution regarding this?
Thanks
Use latest BouncyCastle and setup security in your code in the following way:
Security.removeProvider(BouncyCastleProvider.PROVIDER_NAME);
Security.insertProviderAt(new BouncyCastleProvider(), 1);
It sets Bouncy Castle library as preferred security provider; Android's default provider config has BC at position 3 so this code will remove it and insert BC again at position 1.
It solved the problem for me.

Android NoClassDefFound when referencing class from external libraries (IntelliJ IDEA 12)

I'm having an issue with IntelliJ's dependency handling in regards to external modules. Here's some context:
I'm writing an Android app which implements Google Maps. For my current feature set, I require two external libraries-- Google's Play Services Library and mapex (A third party google map extension library located here https://code.google.com/p/mapex/). I actually built most of this project in Android Studio before I was recommended to move to IntelliJ due to the easier dependency handling. But now I'm here and still having problems.
My Error
When trying to build an object from a class located in the mapex package (com.androidnatic.maps), I get this error when starting the activity the view is contained in (object has not been created yet):
07-03 11:40:35.837: ERROR/dalvikvm(3585): Could not find class 'com.androidnatic.maps.SimpleMapView', referenced from method com.example.myproject.MapActivity.showHeatMap
And then, upon creation, my app force closes and leaves this behind in logcat:
7-03 11:40:45.467: ERROR/AndroidRuntime(3585): FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: com.androidnatic.maps.SimpleMapView
at com.example.myproject.MapActivity.showHeatMap(MapActivity.java:492)
Yet I'm completely stumped because my IDE gives me no sign that anything is wrong! Classes are auto-filled in when trying to access them from MyProject.
ide-fill-in http://www.tonyandrys.com/img/fillin.jpg
No build errors about missing classes, missing modules, class definitions, or anything related.
I get the same results if I try to access the class via its full package name as well.
// No dice.
final SimpleMapView mapView = new SimpleMapView(this, "apikey");
final com.androidnatic.maps.SimpleMapView mapView = new com.androidnatic.maps.SimpleMapView(this, "apikey");
It seems that there's only an issue when the application is running on my phone, as far as my IDE is concerned.
Here's the structure of MyProject:
main-project-structure http://www.tonyandrys.com/img/mainstructure.jpg
Here's my main project's dependency settings (where I assume I screwed up somewhere):
project-structure http://www.tonyandrys.com/img/projectstructure.jpg
And here is the structure of the mapex library module:
mapex-lib http://www.tonyandrys.com/img/mapexstructure.jpg
The class files that I'm trying to access live in MapExLib/gen and MapExLib/src, which are currently marked as source directories (blue).
Does anyone have any ideas on how to proceed from here?
Try to do this :
Android, IntelliJ Idea, changing module type
I had the same error "Could not find class XXX from referenced method XXX" with Intellij, involving an Android Test Module and a test which could not find the Activity class anywhere.
I set inside the Project Structure the main Module's Facet Android to Library Module (checkbox) and it worked...
Let us know

jni problems when system load the .so file

I have already created .so file and put it in proper path.
However,when I try to run the android program the problem came by.
the problem is:
`5-16 15:34:16.704: E/AndroidRuntime(9968): Caused by: java.lang.UnsatisfiedLinkError:
Cannot load library: reloc_library[1311]: 1584 cannot locate '_Z13raptor_decodePKhtPKtPhjPK15RaptorParam_tag'...
raptor_decode is a function which included by the jni_function.`
what should i do to correct this problem? Thanks.
I think here is your problem:
1584 cannot locate '_Z13raptor_decodePKhtPKtPhjPK15RaptorParam_tag'
if raptor_decode is the method you want to call, read up here: http://java.sun.com/docs/books/jni/html/design.html (and read up 11.3)

netty in android has error could not find class ClientBootstrap

I'm trying to run Echo example on Android's Emulator:
- The server is running well on my computer (windows 7)
- In OnCreate method of the AndroidWithNettyActivity(the class is created when I create Android project) I created new instance of AndroidEchoClient and invoke the run method.
When the Emulator start my activy (AndroidWithNettyActivity) it fails and show me dialog to force close.
Does anyone have experience about this problem?
In the log cat, there is error: [05-20 07:21:13.444: E/dalvikvm(325): Could not find class 'org.jboss.netty.bootstrap.ClientBootstrap', referenced from method Archer.Netty.Android.AndroidEchoClient.run]
It seems that the Emulator cannot find the ClientBootstrap class of netty's library (netty-3.4.5.Final.jar), but I don't know why because I already added netty's library in build path of my project.
Please help me, thank in advance :)
That's my stupid mistake, I'm just resolved this issue by exporting the netty's library with my adroid app

Categories

Resources