ViniciusDamiati / android-lighthouse

Automatically exported from code.google.com/p/android-lighthouse
0 stars 0 forks source link

can not run qt application on android #66

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
when i run a qt app on android,it's crashed.because app can not find a  native 
function:startQtApp.I find it in libQtAndroidMain.a,but I don't know how to 
link it to my applicaiont.

this is logcat:
W/dalvikvm( 1514): No implementation found for native 
Lcom/nokia/qt/android/QtApplication;.startQtApp (Ljava/lang/Object;)V
D/AndroidRuntime( 1514): Shutting down VM
W/dalvikvm( 1514): threadid=1: thread exiting with uncaught exception 
(group=0x4001d7e0)
E/AndroidRuntime( 1514): FATAL EXCEPTION: main
E/AndroidRuntime( 1514): java.lang.UnsatisfiedLinkError: startQtApp
E/AndroidRuntime( 1514):        at 
com.nokia.qt.android.QtApplication.startQtApp(Native Method)
E/AndroidRuntime( 1514):        at 
com.nokia.qt.android.QtApplication.startApplication(QtApplication.java:238)
E/AndroidRuntime( 1514):        at 
com.nokia.qt.android.QtActivity.onCreate(QtActivity.java:248)
E/AndroidRuntime( 1514):        at 
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
E/AndroidRuntime( 1514):        at 
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
E/AndroidRuntime( 1514):        at 
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
E/AndroidRuntime( 1514):        at 
android.app.ActivityThread.access$2300(ActivityThread.java:125)
E/AndroidRuntime( 1514):        at 
android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
E/AndroidRuntime( 1514):        at 
android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 1514):        at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 1514):        at 
android.app.ActivityThread.main(ActivityThread.java:4627)
E/AndroidRuntime( 1514):        at java.lang.reflect.Method.invokeNative(Native 
Method)
E/AndroidRuntime( 1514):        at 
java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 1514):        at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
E/AndroidRuntime( 1514):        at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
E/AndroidRuntime( 1514):        at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager(  795):   Force finishing activity org.myqtapp.qt/.QtMain
W/ActivityManager(  795): Activity pause timeout for HistoryRecord{43b93d48 
org.myqtapp.qt/.QtMain}
I/Process ( 1514): Sending signal. PID: 1514 SIG: 9
I/ActivityManager(  795): Process org.myqtapp.qt (pid 1514) has died.
W/InputManagerService(  795): Window already focused, ignoring focus gain of: 
com.android.internal.view.IInputMethodClient$Stub$Proxy@43a8c698
D/dalvikvm(  983): GC_EXPLICIT freed 34 objects / 1224 bytes in 24ms

Original issue reported on code.google.com by ireallyw...@gmail.com on 13 Jan 2011 at 9:20

GoogleCodeExporter commented 9 years ago
I have meet the same issue.
I used android official NDK r5 to compile android-lighthouse and example code, 
and target runs on android 2.2.
The following is the logcat output:

