-
Notifications
You must be signed in to change notification settings - Fork 255
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
App crashes if we use 'org.renpy.android.PythonActivity' in p4a new toolchain #249
Comments
Sorry for naive question, but how can I apply your patch? I tried to add your patch to .buildozer/android/platform/python-for-android-master/pythonforandroid/recipes/pyjnius. So I basically mirrored init.py" and copied ugly_pyjnius_fix.patch, but it produce no effect. Thank you in advance. UPDATE: I was able manually download your branch before everything else was downloaded and compiled, unfortunately app still crashes with the same error message. P.S. Will it be fixed one day? |
Just download and unpack it or better run:
Probably it would fix error for you. I don't know how to create correct fix that can be merged in master. You can draw attention to this issue of someone who may know asking about it here. |
Thank you for fast reply. Unfortunately as I already saw yesterday even with your fix App crash with the same error. Just in case it can be useful for anybody: I compile my App on Mac OS. |
@andreinl are you sure your app contain fix? Problem with manual editing files inside |
@germn |
The fix here is to change your code to reference |
Could you please elaborate how I have simple app (both
Log from device (Samsung J5 (2016)):
|
Plyer itself should be changed, at
https://github.com/kivy/plyer/blob/master/plyer/platforms/android/__init__.py
, to access the correct Java class path. Right now it only works if the
android module is available, otherwise it chooses the (incorrect) old value.
The way to fix it is probably to try to autoclass each of the
possibilities one by one if the android module is not available,
catching the errors if the class doesn't exist.
…On 04/03/17 11:58, Krzysztof Chomski wrote:
The fix here is to change your code to reference
org.kivy.android.PythonActivity - this isn't a problem with pyjnius,
it works fine, but the PythonActivity class is just in a different
place with the new toolchain.
Could you please elaborate how |plyer| should be used then without
applying patch to |pyjnius|?
Because without patching |pyjnius| with @germn
<https://github.com/germn> patch it still tries to use |renpy| and
results in error (it works fine after patch is applied).
I have simple app:
|main.py|:
|import plyer from plyer import flash print 'Plyer version is:',
plyer.__version__ flash.on() |
|buildozer.spec|:
|[app] title = App package.name = app package.domain = org.test
source.dir = test/. source.include_exts = py version = 0.1 requirements
= flask,pyjnius,plyer android.bootstrap = webview orientation = portrait
fullscreen = 1 android.permissions = INTERNET, VIBRATE, CAMERA,
FLASHLIGHT [buildozer] log_level = 2 warn_on_root = 1 |
Log from device (Samsung J5 (2016)):
|03-04 12:46:04.813 31995 32037 I python : Run user program, change dir
and execute entrypoint 03-04 12:46:04.813 31995 32037 I python : main.py
03-04 12:46:04.813 31995 32042 W AudioCapabilities: Unsupported mime
audio/evrc 03-04 12:46:04.833 31995 32042 W VideoCapabilities:
Unsupported mime video/wvc1 03-04 12:46:04.833 31995 32042 W
VideoCapabilities: Unsupported mime video/x-ms-wmv 03-04 12:46:04.863
31995 32042 W VideoCapabilities: Unrecognized profile/level 32768/2 for
video/mp4v-es 03-04 12:46:04.863 31995 32037 I python : Plyer version
is: 1.2.5dev 03-04 12:46:04.863 31995 32042 W VideoCapabilities:
Unsupported mime video/wvc1 03-04 12:46:04.863 31995 32042 W
VideoCapabilities: Unsupported mime video/x-ms-wmv 03-04 12:46:04.873
31995 32037 W linker :
/data/data/org.test.app/files/lib/python2.7/site-packages/jnius/jnius.so: is
missing DT_SONAME will use basename as a replacement: "jnius.so" 03-04
12:46:04.873 31995 32042 W VideoCapabilities: Unsupported mime
video/x-ms-wmv7 03-04 12:46:04.873 31995 32042 W VideoCapabilities:
Unsupported mime video/x-ms-wmv8 03-04 12:46:04.883 31995 32042 W
VideoCapabilities: Unsupported mime video/mp43 03-04 12:46:04.883 31995
32039 V WebViewLoader: Could not ping localhost:5000 03-04 12:46:04.923
31995 32042 I VideoCapabilities: Unsupported profile 4 for video/mp4v-es
03-04 12:46:04.933 4018 6810 V WindowStateAnimator: Finishing drawing
window Window{62ab5c9 u0 d0
org.test.app/org.kivy.android.PythonActivity}: mDrawState=DRAW_PENDING
03-04 12:46:04.933 31995 31995 D ViewRootImpl: MSG_RESIZED_REPORT:
ci=Rect(0, 48 - 0, 0) vi=Rect(0, 48 - 0, 0) or=1 03-04 12:46:04.933 4018
4776 D InputMethodManagerService: windowGainedFocus
mCurrentFocusedUserId - 0 and mSecureKeypadEnabled-false 03-04
12:46:04.943 4018 4209 D KnoxTimeoutHandler: notifyActivityDrawn
[MsgParam] userId: 0 fullscreen is true showWhenlocked is false 03-04
12:46:04.943 4018 4018 D KnoxTimeoutHandler: activityDrawn [MsgParam]
userId: 0 fullscreen is true showWhenlocked is false 03-04 12:46:04.943
4018 4209 I ActivityManager: Displayed
org.test.app/org.kivy.android.PythonActivity: +1s841ms 03-04
12:46:04.943 4018 4209 I Timeline: Timeline: Activity_windows_visible
id: ActivityRecord{1f9d0ed u0
org.test.app/org.kivy.android.PythonActivity t88} time:48372138 03-04
12:46:04.943 4018 4209 D CustomFrequencyManagerService:
releaseDVFSLockLocked : Getting Lock type frm List : DVFS_MIN_LIMIT
frequency : 1190400 uid : 1000 pid : 4018 tag :
***@***.*** 03-04 12:46:04.943 4018 4209 D
ActivityManager: mDVFSHelper.release() 03-04 12:46:04.943 4018 4139 D
CustomFrequencyManagerService: acquireDVFSLockLocked : type :
DVFS_MIN_LIMIT frequency : 1190400 uid : 1000 pid : 4018 pkgName :
***@***.*** 03-04 12:46:04.953 4018 4209 D ViewRootImpl:
#3 mView = null 03-04 12:46:04.953 4018 4018 I KnoxTimeoutHandler: SD
activityfalse 03-04 12:46:04.953 4018 4018 I KnoxTimeoutHandler:
Fullscreen and mCurrent is not KNOX user. Hence hide keyguard 03-04
12:46:04.953 24901 24901 D SamsungIME: IMPL finishInput 03-04
12:46:04.953 4018 4038 V WindowStateAnimator: Finishing drawing window
Window{62ab5c9 u0 d0 org.test.app/org.kivy.android.PythonActivity}:
mDrawState=HAS_DRAWN 03-04 12:46:04.983 31995 32039 V WebViewLoader:
Could not ping localhost:5000 03-04 12:46:05.083 31995 31995 W
cr_BindingManager: Cannot call determinedVisibility() - never saw a
connection for the pid: 31995 03-04 12:46:05.083 31995 32039 V
WebViewLoader: Could not ping localhost:5000 03-04 12:46:05.133 31995
31995 I chromium: [INFO:CONSOLE(24)] "called!", source:
file:///data/user/0/org.test.app/files/_load.html (24) 03-04
12:46:05.143 343 6822 I SurfaceFlinger: id=692 Removed bpp (5/8) 03-04
12:46:05.153 343 2071 I SurfaceFlinger: id=692 Removed bpp (-2/8) 03-04
12:46:05.183 31995 32039 V WebViewLoader: Could not ping localhost:5000
03-04 12:46:05.293 31995 32039 V WebViewLoader: Could not ping
localhost:5000 03-04 12:46:05.393 31995 32039 V WebViewLoader: Could not
ping localhost:5000 03-04 12:46:05.493 31995 32039 V WebViewLoader:
Could not ping localhost:5000 03-04 12:46:05.553 4018 4018 D
CustomFrequencyManagerService: releaseDVFSLockLocked : Getting Lock type
frm List : DVFS_MIN_LIMIT frequency : 1190400 uid : 1000 pid : 4018 tag
: ***@***.*** 03-04 12:46:05.553 4018 4018 D
CustomFrequencyManagerService:
FrequencyrequestList.getNextCStateDisableRequest, index: 0 03-04
12:46:05.593 31995 32039 V WebViewLoader: Could not ping localhost:5000
03-04 12:46:05.633 31995 32037 W PythonActivity: Accessing
org.renpy.android.PythonActivity is deprecated and will be removed in a
future version. Please switch to org.kivy.android.PythonActivity. 03-04
12:46:05.663 31995 32037 F art : art/runtime/java_vm_ext.cc:410] JNI
DETECTED ERROR IN APPLICATION: static jfieldID 0xb4766278 not valid for
class java.lang.Class<org.renpy.android.PythonActivity> 03-04
12:46:05.663 31995 32037 F art : art/runtime/java_vm_ext.cc:410] in call
to GetStaticObjectField 03-04 12:46:05.663 31995 32037 F art :
art/runtime/java_vm_ext.cc:410] from int
org.kivy.android.PythonActivity.nativeInit(java.lang.Object) 03-04
12:46:05.663 31995 32037 F art : art/runtime/java_vm_ext.cc:410]
"PythonThread" prio=5 tid=23 Runnable 03-04 12:46:05.663 31995 32037 F
art : art/runtime/java_vm_ext.cc:410] | group="main" sCount=0 dsCount=0
obj=0x12ff74c0 self=0xb8226c60 03-04 12:46:05.663 31995 32037 F art :
art/runtime/java_vm_ext.cc:410] | sysTid=32037 nice=0 cgrp=default
sched=0/0 handle=0x9f90a930 03-04 12:46:05.663 31995 32037 F art :
art/runtime/java_vm_ext.cc:410] | state=R schedstat=( 822978519
127366843 988 ) utm=76 stm=6 core=1 HZ=100 03-04 12:46:05.663 31995
32037 F art : art/runtime/java_vm_ext.cc:410] |
stack=0x9f808000-0x9f80a000 stackSize=1038KB 03-04 12:46:05.663 31995
32037 F art : art/runtime/java_vm_ext.cc:410] | held mutexes= "mutator
lock"(shared held) 03-04 12:46:05.663 31995 32037 F art :
art/runtime/java_vm_ext.cc:410] native: #00 pc 0035d32d
/system/lib/libart.so
(_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiPKcPNS_9ArtMethodEPv+116)
03-04 12:46:05.663 31995 32037 F art : art/runtime/java_vm_ext.cc:410]
native: #1 pc 0033de0b /system/lib/libart.so
(_ZNK3art6Thread4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE+138)
03-04 12:46:05.663 31995 32037 F art : art/runtime/java_vm_ext.cc:410]
native: #2 pc 0024ffb9 /system/lib/libart.so
(_ZN3art9JavaVMExt8JniAbortEPKcS2_+760) 03-04 12:46:05.663 31995 32037 F
art : art/runtime/java_vm_ext.cc:410] native: #3 pc 00250657
/system/lib/libart.so
(_ZN3art9JavaVMExt9JniAbortVEPKcS2_St9__va_list+54) 03-04 12:46:05.663
31995 32037 F art : art/runtime/java_vm_ext.cc:410] native: #4 pc
000fc16b /system/lib/libart.so (_ZN3art11ScopedCheck6AbortFEPKcz+30)
03-04 12:46:05.663 31995 32037 F art : art/runtime/java_vm_ext.cc:410]
native: #5 pc 00112bbf /system/lib/libart.so
(_ZN3art11ScopedCheck16CheckFieldAccessERNS_18ScopedObjectAccessEP8_jobjectP9_jfieldIDbNS_9Primitive4TypeE+434)
03-04 12:46:05.663 31995 32037 F art : art/runtime/java_vm_ext.cc:410]
native: #6 pc 00114421 /system/lib/libart.so
(_ZN3art8CheckJNI8GetFieldEPKcP7_JNIEnvP8_jobjectP9_jfieldIDbNS_9Primitive4TypeE+488)
03-04 12:46:05.663 31995 32037 F art : art/runtime/java_vm_ext.cc:410]
native: #7 pc 0011496d /system/lib/libart.so
(_ZN3art8CheckJNI20GetStaticObjectFieldEP7_JNIEnvP7_jclassP9_jfieldID+24) 03-04
12:46:05.663 31995 32037 F art : art/runtime/java_vm_ext.cc:410] native:
#8 pc 0003129b
/data/data/org.test.app/files/lib/python2.7/site-packages/jnius/jnius.so
(???) 03-04 12:46:05.663 31995 32037 F art :
art/runtime/java_vm_ext.cc:410] at
org.kivy.android.PythonActivity.nativeInit(Native method) 03-04
12:46:05.663 31995 32037 F art : art/runtime/java_vm_ext.cc:410] at
org.kivy.android.PythonMain.run(PythonActivity.java:430) 03-04
12:46:05.663 31995 32037 F art : art/runtime/java_vm_ext.cc:410] at
java.lang.Thread.run(Thread.java:818) 03-04 12:46:05.663 31995 32037 F
art : art/runtime/java_vm_ext.cc:410] 03-04 12:46:06.073 4018 4261 D
PackageManager: [MSG] WRITE_PACKAGE_RESTRICTIONS |
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#249 (comment)>, or
mute the thread
<https://github.com/notifications/unsubscribe-auth/ABNQm5qfErxv5A8JzrCLA5p-i0_xn22oks5riVHxgaJpZM4LP78X>.
|
It worked after changing Here's a diff:
|
plyer needs to determine which java class path is the correct one to use. Currently it has code to do that, but only if the
I haven't tested it but something like this should be sound. |
Sorry for a stupid question: If I start from the webview bootstrap, the app can't find either 'org.kivy.android.PythonActivity' or 'org.renpy.android.PythonActivity'. Do I have to include one of them explicitly at build? |
@matphysrin: You have to include |
@matphysrin With the webview bootstrap, the activity class os |
Thanks for the answers. I already include This is the log I get with
The actual source code where it crashes reads:
The result with I build the app like this:
where the environment
|
I'm at a loss for this one - it seems to match the example app at
https://github.com/kivy/python-for-android/blob/master/testapps/testapp_flask/main.py,
which does work for me.
…On 10/03/17 18:49, Matous wrote:
Thanks for the answers. I already include |pyjnius|, and import
|org.kivy.android.PythonActivity|, but still get an error.
This is the log I get with |p4a adb logcat|:
|I/python ( 4329): import luscinia_android_test as lat I/python ( 4329):
File
"/sdcard/luscinia/luscinia_android_test.zip/luscinia_android_test.py",
line 3, in <module> I/python ( 4329): File
"/data/data/org.example.luscinia/files/lib/python2.7/site-packages/jnius/reflect.py",
line 154, in autoclass I/python ( 4329): c = find_javaclass(clsname)
I/python ( 4329): File "jnius/jnius_export_func.pxi", line 25, in
jnius.jnius.find_javaclass (jnius/jnius.c:16608) I/python ( 4329):
JavaException: Class not found 'org/kivy/android/PythonActivity' |
The actual source code where it crashes reads:
|from jnius import autoclass, cast PythonActivity =
autoclass('org.kivy.android.PythonActivity') |
The result with |org.renpy.android.PythonActivity| is the same.
I build the app like this:
|python-for-android apk --private . --dist_name=webview_01
--android-api=15 --ndk-version=r11b
--requirements=cherrypy,sqlalchemy,sqlite3,pyjnius
--package=org.example.luscinia --name "Luscinia" --permission
WRITE_EXTERNAL_STORAGE --permission INTERNET --add-source=luscinia
--add-source=unidecode --version=0.26 --port=9371 |
where the environment |webview_01| is built using
|python-for-android create --dist_name=webview_01 --bootstrap=webview
--requirements=python2,sqlite3,cherrypy,sqlalchemy,pyjnius |
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#249 (comment)>, or
mute the thread
<https://github.com/notifications/unsubscribe-auth/ABNQm2aIccVG2QzmOhbJ2t5uckMWnwumks5rkZsegaJpZM4LP78X>.
|
It seems the problem is caused by setting the Thanks for your help, guys! |
If we use
org.renpy.android.PythonActivity
(instead neworg.kivy.android.PythonActivity
) in app built with p4a new toolchain it'll crash. See this issue for example (there's also typical log there):It can be temporary solved by replacing
org.renpy.android.PythonActivity
withorg.kivy.android.PythonActivity
everywhere in the code manually or with some dirty patch.But correct solution would be to fix
pyjnius
not to crash withorg.renpy.android.PythonActivity
in p4a new toolchain.The text was updated successfully, but these errors were encountered: