[Android] java.lang.NoSuchMethodError & reducing the APK size

Showing 1-1 of 1 messages
[Android] java.lang.NoSuchMethodError & reducing the APK size Support 11/1/11 10:43 AM
Q: I've successfully downloaded your PDF Android SDK (http://www.pdftron.com/pdfnet/mobile/android_pdf_library.html) and created sample project from one of the supplied by you in archive file.
 

But when I run it I get following error.


11-01 04:20:25.433: ERROR/AndroidRuntime(5960): Uncaught handler: thread main exiting due to uncaught exception
11-01 04:20:25.598: ERROR/AndroidRuntime(5960): java.lang.NoSuchMethodError: android.view.ScaleGestureDetector$SimpleOnScaleGestureListener.<init>
11-01 04:20:25.598: ERROR/AndroidRuntime(5960):     at pdftron.PDF.b.<init>(SourceFile:3269)
11-01 04:20:25.598: ERROR/AndroidRuntime(5960):     at pdftron.PDF.PDFViewCtrl.<init>(SourceFile:3268)
11-01 04:20:25.598: ERROR/AndroidRuntime(5960):     at com.pdftron.pdfnet.demo.pdfviewctrl.PDFViewCtrlDemo.onCreate(PDFViewCtrlDemo.java:56)
11-01 04:20:25.598: ERROR/AndroidRuntime(5960):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
11-01 04:20:25.598: ERROR/AndroidRuntime(5960):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
11-01 04:20:25.598: ERROR/AndroidRuntime(5960):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
11-01 04:20:25.598: ERROR/AndroidRuntime(5960):     at android.app.ActivityThread.access$2200(ActivityThread.java:119)
11-01 04:20:25.598: ERROR/AndroidRuntime(5960):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
11-01 04:20:25.598: ERROR/AndroidRuntime(5960):     at android.os.Handler.dispatchMessage(Handler.java:99)
 
I have added .so files to the library folders and jar files also. Is there anything specific I need else to do?
And the second question: is there a way to make project smaller then 15Mb?
 
---------------
A:  I suspect that you ran your project on an Android device older than version 2.2. ScaleGestureDetector is added in Android 2.2. Currently, PDFNet SDK only supports 2.2 and newer.
 

Regarding reducing the project size down to below 15MB, you can remove either of the two folders (libs/armeabi or libs/armeabi-v7a) in your sample project. The armeabi folder contains the .so file for devices with only arm v6 support, while armeabi-v7a folder contains the .so file for devices with arm v7 support, which is faster. If you have to support both v6 and v7, you can keep armeabi and remove armeabi-v7a. If you keep both, Android will install the proper one based on the arm structure of the device.

 

If required, we can also trim down the size of .so files as part of a custom project (e.g. ~5mb for a bare viewer etc).