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 - Joystick support for android prevents compilation for targets < 12
Summary: Joystick support for android prevents compilation for targets < 12
Status: RESOLVED INVALID
Alias: None
Product: SDL
Classification: Unclassified
Component: *don't know* (show other bugs)
Version: HG 2.0
Hardware: All Android (All)
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-19 09:53 UTC by Michal Kolodziejczyk
Modified: 2013-11-19 15:18 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.