Android Question Trying to compile a lib with SLC

asales

Well-Known Member
Licensed User
I'm trying to compile a lib using the SLC tool.
The lib has this lines in the java file:
B4X:
import androidx.annotation.NonNull;
import android.util.JsonReader;
import android.text.TextUtils;

To the androidx.annotation I found the jar, but I don't found the jars to the others references.

When I try to compile I get this errors:
B4X:
Starting step: Compiling Java code.
javac 1.8.0_92
E:\B4X\\Exemplos\DONMANFRED\newstk-src\src\com\newstk\ContentFileParser.java:13: error: package android.util does not exist
import android.util.JsonReader;
                   ^
1 error

\ContentFileParser.java:14: error: package android.text does not exist
import android.text.TextUtils;
How can I fix it? With Android libs?

Thanks in advance for any tip.
 

agraham

Expert
Licensed User
TextUtils was present in the first Android release but is now deprecated and in fact when I check in Android.jar in SDK 30 it has been removed.
TextUtils | Android Developers
This method was deprecated in API level 26.
Do not use. This is not internationalized, and has known issues with right-to-left text, languages that have more than one plural form, languages that use a different character as a comma-like separator, etc. Use listEllipsize(Context, List, String, TextPaint, float, int) instead.
You will need to rewrite the code that uses it.

JsonReader IS present in SDK 30 so should not cause an error.
 
Upvote 0

agraham

Expert
Licensed User
Actually I'm wrong :(. I looked again in Android.jar from the SDK30 and TextUtils is in fact still there so I can't explain your compile error as SLC uses the same SDK as your installation of B4A uses and only one method of TextUitls is in fact deprecated. Sorry for the misinformation I'm getting too old for this game and seem to be becoming prone to making silly oversights and assumptions. I must remember to double check what I do in future.
 
Upvote 0
Top