yausername / youtubedl-android

youtube-dl for android
GNU General Public License v3.0
1.02k stars 185 forks source link

youtubedl cant be get initialized and the app is crashed. #135

Open clonedSemicolon opened 2 years ago

clonedSemicolon commented 2 years ago

While initializing the youtubedl the following error is generated:

java.lang.RuntimeException: Unable to create application acr.browser.lightning.BrowserApp: com.yausername.youtubedl_android.YoutubeDLException: failed to initialize
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6980)
    at android.app.ActivityThread.access$1500(ActivityThread.java:257)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1982)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:236)
    at android.app.ActivityThread.main(ActivityThread.java:8037)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:656)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967)
Caused by: com.yausername.youtubedl_android.YoutubeDLException: failed to initialize
    at com.yausername.youtubedl_android.YoutubeDL.initPython(Unknown Source:50)
    at com.yausername.youtubedl_android.YoutubeDL.init(Unknown Source:169)
    at acr.browser.lightning.BrowserApp.onCreate(:12)
    at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1193)
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6975)
    ... 8 more
Caused by: java.io.FileNotFoundException: /data/app/~~5f9-GnrSmv6xt4B0lJnz_Q==/inverseai.downloader.videodownloader-ndkpoSlhJutoe5vW820BBQ==/lib/arm64/libpython.zip.so: open failed: ENOENT (No such file or directory)
    at [libcore.io](http://libcore.io/).IoBridge.open(IoBridge.java:492)
    at [java.io](http://java.io/).RandomAccessFile.<init>(RandomAccessFile.java:289)
    at n.a.a.a.a.c.j0.<init>(:1)
    at com.yausername.youtubedl_common.utils.ZipUtils.unzip(Unknown Source:2)
    at com.yausername.youtubedl_android.YoutubeDL.initPython(Unknown Source:35)
    ... 12 `more`
Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)
    at [libcore.io](http://libcore.io/).Linux.open(Native Method)
    at [libcore.io](http://libcore.io/).ForwardingOs.open(ForwardingOs.java:166)
    at [libcore.io](http://libcore.io/).BlockGuardOs.open(BlockGuardOs.java:254)
    at [libcore.io](http://libcore.io/).ForwardingOs.open(ForwardingOs.java:166)
    at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:7911)
    at [libcore.io](http://libcore.io/).IoBridge.open(IoBridge.java:478)

Tried the solutions below:

GhostInTheSteiner commented 2 years ago

This library is broken on Android 11. Google changed storage APIs, so unfortunately the way this app goes to implement YoutubeDL-support via a shell solution NO LONGER WORKS.

Look for another project to start off, the dream of using YoutubeDL on android just died. As all private open source projects... due to a lack of maintenance.

EDIT: My point still stands, but I'll excuse myself for the rant. This app is still in active development, so I probably shouldn't blame its devs for not caring about the project anymore.

yausername commented 2 years ago

@clonedSemicolon sorry for the late response but were you testing on an x86 based emulator by any chance? And what was the targetSdkVersion ?

GhostInTheSteiner commented 2 years ago

I'm only able to speak for my own app, but I got the same error using those specs:

image

I had all three variables set to API-Level 31

image

I already changed some stuff on my Composition Compass app to make it (at least) work with 29 and didn't push the problematic state, otherwise I would have linked you the commit.

I should probably mention it works without issues inside the emulator as long as I keep the API level (all three variables) at 29, and use the old permission-requests in my manifest and in my onCreate().

yausername commented 2 years ago

Thanks for the information. This might get fixed by changing the code which unzips the file (maybe copying the file to a temp location before unzipping) https://github.com/yausername/youtubedl-android/blob/a41cfdfc6952e8af13c424556292ea017f4a0706/library/src/main/java/com/yausername/youtubedl_android/YoutubeDL.java#L100 Unfortunately I don't have time to fix or test these right now.

al-tush commented 2 years ago

As a hotfix you can add flag android.bundle.enableUncompressedNativeLibs=false in gradle.properties.

tashilapathum commented 1 year ago

As a hotfix you can add flag android.bundle.enableUncompressedNativeLibs=false in gradle.properties.

Thank you. This fixed the issue and lead to another message saying it's deprecated now. You can add this to build.gradle instead:

android { packagingOptions { jniLibs { useLegacyPackaging = true } } }

jialechan commented 1 year ago

As a hotfix you can add flag android.bundle.enableUncompressedNativeLibs=false in gradle.properties.

Thank you. This fixed the issue and lead to another message saying it's deprecated now. You can add this to build.gradle instead:

android { packagingOptions { jniLibs { useLegacyPackaging = true } } }

šŸ‘šŸ‘šŸ‘šŸ‘šŸ‘šŸ‘šŸ‘šŸ‘šŸ‘šŸ‘šŸ‘šŸ‘šŸ‘šŸ‘šŸ‘šŸ‘