Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Meteorix opened this issue Feb 9, 2019 · 5 comments

Comments

@Meteorix
Copy link
Contributor

Meteorix commented Feb 9, 2019

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


@Meteorix Meteorix changed the title SDLActivity.java:1948: error: cannot find symbol SDLActivity.java:1948: error: cannot find symbol case MotionEvent.ACTION_BUTTON_PRESS: Feb 9, 2019
@Meteorix
Copy link
Contributor Author

Meteorix commented Feb 9, 2019

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

@inclement
Copy link
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.

@Meteorix
Copy link
Contributor Author

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?

@inclement
Copy link
Member

inclement commented Feb 10, 2019

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.

@Meteorix
Copy link
Contributor Author

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants