2016年4月5日 星期二

QB64 for Android Build Environment Setup for Windows XP

QB64 for Android Build Environment Setup for Windows XP

1. install Java JDK 7 windows x86 version
http://www.oracle.com/technetwork/es/java/javase/downloads/jdk7-downloads-1880260.html

2. install Android studio for windows version.
the path for studio can be c:\android\studio,
the path for sdk can be c:\android\sdk
http://developer.android.com/sdk/index.html

3. open a command prompt, goto c:\android\sdk run "sdk manager", install SDK API 21

4. install Android NDK for windows 32bit
unzip the zip file, copy to c:\android\ndk
http://developer.android.com/intl/zh-tw/ndk/downloads/index.html

5. because QB64 assume you use Windows x64. But you use XP.
QB64 assume you use NDK r9 or r10. But you use r11.
So some of the ndk file path need to modify.
rename 2 folder name "windows" to "windows-x86"

C:\Android\ndk\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86
C:\Android\ndk\toolchains\x86-4.9\prebuilt\windows-x86

6. follow QB64 install guide
http://www.qb64.net/wiki/index.php/Android_Project
6.1 download latest QB64 and unzip it to c:\android\qb64
http://www.qb64.net/release/dirty/2016_04_04__05_07_34__v0000/windows/qb64v0000-win.7z

6.2~6.4 already done in before steps.

6.5 modify ndk C++ flags
    Locate the file "C:\Users\{YourUserName}\AppData\Local\Android\sdk\ndk-bundle\build\core\default-build-commands.mk"

    Modify the TARGET_CXXFLAGS line to also contain "-fpermissive" as shown below:

TARGET_CXXFLAGS = $(TARGET_CFLAGS) -fno-exceptions -fno-rtti -fpermissive

6.6 Open QB64 and Enable the Google Android Run Menu commands in Options now.

6.7 Create the test program provided, save it as HelloAndroid.bas, then select Make Android Project from the Run menu 

DO
    COLOR RND * 15
    PRINT "Hello Android!";
    _DISPLAY
    _LIMIT 30
LOOP UNTIL INKEY$ = CHR$(27) 'Press KB and Show to get keyboard to hit Esc key quit bottom right
SYSTEM ' avoids Press any key entry

6.8 Open the project in Android Studio [8.png]
    Your project will begin to build immediately, open the Gradle Console tab (bottom right) [9.png] and wait for it to complete

7. Your APK will locate at C:\Android\qb64\programs\android\helloandroid\app\build\outputs\apk

8. If you don't like to build APK in Android Stduio. You can try to use command line tool for it.
8.1 create a batch file with below

set ANT_HOME=C:\Android\apache-ant
set ANT_BIN=$(ANT_HOME)/bin/
set JAVA_HOME="C:\Program Files\Java\jdk1.7.0_80"
set NDK_ROOT=C:\Android\ndk
set SDK_ROOT="C:\Android\sdk"

set ANDROID_HOME=%SDK_ROOT%
set ANDROID_NDK=%NDK_ROOT%
set ANDROID_SDK=%SDK_ROOT%

set PATH=C:\Android;%ANDROID_HOME%;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools;%ANT_HOME%\bin;%JAVA_HOME%\bin;%PATH%
rem set PATH=%NDK_ROOT%\prebuilt\windows-x86_64\bin;%NDK_ROOT%;%PATH%
set PATH=%NDK_ROOT%\prebuilt\windows\bin;%NDK_ROOT%;%PATH%

set PATH="C:\Android\Studio\gradle\gradle-2.8\bin";%PATH%

cmd.exe

8.2 run the batch, goto C:\Android\qb64\programs\android\helloandroid
run "gradle assembleDebug"

沒有留言:

張貼留言

追蹤者