ponnamkarthik / RichLinkPreview

A Rich Link Preview Library for Android
Apache License 2.0
217 stars 58 forks source link

Additional dependicies #4

Open Savrov opened 6 years ago

Savrov commented 6 years ago

To make lib work a have to add 2 dependencies:

implementation 'io.github.ponnamkarthik:richlinkpreview:1.0.8'
implementation 'org.jsoup:jsoup:1.11.2'
implementation 'com.squareup.picasso:picasso:2.5.2'

W/o that it doesnt work.

ponnamkarthik commented 6 years ago

@Savrov

I you want to add this library to your app you only need to add

implementation 'io.github.ponnamkarthik:richlinkpreview:1.0.8'

this to you project remaining two dependencies are already included in library gradle file

olyjosh commented 6 years ago

I'm having thesame issue, using implementation 'io.github.ponnamkarthik:richlinkpreview:1.0.8' does not work adding the decencies name given on stack-trace does not solve this. Below is a log that may be of help

E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #3
                  Process: ng.appname.appname, PID: 22317
                  java.lang.RuntimeException: An error occurred while executing doInBackground()
                      at android.os.AsyncTask.done(AsyncTask.java:318)
                      at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
                      at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
                      at java.util.concurrent.FutureTask.run(FutureTask.java:242)
                      at android.os.AsyncTask$SerialExecutor.run(AsyncTask.java:243)
                      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
                      at java.lang.Thread.run(Thread.java:761)
                   Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lorg/jsoup/Jsoup;
                      at io.github.ponnamkarthik.richlinkpreview.RichPreview$getData.doInBackground(RichPreview.java:42)
                      at io.github.ponnamkarthik.richlinkpreview.RichPreview$getData.doInBackground(RichPreview.java:35)
                      at android.os.AsyncTask.call(AsyncTask.java:304)
                      at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                      at android.os.AsyncTask$SerialExecutor.run(AsyncTask.java:243) 
                      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) 
                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) 
                      at java.lang.Thread.run(Thread.java:761) 
                   Caused by: java.lang.ClassNotFoundException: Didn't find class "org.jsoup.Jsoup" on path: DexPathList[[zip file "/data/app/ng.appname.appname-1/base.apk", zip file "/data/app/ng.appname.appname-1/split_lib_dependencies_apk.apk", zip file "/data/app/ng.appname.appname-1/split_lib_slice_0_apk.apk", zip file "/data/app/ng.appname.appname-1/split_lib_slice_1_apk.apk", zip file "/data/app/ng.appname.appname-1/split_lib_slice_2_apk.apk", zip file "/data/app/ng.appname.appname-1/split_lib_slice_3_apk.apk", zip file "/data/app/ng.appname.appname-1/split_lib_slice_4_apk.apk", zip file "/data/app/ng.appname.appname-1/split_lib_slice_5_apk.apk", zip file "/data/app/ng.appname.appname-1/split_lib_slice_6_apk.apk", zip file "/data/app/ng.appname.appname-1/split_lib_slice_7_apk.apk", zip file "/data/app/ng.appname.appname-1/split_lib_slice_8_apk.apk", zip file "/data/app/ng.appname.appname-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/ng.appname.appname-1/lib/arm64, /data/app/ng.appname.appname-1/base.apk!/lib/arm64-v8a, /data/app/ng.appname.appname-1/split_lib_dependencies_apk.apk!/lib/arm64-v8a, /data/app/ng.appname.appname-1/split_lib_slice_0_apk.apk!/lib/arm64-v8a, /data/app/ng.appname.appname-1/split_lib_slice_1_apk.apk!/lib/arm64-v8a, /data/app/ng.appname.appname-1/split_lib_slice_2_apk.apk!/lib/arm64-v8a, /data/app/ng.appname.appname-1/split_lib_slice_3_apk.apk!/lib/arm64-v8a, /data/app/ng.appname.appname-1/split_lib_slice_4_apk.apk!/lib/arm64-v8a, /data/app/ng.appname.appname-1/split_lib_slice_5_apk.apk!/lib/arm64-v8a, /data/app/ng.appname.appname-1/split_lib_slice_6_apk.apk!/lib/arm64-v8a, /data/app/ng.appname.appname-1/split_lib_slice_7_apk.apk!/lib/arm64-v8a, /data/app/ng.appname.appname-1/split_lib_slice_8_apk.apk!/lib/arm64-v8a, /data/app/ng.appname.appname-1/split_lib_slice_9_apk.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64, /system/vendor/lib64]]
                      at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
                      at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
                      at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
                      at io.github.ponnamkarthik.richlinkpreview.RichPreview$getData.doInBackground(RichPreview.java:42) 
                      at io.github.ponnamkarthik.richlinkpreview.RichPreview$getData.doInBackground(RichPreview.java:35) 
                      at android.os.AsyncTask.call(AsyncTask.java:304) 
                      at java.util.concurrent.FutureTask.run(FutureTask.java:237) 
                      at android.os.AsyncTask$SerialExecutor.run(AsyncTask.java:243) 
                      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) 
                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) 
                      at java.lang.Thread.run(Thread.java:761) 

