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

"Couldn't load python3.5m: findLibrary returned null" on older versions of Android #866

Closed
kmonson opened this issue Aug 15, 2016 · 10 comments · Fixed by #1106
Closed

"Couldn't load python3.5m: findLibrary returned null" on older versions of Android #866

kmonson opened this issue Aug 15, 2016 · 10 comments · Fixed by #1106

Comments

@kmonson
Copy link
Contributor

kmonson commented Aug 15, 2016

When I try to run my APK on older versions of Android (<4.x) I'm getting a crash with this error: "Couldn't load python3.5m: findLibrary returned null"

I'm using the new python-for-android toolchain checked out a few days ago.

I get a popup on the device that says it's an "SDL Error"

logcat: http://pastebin.com/A0EJ8dQG
buildozer: http://pastebin.com/WCbU96TM (I did add python2 to the list of requirements but it did not help)

I also changed the Kivy recipe to use stable as opposed to master. I didn't think that was the problem.

Tested on a Kindle Fire HD (3.x fails), LG Volt (4.4 fails, but for a different reason much later in the startup process after kivy started).

Uninstalling and reinstalling the app did not help.

It looks python-for-android/pythonforandroid/bootstraps/sdl2/build/src/org/kivy/android/PythonUtil.java in the function loadLibraries it is failing to find either python2.7 or python3.5m.

If this all sounds familiar it's a similar problem to #645. In fact before I updated p4a I was at revision 084ddec which @kived had just checked in to fix #645. I was able to build a working version of my app with that revision. After I pulled the latest revision (9d457e3) I immediately started seeing this problem.

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@kmonson
Copy link
Contributor Author

kmonson commented Aug 20, 2016

I tried the same APK on my LG Volt (Android 4.4) and it works.

@Fak3
Copy link
Contributor

Fak3 commented Sep 16, 2016

I have this problem too. App works on android 4.2.2 (JIAYU G2F), but fails on android 4.2.1 (ISA A19)

@Fak3
Copy link
Contributor

Fak3 commented Sep 16, 2016

I added some extra logging to the /src/org/kivy/android/PythonUtil.java:

    for (String lib : getLibraries()) {
              try {
                System.loadLibrary(lib);
            } catch(UnsatisfiedLinkError e) {
                Log.v("Loading the library normally failed: %s", Log.getStackTraceString(e));
                throw e;
            }
        }

And got "cannot locate 'getsid'":

V/python  (19087): extracting include/python2.7/pyconfig.h
V/PythonActivity(19087): About to do super onCreate
D/dalvikvm(19087): Trying to load lib /data/data/org.spbelect.paradox/lib/libSDL2.so 0x41af47e0
D/dalvikvm(19087): Added shared lib /data/data/org.spbelect.paradox/lib/libSDL2.so 0x41af47e0
D/dalvikvm(19087): Trying to load lib /data/data/org.spbelect.paradox/lib/libSDL2_image.so 0x41af47e0
D/dalvikvm(19087): Added shared lib /data/data/org.spbelect.paradox/lib/libSDL2_image.so 0x41af47e0
D/dalvikvm(19087): No JNI_OnLoad found in /data/data/org.spbelect.paradox/lib/libSDL2_image.so 0x41af47e0, skipping init
D/dalvikvm(19087): Trying to load lib /data/data/org.spbelect.paradox/lib/libSDL2_mixer.so 0x41af47e0
D/dalvikvm(19087): Added shared lib /data/data/org.spbelect.paradox/lib/libSDL2_mixer.so 0x41af47e0
D/dalvikvm(19087): No JNI_OnLoad found in /data/data/org.spbelect.paradox/lib/libSDL2_mixer.so 0x41af47e0, skipping init
D/dalvikvm(19087): Trying to load lib /data/data/org.spbelect.paradox/lib/libSDL2_ttf.so 0x41af47e0
D/dalvikvm(19087): Added shared lib /data/data/org.spbelect.paradox/lib/libSDL2_ttf.so 0x41af47e0
D/dalvikvm(19087): No JNI_OnLoad found in /data/data/org.spbelect.paradox/lib/libSDL2_ttf.so 0x41af47e0, skipping init
D/dalvikvm(19087): Trying to load lib /data/data/org.spbelect.paradox/lib/libpython2.7.so 0x41af47e0
W/System.err(19087): Cannot load library: reloc_library[1322]:   103 cannot locate 'getsid'...

@Fak3
Copy link
Contributor

Fak3 commented Sep 16, 2016

My suspicion is that older android versions did not implement getsid(). Maybe building python with -DHAVE_GETSID=0 cflag will wix it. I don't have much time to do this now unfortunately.

@inclement
Copy link
Member

Thanks for this interesting debugging information. I don't have versions of android to easily test it so it would be great if you're able to check that flag (although if necessary I guess it can be checked using emulators).

@ecdsa
Copy link

ecdsa commented Oct 3, 2016

