Android Question Preference lib error in ver 11.5 B4A

SMOOTSARA

Active Member
Licensed User
Longtime User
Hey guys 🙏

I was going to update my build with the new version of B4A ver 11.5.
The problem is that this program uses the "Preference" library version 3.

I have used this library and the following methods in about 500 lineso_O

PreferenceManager1.GetString2
PreferenceManager1.RemoveKey




But in the new version of B4A 11.5 I get the following error

B4X:
Organizing libraries.    (0.00s)
    (AndroidX SDK)
Compiling resources    (0.08s)
Linking resources    Error
c:\android\tools\..\extras\b4a_remote\androidx\core\core\1.7.0\unpacked-core-1.7.0\res\values\values.xml:113: error: resource android:attr/lStar not found.
error: failed linking references.

It is recommended to use the " PreferenceActivity " library instead
But the following methods are not available in this library

.GetString2
.RemoveKey



Is it possible to synchronize the "Preference" library with the new version B4A 11.5 ?

or

?update the "PreferenceActivity" library to a new version with new method

Thank you
 
Solution
The problem was solved

First, I deleted the tools in android SDK folder and replaced it with the new version from the link below

Then in B4A ->Tools -> Paths Configuration I changed the address from "android.jar ->28" to "android.jar ->32"

All known old libraries and applications work

Sagenut

Expert
Licensed User
Longtime User
Make a new Android SDK folder with the latest files supplied in B4A Installation Steps.
Remember they are 2 pieces:
Android SDK
Resources
 
Upvote 0

Sagenut

Expert
Licensed User
Longtime User
Did you extracted them with Third party software like 7Zip?
Unzipping with Windows often create problems.
 
Upvote 0

SMOOTSARA

Active Member
Licensed User
Longtime User
Did you extracted them with Third party software like 7Zip?
Unzipping with Windows often create problems.
Yes, I opened them with 7zip
I do not think this is a problem.
In the new version there libraries cause errors
 
Upvote 0

SMOOTSARA

Active Member
Licensed User
Longtime User
The internal PreferenceActivity library works fine?

Post a link to the problematic library.
Hi Earl
Thank you for your answer

The internal PreferenceActivity library works fine?
Yes, but its methods are not complete.

Post a link to the problematic library.
Unfortunately I did not find the link
I attach the library to this post
 

Attachments

  • Preferences_Lib.rar
    65.7 KB · Views: 81
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Remove key:
B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("MainPage")
    Dim sp As JavaObject = GetSharedPreferences
    Dim editor As JavaObject = sp.RunMethod("edit", Null)
    editor.RunMethod("remove", Array("some key"))
    editor.RunMethod("commit", Null)
End Sub

Private Sub GetSharedPreferences As JavaObject
    Dim context As JavaObject
    context.InitializeContext
    Dim jo As JavaObject
    Return jo.InitializeStatic("android.preference.PreferenceManager").RunMethod("getDefaultSharedPreferences", Array(context))
End Sub
 
Upvote 0

SMOOTSARA

Active Member
Licensed User
Longtime User
The problem was solved

First, I deleted the tools in android SDK folder and replaced it with the new version from the link below

Then in B4A ->Tools -> Paths Configuration I changed the address from "android.jar ->28" to "android.jar ->32"

All known old libraries and applications work
 
Upvote 0
Solution
Top