Updated Compilation guide (android from windows) (markdown)

John Grub 2014-06-10 16:45:40 -07:00
parent 464ad0e4cc
commit b055f9b770
2 changed files with 37 additions and 62 deletions

@ -0,0 +1,37 @@
## Prerequisites
You need a complete android development environment ready to develop native apps. That means:
* Android SDK
* Android NDK
Use Google to figure out how to install that and make sure the appropriate executables from the above are in your path variable.
## Building libretro cores
```bash
git clone https://github.com/libretro/libretro-super.git
cd libretro-super
./libretro-fetch.sh # can fail on fork() calls, repeat until all are up to date
./libretro-build-android-mk.sh # some cores may fail to compile (g++ "Argument list too long" error)
# see https://github.com/libretro/libretro-super/issues/10
```
## Building RetroArch
The RetroArch repo is fetched into the `libretro-super` folder as `retroarch` by `./libretro-fetch.sh` above.
```bash
cd retroarch/android/phoenix
android update project --path libs/googleplay/
android update project --path libs/appcompat/
```
Now edit `local.properties` to point to the location of your ndk directory by adding a line like this: `ndk.dir=/complete/path/to/android-ndk-r9d`
```bash
mkdir -p assets/cores
cp ../../../dist/android/armeabi-v7a/* assets/cores/ #replace armeabi-v7a here by mips or x86 for those targets
cp -r ../../../dist/info/ assets/
ant clean
ant debug
```
If all goes well, this will spit out an .apk, `bin/retroarch-debug.apk`. Put it on your device with
```bash
adb -d install bin/retroarch-debug.apk
```
Use `install -r` if you're reinstalling over an existing install.

@ -1,62 +0,0 @@
## Prerequisites
You need a complete android development environment ready to develop native apps. That means:
* Cygwin
* Android SDK
* Android NDK
* Eclipse with appropriate plugins
Use Google to figure out how to install all that. Everything in this page happens in a Cygwin shell and in Eclipse.
Make sure you set NDK_ROOT to the path to your NDK and add that to your PATH in the Cygwin shell. For example, edit your .bashrc to add these lines:
```bash
export NDK_ROOT=/cygdrive/d/Dev/Libs/Android/android-ndk-r8e
export PATH=$NDK_ROOT:$PATH
```
## Building libretro cores
```bash
git clone https://github.com/libretro/libretro-super.git
cd libretro-super
./libretro-fetch.sh # can fail on fork() calls, repeat until all are up to date
./libretro-build-android-mk.sh # some cores may fail to compile (g++ "Argument list too long" error)
# see https://github.com/libretro/libretro-super/issues/10
```
## Building RetroArch
The RetroArch repo is fetched into the libretro-super folder as retroarch by `./libretro-fetch.sh` above.
```bash
cd retroarch/android/native
ndk-build clean APP_ABI="armeabi-v7a mips x86"
ndk-build APP_ABI="armeabi-v7a mips x86" APP_PLATFORM=android-17 # build native libs
cd ../phoenix
cp -R ../native/libs/* libs # copy native libs
cp -R ../../../dist/android/* libs # copy libretro cores
```
When you need to rebuild the native code, run this from retroarch/android/native:
```bash
ndk-build APP_ABI="armeabi-v7a mips x86" APP_PLATFORM=android-17
cp -R -f libs/* ../phoenix/libs
```
## Building the .apk
You can choose to use the Eclipse gui or the command line tool `ant`
### Building with ant
From the android/phoenix directory in the RetroArch repo:
```bash
android update project --path libs/googleplay/
android update project --path libs/appcompat/
```
Now edit local.properties to point to the location of your ndk directory by adding a line like this: `ndk.dir=/complete/path/to/android-ndk-r9d`
```bash
ant clean
ant debug
```
If all goes well this will spit out an .apk, `bin/retroarch-debug.apk`. Put it on your device with
```bash
adb -d install bin/retroarch-debug.apk
```
### Building with eclipse
In Eclipse, set your workspace root to .../RetroArch/android. Then do "Import... - General - Existing Projects into Workspace" to get the native and phoenix projects in your workspace. I also copied the project.properties from phoenix to native, and created a src directory in native, to stop Eclipse from complaining, but that may just be because I'm using a really old version.
Then, when you want to deploy to your device (make sure USB debugging is enabled) right-click on the phoenix project and select "Run As - Android Application" or use Debug to attach the debugger. When the native libs change I will tend to Clean before doing Run, to make sure the libs were repackaged in the apk. Google for more info about running and debugging Android apps in Eclipse.