Hi all. if i try this code with targetSdkVersion = 19 work without problem
if i have targetSdkVersion="26" i have this error:
Any idea ?
HERE ( https://www.dropbox.com/s/9e2w4ukzsxk8uoz/libPDFViewer.zip?dl=0 ) example project
Thank you
Marco
B4X:
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim pdf As PDFViewer
Dim i,pc As Int=0
Dim iv
Dim rp As RuntimePermissions
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
If Not(rp.Check(rp.PERMISSION_WRITE_EXTERNAL_STORAGE))Then
rp.CheckAndRequest(rp.PERMISSION_WRITE_EXTERNAL_STORAGE)
Else
'gmap.MyLocationEnabled = Result
Log("Permssi accordati")
Log("CopyFile()")
If Not(File.Exists(File.DirRootExternal, "test.pdf")) Then
Log("test.pdf does not exist at DirRootExternal")
File.Copy(File.DirAssets, "test.pdf", File.DirRootExternal, "test.pdf")
Log("test.pdf copied")
End If
pdf.init
Activity.AddView(pdf,0,0,-1,-1)
pdf.getpdf2(File.Combine(File.DirRootExternal,"test.pdf"),"")
End If
End Sub
Sub Activity_PermissionResult (Permission As String, Result As Boolean)
If Permission = rp.PERMISSION_WRITE_EXTERNAL_STORAGE Then
'gmap.MyLocationEnabled = Result
Log("Permssi accordati")
Log("CopyFile()")
If Not(File.Exists(File.DirRootExternal, "test.pdf")) Then
Log("test.pdf does not exist at DirRootExternal")
File.Copy(File.DirAssets, "test.pdf", File.DirRootExternal, "test.pdf")
Log("test.pdf copied")
End If
pdf.init
Activity.AddView(pdf,0,0,-1,-1)
pdf.getpdf2(File.Combine(File.DirRootExternal,"test.pdf"),"")
End If
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
if i have targetSdkVersion="26" i have this error:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Permssi accordati
CopyFile()
java.lang.UnsatisfiedLinkError: dlopen failed: "/data/app/b4a.example.pdfviewer2-xL41jgevqM2C35EorzE7CQ==/lib/arm/libpdfview2.so" has text relocations
at java.lang.Runtime.loadLibrary0(Runtime.java:1016)
at java.lang.System.loadLibrary(System.java:1657)
at de.donmanfred.pdfviewerwrapper.init(pdfviewerwrapper.java:104)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:778)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:358)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at b4a.example.pdfviewer2.main.afterFirstLayout(main.java:104)
at b4a.example.pdfviewer2.main.access$000(main.java:17)
at b4a.example.pdfviewer2.main$WaitForLayout.run(main.java:82)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6944)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
** Activity (main) Resume **
An error occurred:
(Line: 49) Activity.AddView(pdf,0,0,-1,-1)
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean
Any idea ?
HERE ( https://www.dropbox.com/s/9e2w4ukzsxk8uoz/libPDFViewer.zip?dl=0 ) example project
Thank you
Marco