D/AndroidRuntime(  358): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
D/AndroidRuntime(  358): CheckJNI is ON
D/AndroidRuntime(  358): --- registering native functions ---
I/ActivityManager(   60): Starting activity: Intent { flg=0x10000000 
cmp=org.anim.qt/.QtMain }
D/AndroidRuntime(  358): Shutting down VM
D/jdwp    (  358): adbd disconnected
I/AndroidRuntime(  358): NOTE: attach of thread 'Binder Thread #3' failed
I/ActivityManager(   60): Start proc org.anim.qt for activity 
org.anim.qt/.QtMain: pid=365 uid=10040 gids={1015}
E/Qt JAVA (  365): Can't create main activity
E/Qt JAVA (  365): java.lang.NullPointerException
E/Qt JAVA (  365):  at 
com.nokia.qt.android.QtActivity.onCreate(QtActivity.java:208)
E/Qt JAVA (  365):  at 
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
E/Qt JAVA (  365):  at 
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
E/Qt JAVA (  365):  at 
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
E/Qt JAVA (  365):  at 
android.app.ActivityThread.access$2300(ActivityThread.java:125)
E/Qt JAVA (  365):  at 
android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
E/Qt JAVA (  365):  at android.os.Handler.dispatchMessage(Handler.java:99)
E/Qt JAVA (  365):  at android.os.Looper.loop(Looper.java:123)
E/Qt JAVA (  365):  at android.app.ActivityThread.main(ActivityThread.java:4627)
E/Qt JAVA (  365):  at java.lang.reflect.Method.invokeNative(Native Method)
E/Qt JAVA (  365):  at java.lang.reflect.Method.invoke(Method.java:521)
E/Qt JAVA (  365):  at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
E/Qt JAVA (  365):  at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
E/Qt JAVA (  365):  at dalvik.system.NativeStart.main(Native Method)
I/Qt JAVA (  365): onResume
W/dalvikvm(  365): No implementation found for native 
Lcom/nokia/qt/android/QtApplication;.resumeQtApp ()V
D/AndroidRuntime(  365): Shutting down VM
W/dalvikvm(  365): threadid=1: thread exiting with uncaught exception 
(group=0x4001d800)
E/AndroidRuntime(  365): FATAL EXCEPTION: main
E/AndroidRuntime(  365): java.lang.UnsatisfiedLinkError: resumeQtApp
E/AndroidRuntime(  365):    at 
com.nokia.qt.android.QtApplication.resumeQtApp(Native Method)
E/AndroidRuntime(  365):    at 
com.nokia.qt.android.QtActivity.onResume(QtActivity.java:274)
E/AndroidRuntime(  365):    at 
android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1149)
E/AndroidRuntime(  365):    at 
android.app.Activity.performResume(Activity.java:3823)
E/AndroidRuntime(  365):    at 
android.app.ActivityThread.performResumeActivity(ActivityThread.java:3118)
E/AndroidRuntime(  365):    at 
android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3143)
E/AndroidRuntime(  365):    at 
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2684)
E/AndroidRuntime(  365):    at 
android.app.ActivityThread.access$2300(ActivityThread.java:125)
E/AndroidRuntime(  365):    at 
android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
E/AndroidRuntime(  365):    at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(  365):    at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime(  365):    at 
android.app.ActivityThread.main(ActivityThread.java:4627)
E/AndroidRuntime(  365):    at java.lang.reflect.Method.invokeNative(Native 
Method)
E/AndroidRuntime(  365):    at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime(  365):    at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
E/AndroidRuntime(  365):    at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
E/AndroidRuntime(  365):    at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager(   60):   Force finishing activity org.anim.qt/.QtMain
W/ActivityManager(   60): Activity pause timeout for HistoryRecord{43f80a78 
org.anim.qt/.QtMain}
W/ActivityManager(   60): Activity destroy timeout for HistoryRecord{43f80a78 
org.anim.qt/.QtMain}
D/SntpClient(   60): request time failed: java.net.SocketException: Address 
family not supported by protocol

Original comment by dodohack on 14 Jan 2011 at 2:17

GoogleCodeExporter commented 9 years ago
I got a solutin:
remove the following lines from you .pro file: 
TEMPLATE = app 
android-g++ { 
    TEMPLATE = lib 
    CONFIG += dll 
} 

Original comment by ireallyw...@gmail.com on 14 Jan 2011 at 3:07

GoogleCodeExporter commented 9 years ago
I found the solution.

I used the shell script "create_android_lighthouse_project.sh" to create java 
code, but something missed in created AndroidManifest.xml, In my case, 
"qt_lib_resource_id" and so on is not given in AndroidManifest.xml, so 
exception happens when creating activity.

The problem solved by replace myproj-java/AndroidManifest.xml with 
src/android/java/AndroidManifest.xml.

Original comment by dodohack on 14 Jan 2011 at 7:06

GoogleCodeExporter commented 9 years ago
I'm also experiencing the same problems.

I tried the solution with using src/android/java/AndroidManifers.xml, but then 
I got Java compilation errors.

