nhCoder / YouTubeExtractor

Extracts Youtube urls for streaming and downloading purpose.
Apache License 2.0
68 stars 25 forks source link

(Solved) release build - null exception #18

Open hhyeok1026 opened 4 years ago

hhyeok1026 commented 4 years ago

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.

nhCoder commented 4 years ago

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.....

hhyeok1026 commented 4 years ago

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