Android Question FlingableWebView Uncaught Translation Error

db0070

Active Member
Licensed User
Longtime User
I am getting the following error after I updated my code as described in Post #5

Uncaught translation error: java.lang.IllegalArgumentException: already added: Luk/co/martinpearman/b4a/webkit/FlingableWebView;
 

db0070

Active Member
Licensed User
Longtime User
I created a completely new project and copied the following code into the project (from Post #5 )
B4X:
Sub Process_Globals

End Sub

Sub Globals
    Dim FlingableWebView1 As FlingableWebView
    Dim DefaultWebViewClient1 As DefaultWebViewClient
End Sub

Sub Activity_Create(FirstTime As Boolean)
    FlingableWebView1.Initialize2("FlingableWebView1","MyIf")
    DefaultWebViewClient1.Initialize("DefaultWV")
    Activity.AddView(FlingableWebView1, 32dip, 32dip, 100%x-64dip, 100%y-64dip)
    FlingableWebView1.SetWebViewClient(DefaultWebViewClient1)
    FlingableWebView1.LoadUrl("http://www.b4x.com/android/forum/threads/get-left-or-right-swipe-from-panel-over-webview.32611/")
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub FlingableWebView1_DoubleTap(X As Float, Y As Float) As Boolean
    Log("FlingableWebView1_DoubleTap "&X&", "&Y)

    '    this Sub must return a Boolean value

    '    return False to indicate that you have not handled the event
    '    the WebView will take it's default action

    '    return True to indicate that you have handled the event
    '    the WebView will take no action

    Return False
End Sub

Sub FlingableWebView1_Fling(MovementX As Float, VelocityX As Float, MovementY As Float, VelocityY As Float) As Boolean
    Log("FlingableWebView1_Fling "&MovementX&" "&VelocityX&" | "&MovementY&" "&VelocityY)

    '    this Sub must return a Boolean value

    '    return False to indicate that you have not handled the event
    '    the WebView will take it's default action

    '    return True to indicate that you have handled the event
    '    the WebView will take no action

    Return False
End Sub

Sub FlingableWebView1_LongPress(X As Float, Y As Float)
    Log("FlingableWebView1_LongPress "&X&", "&Y)
    '    note this event has no return value
End Sub

Sub FlingableWebView1_PageFinished (FlingableWebView As FlingableWebView, Url As String)
    Log("FlingableWebView1_PageFinished Url="&Url)
End Sub

Sub FlingableWebView1_SingleTap(X As Float, Y As Float) As Boolean
    Log("FlingableWebView1_SingleTap "&X&", "&Y)

    '    this Sub must return a Boolean value

    '    return False to indicate that you have not handled the event
    '    the WebView will take it's default action

    '    return True to indicate that you have handled the event
    '    the WebView will take no action

    Return False
End Sub
Sub DefaultWV_ReceivedError (FlingableWebView As FlingableWebView, ErrorCode As Int, Description As String, FailingUrl As String)
    Log("error" & Description)
End Sub
Sub DefaultWV_ReceivedSslError (FlingableWebView As FlingableWebView, SslErrorHandler1 As SslErrorHandler, SslError1 As SslError)
    Log("error" )
End Sub

and I get this error

B4A Version: 9.80
Java Version: 11
Parsing code. (0.00s)
Building folders structure. (0.01s)
Compiling code. (0.75s)
Compiling layouts code. (0.00s)
Organizing libraries. (0.00s)
(AndroidX SDK)
Generating R file. (5.16s)
Compiling debugger engine code. (1.70s)
Compiling generated Java code. Error
B4A line: 11
FlingableWebView1.Initialize2(\
src\b4a\example\main.java:384: error: cannot find symbol
mostCurrent._flingablewebview1.Initialize2(mostCurrent.activityBA,"FlingableWebView1","MyIf");
^
symbol: method Initialize2(BA,String,String)
location: variable _flingablewebview1 of type FlingableWebView

I then installed Oracle JDK 8 and configured the path in B4A and I get the same error below.
I then removed references to AJWebkit, and the program compiles, but of course will fail Google's SSL error handling test. Does anyone know how to overcome this or is FlingableWebView no longer a valid library for B4A?

B4A Version: 9.80
Java Version: 8
Parsing code. (0.00s)
Building folders structure. (0.02s)
Compiling code. (0.07s)
Compiling layouts code. (0.00s)
Organizing libraries. (0.00s)
(AndroidX SDK)
Generating R file. (0.00s)
Compiling debugger engine code. (0.72s)
Compiling generated Java code. Error
B4A line: 11
FlingableWebView1.Initialize2(\
javac 1.8.0_251
src\b4a\example\main.java:384: error: cannot find symbol
mostCurrent._flingablewebview1.Initialize2(mostCurrent.activityBA,"FlingableWebView1","MyIf");
^
symbol: method Initialize2(BA,String,String)
location: variable _flingablewebview1 of type FlingableWebView
 
Upvote 0

db0070

Active Member
Licensed User
Longtime User
Am I running the correct version of javac 1.8.0_251?
How do I find out more about the error "cannot find symbol mostCurrent._flingablewebview1"
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Hard to help with the infos you provided.

Upload a small project which shows the issue
 
Upvote 0

db0070

Active Member
Licensed User
Longtime User
This attached project is the same code as mentioned in Post #5 - the thread is 4 years old and is not working for me now.
I am using AJWebKit Version 0.23, Core Version 9.8 and FlingableWebView Version 0.02 and in case I am doing something in the manifest, it is:-
B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="17" android:targetSdkVersion="28"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
CreateResourceFromFile(Macro, Themes.DarkTheme)
'End of default text.
SetApplicationAttribute(android:usesCleartextTraffic, "true")
CreateResourceFromFile(Macro, Core.NetworkClearText)
SetApplicationAttribute(android:theme, "@style/Theme.AppCompat")
 

Attachments

  • test.zip
    8.2 KB · Views: 226
Upvote 0

db0070

Active Member
Licensed User
Longtime User
Does anyone else get's the same error, or is something wrong in my setup? I have re-installed a fresh copy of B4X
 
Upvote 0
Top