nhCoder/YouTubeExtractor

(Solved) release build - null exception

Opened this issue · 2 comments

I put this library in my project and i succeeded in extracting the video.

However, in the release version, there was a problem with extraction.

If you use minifyEnabled true in build.gradle you will get a problem that the problem is not working.

YoutubeStreamExtractor.class

private PlayerResponse parseJson (String body) throws Exception {
JsonParser parser = new JsonParser ();
response = new GsonBuilder (). serializeNulls (). create (). fromJson (parser.parse (body), Response.class);
return new GsonBuilder (). serializeNulls (). create (). fromJson (response.getArgs (). getPlayerResponse (), PlayerResponse.class);
}

In the return statement, null exception occurs.

Solution1: Write a ProGuard exception.

in the proguard-rules.pro file
-keep class com.yourcompany.naveedhassan913_youtubeextractor_test. ** {*; }
(Please correct accordingly)

After writing as above,
Rebuild the source and run it.

After that you will also get an error.
If there is an exception that occurs in the dechiperSig () method of CipherManager.class,

Solution2
Write this in the proguard-rules.pro file as follows.
-keep class org.mozilla.javascript. ** {*; }
(For dependency org.mozilla: rhino: 1.7R4 to work properly)

I have tried several things to solve this,
This may not be the exact solution.

If you don't understand this or don't work properly, let me know.

Additionally
I haven't solved this problem.

when i use minifyEnabled true,
there is R8 warnings in build output.
Let me know if you know the solution.

image

I respects the library owner.
Thank you.

Thanks for the solution though, As i mentioned on readme top that I build this lib using AIDE on Android... It doesn't support full gradle and Proguard.. Thats y it shows no errors to me.....

@naveedhassan913
yes, I read the readme.
Perhaps anyone who wants to use this will use Android Studio.