Skip to content

SDLActivity.java:1948: error: cannot find symbol case MotionEvent.ACTION_BUTTON_PRESS: #1697

Closed

Description

@Meteorix

Versions

  • Python: 2.7.15
  • OS: Ubuntu18.04
  • Kivy: 1.10.1
  • Cython:0.29.5

Description

I want to build android apk using p4a. My python script is in ./code, simply print something.

export ANDROIDSDK="/home/ubuntu/android_sdk"
export ANDROIDNDK="/home/ubuntu/android_ndk/android-ndk-r16b"
export ANDROIDAPI="21"  # Target API version of your application
export NDKAPI="21"  # Minimum supported API version of your application

p4a apk --private ./code --package=org.example.myapp --name "My application" --version 0.1 --bootstrap=sdl2 --requirements=python2,kivy

buildozer.spec

not used

Logs

  RAN: /home/ubuntu/.local/share/python-for-android/dists/unnamed_dist_1/gradlew assembleDebug

  STDOUT:

> Task :compileDebugJavaWithJavac FAILED
/home/ubuntu/.local/share/python-for-android/dists/unnamed_dist_1/src/main/java/org/libsdl/app/SDLActivity.java:1948: error: cannot find symbol
            case MotionEvent.ACTION_BUTTON_PRESS:
                            ^
  symbol:   variable ACTION_BUTTON_PRESS
  location: class MotionEvent
/home/ubuntu/.local/share/python-for-android/dists/unnamed_dist_1/src/main/java/org/libsdl/app/SDLActivity.java:1949: error: cannot find symbol
            case MotionEvent.ACTION_BUTTON_RELEASE:
                            ^
  symbol:   variable ACTION_BUTTON_RELEASE
  location: class MotionEvent
