To build your raylib game for Android you need a set of Android tools. Those tools are basically the Android SDK and Android NDK, including Android Platform Tools and also Java Runtime.
To build your raylib game for Android you need a set of Android tools. Those tools are basically the Android SDK and Android NDK, including Android Platform Tools and also Java Runtime.
**NOTE: For alternative instructions, check [Working for Android (on macOS)](https://github.com/raysan5/raylib/wiki/Working-for-Android-(on-macOS)).**
### Installing Android required tools
### Installing Android required tools
1. [Java 8 JDK and JRE](http://www.oracle.com/technetwork/java/javase/downloads/index.html)
1. [Java 8 JDK and JRE](http://www.oracle.com/technetwork/java/javase/downloads/index.html)
@ -57,228 +59,3 @@ _Step 4:_ To view log output from device:
[raysan5]: mailto:raysan5@gmail.com "Ramon Santamaria - Ray San"
[raysan5]: mailto:raysan5@gmail.com "Ramon Santamaria - Ray San"
# Simple Process for Building for Android on MAC OSX
It's helpful to know step by step what each part of the process is doing. For this, let's create a simple bash script, where each line can be run manually and the results can be seen. This should be useful for understanding the process on Linux as well.
This is simple as in we're just using shell commands, no cmake, no builders of any kind.
## Folder Setup
> Note: project.c is copied from raylib/templates/simple_game/simple_game.c
/toolchain_arm_api22 put android_toolchain_arm_api22 here
/raylib put raylib here
/project1/lib
/project1/obj
/project1/src
/project1/dex
/project1/res/values/strings.xml
/project1/assets
/project1/project.c
/project1/AndroidManifest.xml
### /res/values/strings.xml
> Note: This is likely not necessary.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<stringname="app_name">My App</string>
</resources>
### /src/com/seth/project/NativeLoader.java
> Note: My project is named "project" and the namespace is named "seth"
package com.seth.project;
public class NativeLoader extends android.app.NativeActivity {
static {
System.loadLibrary("project"); // must match name of shared library (in this case libproject.so)
}
}
AndroidManifest.xml
> Note: "package" is the unique name of your project, this will overwrite apps with the same name
You'll get this if your shared library's name does not match across the build. In my case, I was referencing projectlibrary in the java file where it should have just been "project"
## Error: INSTALL_FAILED_NO_MATCHING_ABIS
This one was tricky! Make sure the platform of the standalone toolchain you build matches the platform you are using on your system.
This one was easier. The Apk generated must contain classes/classes.dex. If it doesn't, check aapt package -f -M to make sure you are including the folder dex is in at the end of it.
## Dealing with Segmentation Faults - Using adb logcat
In the event of a segfault, don't despair! You can get the entire backtrace using adb logcat.
```
adb logcat "libc:*" "DEBUG:*" "*:S"
```
This gives you everything tagged with libc or DEBUG. "*:S" is there to Silence all other stuff.
Now, you may see a message that says "Suppressing debuggerd output because prctl(PR_GET_DUMPABLE)==0"
In that case you have to set this to 1.
In your c code, dd this include statement, and the prctl command somewhere early on in your main():