On adding the two dependencies, app crashes with the below log pointing to picaso.

E/AndroidRuntime: FATAL EXCEPTION: main
                  Process: ng.appname.appname, PID: 14071
                  java.lang.NoSuchMethodError: No static method with(Landroid/content/Context;)Lcom/squareup/picasso/Picasso; in class Lcom/squareup/picasso/Picasso; or its super classes (declaration of 'com.squareup.picasso.Picasso' appears in /data/app/ng.appname.appname-2/split_lib_dependencies_apk.apk)
                      at io.github.ponnamkarthik.richlinkpreview.RichLinkViewTwitter.initView(RichLinkViewTwitter.java:83)
                      at io.github.ponnamkarthik.richlinkpreview.RichLinkViewTwitter$2.onData(RichLinkViewTwitter.java:162)
                      at io.github.ponnamkarthik.richlinkpreview.RichPreview$getData.onPostExecute(RichPreview.java:156)
                      at io.github.ponnamkarthik.richlinkpreview.RichPreview$getData.onPostExecute(RichPreview.java:35)
                      at android.os.AsyncTask.finish(AsyncTask.java:663)
                      at android.os.AsyncTask.-wrap1(AsyncTask.java)
                      at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:680)
                      at android.os.Handler.dispatchMessage(Handler.java:111)
                      at android.os.Looper.loop(Looper.java:207)
                      at android.app.ActivityThread.main(ActivityThread.java:5728)
                      at java.lang.reflect.Method.invoke(Native Method)
                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)

I guess there is a breaking change in picaso against the version you used in building this

Gh0stWires commented 6 years ago

I second @Savrov post. adding those dependencies with those specific versions does fix the problem. like @olyjosh said updates to those dependencies may be causing breaking changes to your library. I may try to fix these issues myself and submit a pull request but for right now adding those dependencies work well enough for me.

gigiperih commented 6 years ago

@PonnamKarthik seems this library using previous version of Picasso. It has different method when initializing the Picasso.

Picasso 2.7++ Picasso.get().load("http://i.imgur.com/DvpvklR.png").into(imageView);

Older version of Picasso need to parse Context.

Further reading: https://futurestud.io/tutorials/picasso-how-to-use-migrate-to-picassos-upcoming-3-x-version

ShahoodulHassan commented 4 years ago

Any solution for this issue.......?

ismailnurudeen commented 4 years ago

I already had picasso dependency in my project so the only error i got was with jsoup.

  Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lorg/jsoup/Jsoup;
        at io.github.ponnamkarthik.richlinkpreview.RichPreview$getData.doInBackground(RichPreview.java:42)
        at io.github.ponnamkarthik.richlinkpreview.RichPreview$getData.doInBackground(RichPreview.java:35)
        at android.os.AsyncTask$2.call(AsyncTask.java:333)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) 
        at java.lang.Thread.run(Thread.java:764) 
     Caused by: java.lang.ClassNotFoundException: Didn't find class "org.jsoup.Jsoup" on path: DexPathList[[zip file "/data/app/ng.com.devloop.stirp-3LHyXhiAlF4S7Pp_VYJEJA==/base.apk"],nativeLibraryDirectories=[/data/app/ng.com.devloop.stirp-3LHyXhiAlF4S7Pp_VYJEJA==/lib/arm, /system/lib, /vendor/lib]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at io.github.ponnamkarthik.richlinkpreview.RichPreview$getData.doInBackground(RichPreview.java:42) 
        at io.github.ponnamkarthik.richlinkpreview.RichPreview$getData.doInBackground(RichPreview.java:35) 
        at android.os.AsyncTask$2.call(AsyncTask.java:333) 
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) 
        at java.lang.Thread.run(Thread.java:764) 

    --------- beginning of system
jatin-lakhani commented 4 years ago

implementation 'io.github.ponnamkarthik:richlinkpreview:1.0.9'

java.lang.NoSuchMethodError: No static method get()Lcom/squareup/picasso/Picasso; in class Lcom/squareup/picasso/Picasso;