/home/ubuntu/.local/share/python-for-android/dists/unnamed_dist_1/src/main/java/org/libsdl/app/SDLActivity.java:1952: error: cannot find symbol
                if (action == MotionEvent.ACTION_BUTTON_PRESS) {
                                         ^
  symbol:   variable ACTION_BUTTON_PRESS
  location: class MotionEvent
/home/ubuntu/.local/share/python-for-android/dists/unnamed_dist_1/src/main/java/org/libsdl/app/SDLActivity.java:1955: error: cannot find symbol
                else if (action == MotionEvent.ACTION_BUTTON_RELEASE) {
                                              ^
  symbol:   variable ACTION_BUTTON_RELEASE
  location: class MotionEvent
/home/ubuntu/.local/share/python-for-android/dists/unnamed_dist_1/src/main/java/org/libsdl/app/SDLAudioManager.java:116: error: cannot find symbol
                    channelConfig = AudioFormat.CHANNEL_OUT_7POINT1_SURROUND;
                                               ^
  symbol:   variable CHANNEL_OUT_7POINT1_SURROUND
  location: class AudioFormat
/home/ubuntu/.local/share/python-for-android/dists/unnamed_dist_1/src/main/java/org/libsdl/app/SDLAudioManager.java:328: error: cannot find symbol
        return mAudioRecord.read(buffer, 0, buffer.length, blocking ? AudioRecord.READ_BLOCKING : AudioRecord.READ_NON_BLOCKING);
                                                                                 ^
  symbol:   variable READ_BLOCKING
  location: class AudioRecord
/home/ubuntu/.local/share/python-for-android/dists/unnamed_dist_1/src/main/java/org/libsdl/app/SDLAudioManager.java:328: error: cannot find symbol
        return mAudioRecord.read(buffer, 0, buffer.length, blocking ? AudioRecord.READ_BLOCKING : AudioRecord.READ_NON_BLOCKING);
                                                                                                             ^
  symbol:   variable READ_NON_BLOCKING
  location: class AudioRecord
/home/ubuntu/.local/share/python-for-android/dists/unnamed_dist_1/src/main/java/org/libsdl/app/SDLAudioManager.java:336: error: cannot find symbol
            return mAudioRecord.read(buffer, 0, buffer.length, blocking ? AudioRecord.READ_BLOCKING : AudioRecord.READ_NON_BLOCKING);
                                                                                     ^
  symbol:   variable READ_BLOCKING
  location: class AudioRecord
/home/ubuntu/.local/share/python-for-android/dists/unnamed_dist_1/src/main/java/org/libsdl/app/SDLAudioManager.java:336: error: cannot find symbol
            return mAudioRecord.read(buffer, 0, buffer.length, blocking ? AudioRecord.READ_BLOCKING : AudioRecord.READ_NON_BLOCKING);
                                                                                                                 ^
  symbol:   variable READ_NON_BLOCKING
  location: class AudioRecord
/home/ubuntu/.local/share/python-for-android/dists/unnamed_dist_1/src/main/java/org/libsdl/app/SDLAudioManager.java:345: error: cannot find symbol
            return mAudioRecord.read(buffer, 0, buffer.length, blocking ? AudioRecord.READ_BLOCKING : AudioRecord.READ_NON_BLOCKING);
                                                                                     ^
  symbol:   variable READ_BLOCKING
  location: class AudioRecord
/home/ubuntu/.local/share/python-for-android/dists/unnamed_dist_1/src/main/java/org/libsdl/app/SDLAudioManager.java:345: error: cannot find symbol
            return mAudioRecord.read(buffer, 0, buffer.length, blocking ? AudioRecord.READ_BLOCKING : AudioRecord.READ_NON_BLOCKING);
                                                                                                                 ^
  symbol:   variable READ_NON_BLOCKING
  location: class AudioRecord
/home/ubuntu/.local/share/python-for-android/dists/unnamed_dist_1/src/main/java/org/libsdl/app/SDLControllerManager.java:435: error: cannot find symbol
                haptic.vib.vibrate(VibrationEffect.createOneShot(length, vibeValue));
                                   ^
  symbol:   variable VibrationEffect
  location: class SDLHapticHandler_API26
/home/ubuntu/.local/share/python-for-android/dists/unnamed_dist_1/src/main/java/org/libsdl/app/SDLControllerManager.java:666: error: cannot find symbol
                            x = event.getAxisValue(MotionEvent.AXIS_RELATIVE_X);
                                                              ^
  symbol:   variable AXIS_RELATIVE_X
  location: class MotionEvent
/home/ubuntu/.local/share/python-for-android/dists/unnamed_dist_1/src/main/java/org/libsdl/app/SDLControllerManager.java:667: error: cannot find symbol
                            y = event.getAxisValue(MotionEvent.AXIS_RELATIVE_Y);
                                                              ^
  symbol:   variable AXIS_RELATIVE_Y
  location: class MotionEvent
/home/ubuntu/.local/share/python-for-android/dists/unnamed_dist_1/src/main/java/org/libsdl/app/SDLControllerManager.java:709: error: cannot find symbol
            return event.getAxisValue(MotionEvent.AXIS_RELATIVE_X);
                                                 ^
  symbol:   variable AXIS_RELATIVE_X
  location: class MotionEvent
/home/ubuntu/.local/share/python-for-android/dists/unnamed_dist_1/src/main/java/org/libsdl/app/SDLControllerManager.java:719: error: cannot find symbol
            return event.getAxisValue(MotionEvent.AXIS_RELATIVE_Y);
                                                 ^
  symbol:   variable AXIS_RELATIVE_Y
  location: class MotionEvent
/home/ubuntu/.local/share/python-for-android/dists/unnamed_dist_1/src/main/java/org/libsdl/app/SDLControllerManager.java:768: error: cannot find symbol
            case InputDevice.SOURCE_MOUSE_RELATIVE:
                            ^
  symbol:   variable SOURCE_MOUSE_RELATIVE
  location: class InputDevice
/home/ubuntu/.local/share/python-for-android/dists/unnamed_dist_1/src/main/java/org/libsdl/app/SDLControllerManager.java:813: error: cannot find symbol
                SDLActivity.getContentView().requestPointerCapture();
                                            ^
  symbol:   method requestPointerCapture()
  location: class View
/home/ubuntu/.local/share/python-for-android/dists/unnamed_dist_1/src/main/java/org/libsdl/app/SDLControllerManager.java:816: error: cannot find symbol
                SDLActivity.getContentView().releasePointerCapture();
                                            ^
  symbol:   method releasePointerCapture()
  location: class View
/home/ubuntu/.local/share/python-for-android/dists/unnamed_dist_1/src/main/java/org/libsdl/app/SDLControllerManager.java:831: error: cannot find symbol
            SDLActivity.getContentView().requestPointerCapture();
                                        ^
  symbol:   method requestPointerCapture()
  location: class View
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
20 errors


Activity

  1. changed the title [-]SDLActivity.java:1948: error: cannot find symbol[/-] [+]SDLActivity.java:1948: error: cannot find symbol case MotionEvent.ACTION_BUTTON_PRESS:[/+] on Feb 9, 2019
  2. Meteorix commented on Feb 9, 2019

    @Meteorix
    ContributorAuthor

    I am experienced with python and c++ build system, but not familiar with android sdk. Am I missing something about Android SDK requirements?

  3. inclement commented on Feb 10, 2019

    @inclement
    Member

    export ANDROIDAPI="21" # Target API version of your application

    Are you using python-for-android master? If so, you'll need to target Android API 26+. I think that's probably the origin of this error.

  4. Meteorix commented on Feb 10, 2019

    @Meteorix
    ContributorAuthor

    Thanks, I used pip to install the latest p4a release version. And it worked on API 26.

    But what if I want to target Android API 21?

  5. inclement commented on Feb 10, 2019

    @inclement
    Member

    If you really want to set 21 as the target API you can use an older version of python-for-android. However, you almost certainly don't need to worry about it as the target API number isn't a minimum supported version or anything like that. It's more of a 'use api features from this version of android if available'. Apps targeting API 26+ can still be used by devices with older Android versions.

  6. Meteorix commented on Feb 10, 2019

    @Meteorix
    ContributorAuthor

    Really appreciate your explanation! I get it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions