Android Question [SOLVED] Error when running app - java.lang.ClassNotFoundException:

Peter Lewis

Active Member
Licensed User
Longtime User
Hi All

I am getting this error cause for the app to fail. Compiled perfectly but then when opening this is what it showed as the cause line


this is the full error log


Any advise would be great.

Thank you

Peter
 

Peter Lewis

Active Member
Licensed User
Longtime User
How could we help? You are providing exactly zero information about your app, your manifest, the libraries you are using.

Upload a small example that shows the problem.

Hi
Sorry it was an app that you did previously with the Scratch and Win v1.5 of your lib and I also added the extra line for the .jar

B4X:
#Region  Project Attributes
    #ApplicationLabel: Scratch Card
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
  
#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
    #AdditionalJar: com.android.support:support-v4
#End Region


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.
    Private ScratchImageView1 As ScratchImageView
    Private ScratchTextView1 As ScratchTextView
    Private ScratchTextView2 As ScratchTextView
    Private ScratchTextView3 As ScratchTextView
    Private tvList As List
    Private Label1 As Label
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")
    tvList.Initialize
    tvList.Add(ScratchTextView1)
    tvList.Add(ScratchTextView2)
    tvList.Add(ScratchTextView3)
    ScratchImageView1.SetLayout(50dip,50dip,150dip,150dip)
    'ScratchTextView1.SetLayout(0,300dip,100%x,50dip)
    ScratchTextView1.Tag = 1000
    ScratchTextView2.Tag = 500
    ScratchTextView3.Tag = 100


    ScratchTextView1.Invalidate
    ScratchTextView2.Invalidate
    ScratchTextView3.Invalidate
  
    Dim bmp As Bitmap
    bmp.Initialize(File.DirAssets,"donmanfred.png")
    Dim d As BitmapDrawable
    d.Initialize(bmp)
    ScratchImageView1.ImageDrawable = d
  
  
    ScratchImageView1.SetBackgroundImage(bmp)
End Sub

Sub Activity_Resume
    'ScratchImageView1.clear

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub


Sub ScratchImageView1_onRevealed()
    Log($"ScratchImageView1_onRevealed"$)
End Sub
Sub ScratchImageView1_PercentRevealed(percent As Double)
    Log($"ScratchImageView1_PercentRevealed(${percent})"$)
End Sub

Sub ScratchText_PercentRevealed(percent As Double)
    Log($"ScratchImageView1_PercentRevealed(${percent})"$)
End Sub

Sub ScratchText_onRevealed()
    Log($"ScratchText_onRevealed"$)     
    Dim stv As ScratchTextView = Sender
    Dim amount As Int = stv.Tag
    Label1.Text = "$"&amount
End Sub

Sub ScratchText_onScratching(Scratched As Boolean)
    Log($"ScratchText_onScratching"$)
    Dim stv As ScratchTextView = Sender
    For i = 0 To tvList.Size-1
        Dim s As ScratchTextView = tvList.Get(i)
        If s <> stv Then
            s.Visible = False
        End If
    Next
  
End Sub

Here is the Manifest

B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="30"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.
'SetApplicationAttribute(android:theme, "@style/MaterialTheme")
 
Last edited:
Upvote 0

Peter Lewis

Active Member
Licensed User
Longtime User
Hi

I got this error message which will not allow me to continue. I checked in the map file

#Tue Feb 16 11:04:51 CAT 2021
billscanner.jar=1613384515000
pdfium.jar=1550240928000

But it will not overwrite it. I did make a copy of the file and deleted the original then copied back the copy , still same issue. i also deleted the map file and tried again but the same error messages




 
Upvote 0

Peter Lewis

Active Member
Licensed User
Longtime User
It can't access this folder for some reason. You will need to move it to a different folder. This is strange as Documents folder should be accessible.
I moved it to r: Drive and it did not give an error anymore
I have updated my Android SDK
Latest version of B4A

The Only problem in Jetify is not used


Jetify Map file shows all of these which includes the .jar file that this app uses

B4X:
#Fri Jun 25 17:00:20 CAT 2021
cache.jar=1494660108000
billscanner.jar=1613384515000
threading.jar=1340442798645
websocket.jar=1587542978000
scratchview.jar=1466939269094
touchimageview.jar=1338106948000
b4aaccessibilityservices.jar=1582383347411
bitmapextended.jar=1316898198000
slf4j-api-1.7.30.jar=1590385568000
myownlib13.jar=1613581663735
ss_base64convert.jar=1523298420000
pdfium.jar=1550240928000
native-lib-loader-2.3.4.jar=1590385478000
webp4j-0.0.2.jar=1590385184000
clipboard.jar=1295204432000
expressionevaluator.jar=1297159292419

I then ran the program and it gave me this error


The fact is said Failed resolution, I went to the designer and all I did was to tick full screen, save and compile and it WORKED !!!!.
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…