It seems that Java cannot find the newly added resources. Does anyone have any 
idea how to resolve this?

/data/local/qt/bin/uic mainwindow.ui -o ui_mainwindow.h
/usr/local/android-ndk-r5/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-
x86/bin/arm-linux-androideabi-g++ -c -Wno-psabi -march=armv5te -mtune=xscale 
-msoft-float -fpic -mthumb -ffunction-sections -funwind-tables 
-fstack-protector -fno-short-enums -DANDROID -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ 
-D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -DQT_NO_QWS_TRANSFORMED -Os -g 
-fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -Wall -W 
-D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB 
-DQT_SHARED -I../../android-lighthouse/mkspecs/android-g++ -I. 
-I../../android-lighthouse/include/QtCore 
-I../../android-lighthouse/include/QtNetwork 
-I../../android-lighthouse/include/QtGui -I../../android-lighthouse/include -I. 
-I. -I/usr/local/android-ndk-r5/platforms/android-8/arch-arm/usr/include 
-I../../android-ndk-r5/sources/cxx-stl/gnu-libstdc++/include 
-I../../android-ndk-r5/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include -o 
main.o main.cpp
/usr/local/android-ndk-r5/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-
x86/bin/arm-linux-androideabi-g++ -c -Wno-psabi -march=armv5te -mtune=xscale 
-msoft-float -fpic -mthumb -ffunction-sections -funwind-tables 
-fstack-protector -fno-short-enums -DANDROID -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ 
-D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -DQT_NO_QWS_TRANSFORMED -Os -g 
-fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -Wall -W 
-D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB 
-DQT_SHARED -I../../android-lighthouse/mkspecs/android-g++ -I. 
-I../../android-lighthouse/include/QtCore 
-I../../android-lighthouse/include/QtNetwork 
-I../../android-lighthouse/include/QtGui -I../../android-lighthouse/include -I. 
-I. -I/usr/local/android-ndk-r5/platforms/android-8/arch-arm/usr/include 
-I../../android-ndk-r5/sources/cxx-stl/gnu-libstdc++/include 
-I../../android-ndk-r5/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include -o 
mainwindow.o mainwindow.cpp
/data/local/qt/bin/moc -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB 
-DQT_CORE_LIB -DQT_SHARED -I../../android-lighthouse/mkspecs/android-g++ -I. 
-I../../android-lighthouse/include/QtCore 
-I../../android-lighthouse/include/QtNetwork 
-I../../android-lighthouse/include/QtGui -I../../android-lighthouse/include -I. 
-I. -I/usr/local/android-ndk-r5/platforms/android-8/arch-arm/usr/include 
-I../../android-ndk-r5/sources/cxx-stl/gnu-libstdc++/include 
-I../../android-ndk-r5/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include 
mainwindow.h -o moc_mainwindow.cpp
/usr/local/android-ndk-r5/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-
x86/bin/arm-linux-androideabi-g++ -c -Wno-psabi -march=armv5te -mtune=xscale 
-msoft-float -fpic -mthumb -ffunction-sections -funwind-tables 
-fstack-protector -fno-short-enums -DANDROID -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ 
-D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -DQT_NO_QWS_TRANSFORMED -Os -g 
-fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -Wall -W 
-D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB 
-DQT_SHARED -I../../android-lighthouse/mkspecs/android-g++ -I. 
-I../../android-lighthouse/include/QtCore 
-I../../android-lighthouse/include/QtNetwork 
-I../../android-lighthouse/include/QtGui -I../../android-lighthouse/include -I. 
-I. -I/usr/local/android-ndk-r5/platforms/android-8/arch-arm/usr/include 
-I../../android-ndk-r5/sources/cxx-stl/gnu-libstdc++/include 
-I../../android-ndk-r5/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include -o 
moc_mainwindow.o moc_mainwindow.cpp
rm -f libQtTest6.so.1.0.0 libQtTest6.so libQtTest6.so.1 libQtTest6.so.1.0
/usr/local/android-ndk-r5/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-
x86/bin/arm-linux-androideabi-g++ 
--sysroot=/usr/local/android-ndk-r5/platforms/android-8/arch-arm/ 
-L/usr/local/android-ndk-r5/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linu
x-x86/bin/../lib/gcc/arm-linux-androideabi/4.4.3 
-Wl,-rpath-link=/usr/local/android-ndk-r5/platforms/android-8/arch-arm//usr/lib 
-Wl,-O1 -Wl,-rpath=/data/local/qt/lib -Wl,-rpath=/data/local/lib 
-Wl,-rpath=/system/lib/data/local/qt/lib -Wl,--no-undefined -Wl,-z,noexecstack 
-shared -o libQtTest6.so.1.0.0 main.o mainwindow.o moc_mainwindow.o   
-L/usr/local/android-ndk-r5/sources/cxx-stl/gnu-libstdc++/libs/armeabi 
-L/usr/local/android-ndk-r5/platforms/android-8/arch-arm//usr/lib 
-L/data/local/qt/lib -lQtGui 
-L/home/vmplanet/tc/android-lighthouse/src/3rdparty/android/precompiled/android-
5/arch-arm/lib -L/home/vmplanet/tc/android-lighthouse/lib 
-L/usr/local/android-ndk-r5/sources/cxx-stl/gnu-libstdc++/libs/armeabi 
-L/usr/local/android-ndk-r5/platforms/android-5/arch-arm//usr/lib -lQtNetwork 
-lQtCore -lstdc++ -lsupc++ -llog -lz -lm -ldl -lc -lgcc  
ln -s libQtTest6.so.1.0.0 libQtTest6.so
ln -s libQtTest6.so.1.0.0 libQtTest6.so.1
ln -s libQtTest6.so.1.0.0 libQtTest6.so.1.0
Buildfile: /home/vmplanet/tc/QtTest6/QtTest6-java/build.xml
    [setup] Android SDK Tools Revision 8
    [setup] Project Target: Android 2.1-update1
    [setup] API level: 7
    [setup] 
    [setup] ------------------
    [setup] Resolving library dependencies:
    [setup] No library dependencies.
    [setup] 
    [setup] ------------------
    [setup] 
    [setup] WARNING: No minSdkVersion value set. Application will install on all Android versions.
    [setup] 
    [setup] Importing rules file: tools/ant/main_rules.xml

