java.lang.UnsatisfiedLinkError when running with dalvikvm
I'm trying to run a JAR file I built using the following command line (from adb shell):
dalvikvm -cp /sdcard/MyJar.jar MyJar.main.Main
My Main class has only a single method main
:
public static void main(String[] args)
{
// Connect to local db
SQLiteDatabase db = SQLiteDatabase.openDatabase(DB_PATH, null, SQLiteDatabase.OPEN_READWRITE);
}
When I run the command line it looks like the main
function runs but then I get the following exception:
java.lang.UnsatisfiedLinkError: native_get_int
at android.os.SystemProperties.native_get_int(Native Method)
at android.os.SystemProperties.getInt(SystemProperties.java:74)
at android.database.sqlite.SQLiteDatabase.<init开发者_运维技巧>(SQLiteDatabase.java:1846)
at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:820)
at MyJar.main.Main.main(Main.java:146)
at dalvik.system.NativeStart.main(Native Method)
My guess is that I need to load some kind of library to resolve this link error but I have no clue which library it is (this seems like a basic thing that probably should have been loaded by dalvikvm...).
Any ideas ?
Try running app_process
instead of dalvikvm
.
Vogar makes this kind of thing very easy. Check out the latest vogar from their SVN page, build it with ant, and then run this on your Linux desktop
~/Projects/vogar/bin/vogar --mode app_process ~/myapp/src/com/me/Main.java
Vogar will build your .java
, create a .dex
file, use adb
to copy that to your device, and then execute VM on the device for you. We use it to develop Dalvik.
精彩评论