Android Question Code problem (FAILED_VERSION_DOWNGRADE) (Solved)

Shelby

Well-Known Member
Licensed User
The following error doesn't give me a clue as to what I need to do. Any suggestions?
B4X:
Installing file to device.    Error adb: failed to install Date_tomorrow_RAPID_DEBUG.apk: Failure [INSTALL_FAILED_VERSION_DOWNGRADE]
 

Shelby

Well-Known Member
Licensed User
I'm just practicing trying to get the date tomorrow to display......

B4X:
Sub Globals
    Dim Tomorrow As Long   
    Private lblDate 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("Tomorrow")   
    Tomorrow = DateTime.Add(DateTime.Now, 0, 0, 1)
    Log("Tomorrow’s date is: " & DateTime.Date(Tomorrow))
End Sub
Sub Date_Tomorrow
    '?????

End Sub


Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub
 
Upvote 0

Shelby

Well-Known Member
Licensed User
My phone says app not installed. The bridge says connected. Also even my log won't show tomorrow's date.
B4X:
Activity.LoadLayout("Tomorrow")
    Tomorrow = DateTime.Add(DateTime.Now, 0, 0, 1)
    Log("Tomorrow’s date is: " & DateTime.Date(Tomorrow))
    Activity.Initialize("")
 
Last edited:
Upvote 0

Geezer

Active Member
Licensed User
Longtime User
From the error message, it sounds like you're trying to install an earlier version, but I could be wrong.

Try uninstalling the app and then rebuild and let it install again
 
Upvote 0

karld

Active Member
Licensed User
Longtime User
Failure [INSTALL_FAILED_VERSION_DOWNGRADE]
This tells you what is wrong.

Looks like you are trying to install an apk that has an older version than one currently installed.
 
Upvote 0

Shelby

Well-Known Member
Licensed User
B4X:
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
   
    Activity.LoadLayout("Tomorrow")
    Tomorrow = DateTime.Add(DateTime.Now, 0, 0, 1)
    Log("Tomorrow’s date is: " & DateTime.Date(Tomorrow))
    lblDate.Initialize("")
   
End Sub
Sub Date_Tomorrow
    '?????
End Sub
Thanks Dey; that worked. Now I'm not sure what to initialize. I tried Activity.Initialize. Even my log won't show tomorrow's date. I'll try adding library: DateUtils and I'll check an Erel tutorial or two.
 
Last edited:
Upvote 0

Computersmith64

Well-Known Member
Licensed User
Longtime User
It's not the target sdk version that's the issue, it's the build version of the app. In your Main activity, right at the top is #Region Project Attributes. In there you have:

B4X:
#VersionCode: 
#VersionName:

Make sure your #VersionCode is equal to or larger than the previous build, otherwise it will not install.

- Colin.
 
Upvote 0

Shelby

Well-Known Member
Licensed User
Thanks Guys,
I hope that's the general rule I was searching for. Now on my own (working for months) app I see 1 as the version code which works fine. The new experimental b4a projects have that field blank. I'll use 1 and not understand what that 1 means and see if it works....it did not work. After using 8.5 in that field I had the same error message. Finilly when I used 8 as the version code all went well with the compiling. If I click the field on the emulator the date and time disappear. I don't understand what it all means.
 
Last edited:
Upvote 0

Shelby

Well-Known Member
Licensed User
I tried 1,2,3,4,5,6 and 7 with no success but 8 worked. 8.5 and 8.50 did not work. My phone (S9) now works as well with the bridge. Playing around with the version I tried 9 and it worked. Then when trying 8 again it failed. Nine worked again and I see that apparently I must not go too high with the version number or can't reduce any future version code number below the highest ever used.
Thanks again Erel, Dr. Smith, Dey, and Geezer.
 
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
8.5 and 8.50 did not work.
It must be an integer.

I tried 1,2,3,4,5,6 and 7
This means that you previously installed an app with the same package name and VersionCode set to 8.

The solution is very simple. Set it to a higher value or uninstall the existing app.
 
Upvote 0

Shelby

Well-Known Member
Licensed User
O.K., Now I see how to get the version code number back to a smaller number if desired; just rebuild it and, or I guess rename it since you said this numbering is pertaining to the same package name.
Ah.....all is well now.
 
Last edited:
Upvote 0
Top