I confirm this, on android 2.3.3

@ecdsa
Copy link

ecdsa commented Oct 4, 2016

If this does not get fixed, I think buildozer should increase the minimum version of android required when it creates the APK

@rnixx
Copy link
Member

rnixx commented Dec 9, 2016

@Fak3 -DHAVE_GETSID=0 did not help (Android 4.2.1)

pat1 pushed a commit to r-map/python-for-android that referenced this issue Feb 20, 2017
@pat1
Copy link

pat1 commented Apr 27, 2017

I use a Samsumg GT-I9070 android 4.1.2 and today git for buildozer and python-for-android
in buildozer.spec:

android.api = 19
android.minapi = 13
android.sdk = 24
android.ndk = 10e

and rin the command:
buildozer android_new debug deploy run
with python 2

In PythonUtil.java I have commented out the code about catch(UnsatisfiedLinkError e)
and I get error loading libsqlite3.so
So I have added in getLibraries()

	    "crypto1.0.2h",
	    "ssl1.0.2h",
	    "sqlite3",
before    
            "python2.7",

now I get this error:

D/dalvikvm( 8099): Trying to load lib /mnt/asec/org.test.rmap-2/lib/libSDL2.so 0x41d88a50
D/dalvikvm( 8099): Added shared lib /mnt/asec/org.test.rmap-2/lib/libSDL2.so 0x41d88a50
D/dalvikvm( 8099): Trying to load lib /mnt/asec/org.test.rmap-2/lib/libSDL2_image.so 0x41d88a50
D/dalvikvm( 8099): Added shared lib /mnt/asec/org.test.rmap-2/lib/libSDL2_image.so 0x41d88a50
D/dalvikvm( 8099): No JNI_OnLoad found in /mnt/asec/org.test.rmap-2/lib/libSDL2_image.so 0x41d88a50, skipping init
D/dalvikvm( 8099): Trying to load lib /mnt/asec/org.test.rmap-2/lib/libSDL2_mixer.so 0x41d88a50
D/dalvikvm( 8099): Added shared lib /mnt/asec/org.test.rmap-2/lib/libSDL2_mixer.so 0x41d88a50
D/dalvikvm( 8099): No JNI_OnLoad found in /mnt/asec/org.test.rmap-2/lib/libSDL2_mixer.so 0x41d88a50, skipping init
D/dalvikvm( 8099): Trying to load lib /mnt/asec/org.test.rmap-2/lib/libSDL2_ttf.so 0x41d88a50
D/dalvikvm( 8099): Added shared lib /mnt/asec/org.test.rmap-2/lib/libSDL2_ttf.so 0x41d88a50
D/dalvikvm( 8099): No JNI_OnLoad found in /mnt/asec/org.test.rmap-2/lib/libSDL2_ttf.so 0x41d88a50, skipping init
D/dalvikvm( 8099): Trying to load lib /mnt/asec/org.test.rmap-2/lib/libcrypto1.0.2h.so 0x41d88a50
D/dalvikvm( 8099): Added shared lib /mnt/asec/org.test.rmap-2/lib/libcrypto1.0.2h.so 0x41d88a50
D/dalvikvm( 8099): No JNI_OnLoad found in /mnt/asec/org.test.rmap-2/lib/libcrypto1.0.2h.so 0x41d88a50, skipping init
D/dalvikvm( 8099): Trying to load lib /mnt/asec/org.test.rmap-2/lib/libssl1.0.2h.so 0x41d88a50
D/dalvikvm( 8099): Added shared lib /mnt/asec/org.test.rmap-2/lib/libssl1.0.2h.so 0x41d88a50
D/dalvikvm( 8099): No JNI_OnLoad found in /mnt/asec/org.test.rmap-2/lib/libssl1.0.2h.so 0x41d88a50, skipping init
D/dalvikvm( 8099): Trying to load lib /mnt/asec/org.test.rmap-2/lib/libsqlite3.so 0x41d88a50
D/dalvikvm( 8099): Added shared lib /mnt/asec/org.test.rmap-2/lib/libsqlite3.so 0x41d88a50
D/dalvikvm( 8099): No JNI_OnLoad found in /mnt/asec/org.test.rmap-2/lib/libsqlite3.so 0x41d88a50, skipping init
D/dalvikvm( 8099): Trying to load lib /mnt/asec/org.test.rmap-2/lib/libpython2.7.so 0x41d88a50
W/System.err( 8099): Cannot load library: reloc_library[1306]:  1703 cannot locate 'wait4'...
W/ResourceType( 8099): Failure getting entry for 0x010802c8 (t=7 e=712) in package 0 (error -75)

What about 'wait4' ?

@pat1
Copy link

pat1 commented Apr 27, 2017

kivy/buildozer#92

pat1 added a commit to r-map/python-for-android that referenced this issue Apr 28, 2017
inclement pushed a commit to inclement/python-for-android that referenced this issue Aug 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants