We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2251

Summary: Joystick support for android prevents compilation for targets < 12
Product: SDL Reporter: Michal Kolodziejczyk <miko>
Component: *don't know*Assignee: Ryan C. Gordon <icculus>
Status: RESOLVED INVALID QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: gabomdq
Version: HG 2.0   
Hardware: All   
OS: Android (All)   

Description Michal Kolodziejczyk 2013-11-19 09:53:28 UTC
Recently added patch for handling joysticks on android triggers compilation error when compiling for android target < android-12:

-pre-compile:

-compile:
    [javac] Compiling 4 source files to bin/classes
    [javac] src/org/libsdl/app/SDLActivity.java:957: error: cannot find symbol
    [javac] class SDLGenericMotionListener_API12 implements View.OnGenericMotionListener {
    [javac]                                                     ^
    [javac]   symbol:   class OnGenericMotionListener
    [javac]   location: class View
    [javac] src/org/libsdl/app/SDLActivity.java:494: error: cannot find symbol
    [javac]             setOnGenericMotionListener(new SDLGenericMotionListener_API12());
    [javac]             ^
    [javac]   symbol:   method setOnGenericMotionListener(SDLGenericMotionListener_API12)
    [javac]   location: class SDLSurface
    [javac] src/org/libsdl/app/SDLActivity.java:890: error: cannot find symbol

(and other joystick related errors).
The code should probably handle cases for target < android-12, at least by using #ifdefs to omit the new API code.

It compiles OK for SDL 2.0.1. (tried target android-10)
Comment 1 Gabriel Jacobo 2013-11-19 14:15:00 UTC
You have to compile with target-12 as shipped by default in SDL and in AndroidManifest.xml:

<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="12" />

Doing it like this, the app will work on API level 10 devices with no problem. Please see the README-android.txt file for more details.

Also, #ifdefs don't exist in Java!
Comment 2 Michal Kolodziejczyk 2013-11-19 15:18:06 UTC
Confirmed, sorry for the noise (I forgot why I set it for android-10, but it worked for me). Everything is OK now.