aries@uu3g:/wp/qt-creator-android-qt-creator$ ls
distHACKING LICENSE.LGPL qtcreator.proscriptssrc
doc LGPL_EXCEPTION.TXTqtcreator.priREADME share tests
export ANDROID_NDK_ROOT=/opt/android-ndk-r5
export ANDROID_NDK_HOST=linux-x86
export ANDROID_NDK_TOOLCHAIN_PREFIX=arm-linux-androideabi
export ANDROID_NDK_TOOLCHAIN_VERSION=4.4.3
export ANDROID_NDK_PLATFORM=android-8
./androidconfigbuild.shsudo mkdir /data/local/qt
sudo make install
aries@uu3g:~$ emulator -avd android2.2 -partition-size 256
#!/bin/sh

adb shell rm -r /data/local/qt || exit 0
rm -fr al
mkdir al
cp -a lib/*.so* al/

/opt/android-ndk-r5/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-strip --strip-unneeded al/*

adb push al /data/local/qt/lib
adb push imports /data/local/qt/imports
adb push plugins /data/local/qt/plugins
......
#修改以下2行,指向你的android-sdk和android-lighthouse源码路径
SDK_ROOT=/home/buus/dev/android-sdk-linux_x86
LIGHTHOUSE_ROOT=/home/buus/dev/android-lighthouse
......
#我的android-sdk里面,adb在platform-tools目录下面,所以修改为$SDK_ROOT/platform-tools/adb
\$SDK_ROOT/tools/adb install -r bin/\$PROJECT_NAME-debug.apk
......
#同上
\$SDK_ROOT/tools/adb shell am start -n org.\$PROJECT_NAME.qt/.QtMain
......
#同上
\$SDK_ROOT/tools/adb install -r bin/\$PROJECT_NAME-debug.apk
cp $LIGHTHOUSE_ROOT/examples/android/QtAnimatedtiles/AndroidManifest.xml $J_PRO/AndroidManifest.xml
cp -r $LIGHTHOUSE_ROOT/src/android/java/src/com $PROJECT_NAME-java/src
sed -i "s/animatedtiles/$PROJECT_NAME/g" $J_PRO/AndroidManifest.xml
cp \$Q_PRO/lib\$PROJECT_NAME.so* \$J_PRO/libs/armeabi #我们编译cpp代码时是生成可执行文件,不是生成动态库
cp $LIGHTHOUSE_ROOT/src/android/java/AndroidManifest.xml $J_PRO/AndroidManifest.xml
cp -r $LIGHTHOUSE_ROOT/src/android/java/src/* $PROJECT_NAME-java/src
cp -r $LIGHTHOUSE_ROOT/src/android/java/res/* $PROJECT_NAME-java/res
sed -i "s/animatedtiles/$PROJECT_NAME/g" $J_PRO/src/org/$PROJECT_NAME/qt/QtMain.java
sed -i "s/calculator/$PROJECT_NAME/g" $J_PRO/src/com/nokia/qt/android/QtActivity.java
sed -i "s/example.name/$PROJECT_NAME.qt/g" $J_PRO/AndroidManifest.xml
sed -i "s/Application name/$PROJECT_NAME/g" $J_PRO/res/values/strings.xml
cp \$Q_PRO/\$PROJECT_NAME \$J_PRO/libs/armeabi/lib\$PROJECT_NAME.so #我们编译cpp代码时是生成可执行文件,不是生成动态库,但这里必须以动态库的形式加载
./create_android_lighthouse_project.sh -n calculator

./build.sh

aries@uu3g:/wp/android-lighthouse$ rm calculator-cpp/* -rf
aries@uu3g:/wp/android-lighthouse$ cp calculator/* calculator-cpp/
aries@uu3g:/wp/android-lighthouse$ ./build.sh
/opt/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 -I/wp/android-lighthouse/src/3rdparty/android/precompiled/android-8/arch-arm/include -Os -g -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -Wall -W -D_REENTRANT -DQT_NO_CORESERVICES -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I../mkspecs/android-g++ -I. -I../include/QtCore -I../include/QtNetwork -I../include/QtGui -I../include -I.moc/release-shared -I/opt/android-ndk-r5/platforms/android-8/arch-arm/usr/include -I/opt/android-ndk-r5/sources/cxx-stl/gnu-libstdc++/include -I/opt/android-ndk-r5/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include -o .obj/release-shared/button.o button.cpp
.......
-obfuscate:

-dex:
[echo] Converting compiled files and external libraries into /wp/android-lighthouse/calculator-java/bin/classes.dex...

-package-resources:
[echo] Packaging resources
[aapt] Creating full resource package...

-package-debug-sign:
[apkbuilder] Creating calculator-debug-unaligned.apk and signing it with a debug key...

debug:
[echo] Running zip align on final apk...
[echo] Debug Package: /wp/android-lighthouse/calculator-java/bin/calculator-debug.apk

BUILD SUCCESSFUL
Total time: 8 seconds
652 KB/s (304878 bytes in 0.456s)
pkg: /data/local/tmp/calculator-debug.apk
Success

adb logcat

发表回复