-debug-obfuscation-check:

-set-debug-mode:

-compile-tested-if-test:

-dirs:
     [echo] Creating output directories if needed...
    [mkdir] Created dir: /home/vmplanet/tc/QtTest6/QtTest6-java/gen
    [mkdir] Created dir: /home/vmplanet/tc/QtTest6/QtTest6-java/bin/classes

-pre-build:

-resource-src:
     [echo] Generating R.java / Manifest.java from the resources...
     [null] /home/vmplanet/tc/QtTest6/QtTest6-java/AndroidManifest.xml:14: error: Error: No resource found that matches the given name (at 'resource' with value '@array/pre_qt_bundled_libs').
     [null] /home/vmplanet/tc/QtTest6/QtTest6-java/AndroidManifest.xml:16: error: Error: No resource found that matches the given name (at 'resource' with value '@array/qt_libs').
     [null] /home/vmplanet/tc/QtTest6/QtTest6-java/AndroidManifest.xml:18: error: Error: No resource found that matches the given name (at 'resource' with value '@array/post_qt_bundled_libs').

BUILD FAILED
/home/vmplanet/tc/android-sdk-linux_86/tools/ant/main_rules.xml:306: null 
returned: 1

Total time: 1 second
Ant failed

Original comment by mikejong...@gmail.com on 16 Jan 2011 at 1:19

GoogleCodeExporter commented 9 years ago
Please use the latest SDK (http://sourceforge.net/projects/necessitas/files/).

Thank you.

Original comment by taipanro...@gmail.com on 21 Feb 2011 at 11:44

GoogleCodeExporter commented 9 years ago

Original comment by taipanro...@gmail.com on 21 Feb 2011 at 11:44