Android Question java.lang.Exception: Sub AFTER_SLEEP signature does not match expected signature.

Discussion in 'Android Questions' started by Lowegaterecords, Jun 16, 2019.

  1. Lowegaterecords

    Lowegaterecords Member Licensed User

    Hi I'm having this error in the debug phase, I don't use any starter service, initialization didn't detect this error. This error appears only in debug mode in release mode everything works. In the code I use the Sleep command for some app functions in the call stack resulting in line 0, do you know how I can solve it?
     
  2. DonManfred

    DonManfred Expert Licensed User

    How are you expecting we could help? You did not uploaded a small project which shows the issue. You are hiding all relevant infos.
     
  3. Lowegaterecords

    Lowegaterecords Member Licensed User

    here is the stack, but the error gives it on line 0 with a unique sleep reference.

    An error occurred:
    (Line: 0) Sleep(20)
    java.lang.Exception: Sub AFTER_SLEEP signature does not match expected signature.
    public static void anywheresoftware.b4a.pc.PCResumableSub.afterSleep(int,anywheresoftware.b4a.pc.RemoteObject) throws java.lang.Exception
    class java.lang.Integer, class anywheresoftware.b4a.pc.RemoteObject, class java.lang.String, class java.lang.String,
    Code:
    Sub Timer_Tick
        
    For i = ImageView1.Top To 41%y  Step  -1
            ImageView1.Top =i
            ImageView2.Top=i
            ImageView3.Top=i
            Sleep(
    20)
        
    Next
        
    If ImageView1.Top=41%y Then
            
    For i = 41%y To 42%y Step 1
                ImageView1.Top =i
                ImageView2.Top=i
                ImageView3.top=i
                Sleep(
    20)
            
    Next
        
    End If
    End Sub
    I believe the error is here is the only one with sleep function (20)
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    Why aren't you using ImageView.SetLayoutAnimated?

    If you can reproduce it in a small project then please upload it.
     
  5. Lowegaterecords

    Lowegaterecords Member Licensed User

    The same error also appears when using SetLayoutAnimated I tried to disable the timer and its function but reappeared.

    An error occurred:
    (Line: 0) End Sub
    java.lang.Exception: Sub AFTER_SLEEP signature does not match expected signature.
    public static void anywheresoftware.b4a.pc.PCResumableSub.afterSleep(int,anywheresoftware.b4a.pc.RemoteObject) throws java.lang.Exception
    class java.lang.Integer, class anywheresoftware.b4a.pc.RemoteObject, class java.lang.String, class java.lang.String,

    I noticed that in the compile phase I get this Downsampling 'image two to lack of memory' message in the log. in debug mode if I launch the release it works fine.
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    Try to reproduce it in a small project and upload it.
     
  7. Lowegaterecords

    Lowegaterecords Member Licensed User

    Hp tried to reproduce in another project I get the same error.
     
  8. DonManfred

    DonManfred Expert Licensed User

     
  9. Lowegaterecords

    Lowegaterecords Member Licensed User

    hello I examined the code and there is nothing that could lead to error apart from the sleep method. I'm creating a game without using game libraries, this code is part of the home screen where based on the game progress you go to the next level. but even here I get the same error.

    Code:
    Sub Process_Globals
        
    'These global variables will be declared once when the application starts.
        'These variables can be accessed from all modules.
    Dim IntLivelloBatter As Int
    Dim IntLivelloMarvin As Int
    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 ImVBart As ImageView
        
    Dim Bart As Bitmap
        
        
    Private BTInizia As Button
        
    Private BTContinua As Button
        
    Dim Sigillo As Bitmap
        
    Dim s As SQL
        
    Dim c As Cursor
        
        
        
    Private ImageViewBatter As ImageView
        
    Private ImageViewMarvin As ImageView
        
        
    '''' Livelli''''
        Dim BatterLv As Bitmap
        
    Dim MarvinLv As Bitmap
        
    Dim BatterInt As Int =0
        
    Dim MarvinInt As Int =0
    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("Livelli")
        Load_DB
        Bart.Initialize(
    File.DirAssets,"VaiBart.png")
        Sigillo.Initialize(
    File.DirAssets,"Sigillo.png")
        ImVBart.SetBackgroundImage(Bart)
        
        BatterLv.Initialize(
    File.DirAssets,"Batter.png")
        MarvinLv.Initialize(
    File.DirAssets,"Marvin.png")
        Avanzamento1
        Avanzamento2
        LivelloBatterSuperato
        
    End Sub
    Sub LivelloBatterSuperato
    If IntLivelloBatter=1 Then
        IntLivelloBatter=
    0
        MarvinInt=
    1
        
    Dim unit As Int
        unit=
    1
            s.ExecNonQuery(
    "INSERT INTO Mostri (BatterLv) VALUES('"& unit &"')")
        
    Msgbox("Unit livello next","")
    End If
    End Sub


    Sub Load_DB
    Dim My As String

        
    If File.ExternalWritable Then
            My = 
    File.DirInternal
        
    Else
            My = 
    File.DirInternal
        
    End If

        
    If  File.Exists(File.DirInternal,"DBGiocoSBS.db")= False Then
            
    File.Copy(File.DirAssets,"DBGiocoSBS.db",File.DirInternal,"DBGiocoSBS.db")
        
    End If
        s.Initialize(My,
    "DBGiocoSBS.db",True)
        
    Log("db Inizializzato")
    End Sub

    Sub Avanzamento1
        c=s.ExecQuery(
    "SELECT BatterLv FROM Mostri")
        
    If c.RowCount>0 Then
            
    For i = 0 To c.RowCount-1
                c.Position=i
            
    Next
            BatterInt=c.GetInt(
    "BatterLv")
        
    End If
        
    If BatterInt=1 Then
            ImageViewBatter.Bitmap=BatterLv
            ImVBart.Left=
    13%x
        
    Else
            ImageViewBatter.Bitmap=Sigillo
            ImageViewMarvin.Bitmap=Sigillo
            ImVBart.Left=
    0%x
            
    For i=ImVBart.Left To 13%x Step 1dip
                ImVBart.Left=i
                Sleep(
    5)
            
    Next
            BTInizia.Visible=
    True
            Sleep(
    1000)
        
    End If
    End Sub

    Sub Avanzamento2
        
    If BatterInt=1 Then
        ImageViewMarvin.Bitmap=Sigillo
            ImVBart.Left=
    13%x
            
    For i=ImVBart.Left To 33%x Step 1dip
                ImVBart.Left=i
                Sleep(
    5)
            
    Next
               BTContinua.Visible=
    True
            Sleep(
    1000)
            
    Else
                  ImageViewMarvin.Bitmap=Sigillo
            
    End If
    End Sub

    Sub Avanzamento3
        
    c=s.ExecQuery(
    "SELECT MarvinLv FROM Mostri")
    If c.RowCount>0 Then
        
    For i = 0 To c.RowCount-1
            c.Position=i
        
    Next
        MarvinInt=c.GetInt(
    "MarvinLv")
        
    If MarvinInt=1 Then
        ImageViewMarvin.Bitmap=MarvinLv
        
    End If
        
    End If
    End Sub

    Sub Activity_Resume
        Avanzamento1
        Avanzamento2
        LivelloBatterSuperato
        
    End Sub


    Sub BTInizia_Click
        
    StartActivity("Batter")
        
    Activity.Finish
    End Sub

    Sub BTContinua_Click
       
    StartActivity("Marvin")
        
    Activity.Finish
    End Sub

    Sub Activity_Pause (UserClosed As Boolean)

    End Sub
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice