开发者

Android & jar file compatibility

开发者 https://www.devze.com 2023-04-10 17:57 出处:网络
How does one find out if a jar is Android compatible, meaning it does not 开发者_如何学Ccontain imports from class not contained in Android.jar?

How does one find out if a jar is Android compatible, meaning it does not 开发者_如何学Ccontain imports from class not contained in Android.jar?

I'm trying to build a app that uses the MySQL J connector thingy (and YES, I know about SQLite's existence, but i need the MySQL thingy to work - for remote querying) and when i add the external jar, i get:

Conversion to Dalvik format failed with error 1

I've done my Googling and found this article: http://bimbim.in/post/2010/09/24/Reason-of-Conversion-to-dalvik-format-failed-with-error-1.aspx which states, as most answers given on stackoverflow on similar problems that i should: remove all jars, clean project, fix-project-properties.

Did this, but problem persist so I'm assuming that somewhere in this jar there is a class that uses an import that android.jar's java doesn't contain... but i could be wrong, i usually am.

So... Anyone?


It is not possible to use the MySQL connector in Android. You need to create a layer on the server that is hosting your MySQL.

I read about the reason why Android and MySQL can't directly talk to each other, but of course I can't find the post, so you'll have to do with my answer :P

Check out this tutorial out on how to use a php script to process MySQL tables to JSon:

http://www.helloandroid.com/tutorials/connecting-mysql-database


The source code is included with the MySQL J connector download. Is it possible to use the source and build and compile java code for Android?


Try building the project from the command line.

(assuming you have ant, and the android tool that comes with the sdk is in your path)

android update project -p . -t android-10
ant debug

(use whatever android target level your project needs, for the -t option)

If this succeeds, then your problem has something to do with eclipse, not a problem with the jar you are using. And if it fails, it will likely give you a more helpful message than "Conversion to Dalvik format failed".

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号