将第三方库添加到必需的Qt项目中?

时间:2012-03-03 14:22:02

标签: android

我想在我的必需品Qt项目中添加一个外部库,所以我将以下行添加到.pro文件中:

INCLUDEPATH + = $$ PWD / include

LIBS + = -L $$ PWD / shared / libs / armeabi -lopenal

但是,当我开始运行我的应用程序时,它无法启动:

m( 3443): DexOpt: --- BEGIN 'QtIndustrius-14.jar' (bootstrap=0) ---
D/dalvikvm( 3443): DexOpt: --- END 'QtIndustrius-14.jar' (success) ---
D/dalvikvm( 3443): DEX prep '/data/data/org.kde.necessitas.ministro/files/qt/jar/QtIndustrius-14.jar': unzip in 22ms, rewrite 438ms
D/dalvikvm( 3443): Trying to load lib /data/data/org.kde.necessitas.ministro/files/qt/lib/libQtCore.so 0x4050e990 
D/dalvikvm( 3443): Added shared lib /data/data/org.kde.necessitas.ministro/files/qt/lib/libQtCore.so 0x4050e990 
D/dalvikvm( 3443): No JNI_OnLoad found in /data/data/org.kde.necessitas.ministro/files/qt/lib/libQtCore.so 0x4050e990, 
skipping init
D/dalvikvm( 3443): Trying to load lib /data/data/org.kde.necessitas.ministro/files/qt/lib/libQtGui.so 0x4050e990 
D/dalvikvm( 3443): Added shared lib /data/data/org.kde.necessitas.ministro/files/qt/lib/libQtGui.so 0x4050e990 
D/dalvikvm( 3443): No JNI_OnLoad found in /data/data/org.kde.necessitas.ministro/files/qt/lib/libQtGui.so 0x4050e990, 
skipping init
D/dalvikvm( 3443): Trying to load lib /data/data/org.kde.necessitas.ministro/files/qt/plugins/platforms/android/ 
libandroid-9.so 0x4050e990
D/dalvikvm( 3443): Added shared lib /data/data/org.kde.necessitas.ministro/files/qt/plugins/platforms/android/ 
libandroid-9.so 0x4050e990
I/Qt      ( 3443): qt start
D/dalvikvm( 3443): Trying to load lib /data/data/org.kde.necessitas.example.AndroidPlayer/lib/libAndroidPlayer.so 
0x4050e990
W/System.err( 3443): java.lang.reflect.InvocationTargetException
W/System.err( 3443):         at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err( 3443):         at java.lang.reflect.Method.invoke(Method.java:507)
W/System.err( 3443):         at org.kde.necessitas.origo.QtActivity.loadApplication(QtActivity.java:144) 
W/System.err( 3443):         at org.kde.necessitas.origo.QtActivity.access $200(QtActivity.java:77)
W/System.err( 3443):         at org.kde.necessitas.origo.QtActivity $3$1$1.run(QtActivity.java:201)
W/System.err( 3443):         at android.os.Handler.handleCallback(Handler.java:587)
W/System.err( 3443):         at android.os.Handler.dispatchMessage(Handler.java:92)
W/System.err( 3443):         at android.os.Looper.loop(Looper.java:123)
W/System.err( 3443):         at android.app.ActivityThread.main(ActivityThread.java:3683)
W/System.err( 3443):         at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err( 3443):         at java.lang.reflect.Method.invoke(Method.java: 507)
W/System.err( 3443):         at com.android.internal.os.ZygoteInit $MethodAndArgsCaller.run(ZygoteInit.java:839)
W/System.err( 3443):         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
W/System.err( 3443):         at dalvik.system.NativeStart.main(Native Method)
W/System.err( 3443): Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: link_image[1962]:    33 could not load needed library
'libopenal.so' for 'libAndroidPlayer.so' (load_library[1104]: Library 'libopenal.so' not found)
W/System.err( 3443):         at java.lang.Runtime.load(Runtime.java:394)
W/System.err( 3443):         at java.lang.System.load(System.java:534)
W/System.err( 3443):         at org.kde.necessitas.industrius.QtNative.loadBundledLibraries(QtNative.java: 125) 
W/System.err( 3443):         at org.kde.necessitas.industrius.QtActivityDelegate.loadApplication(QtActivityDelegate.java: 245)
W/System.err( 3443):         ... 14 more

但是当我使用外部lib删除这些行和文件时,我的应用程序运行良好。 我已经将libopenal.so推送到/ data / local / lib,并通过“export LD_LIBRARY_PATH = $ LD_LIBRARY_PATH:/ data / local / lib”将其添加到全局环境中

那么如何在项目中添加第三方库?以及如何将它们放入我的apk中?

1 个答案:

答案 0 :(得分:0)

在Eclipse中,单击“配置构建路径”,然后单击“添加JAR”,然后选择您的库。