Android Question APP compiled with SDK=26 functioned with Android8,but not functioned in Android 7.1.2

petr4ppc

Well-Known Member
Licensed User
Longtime User
Dear friends,

I am using SDK=26 and phone with Android 8.
Before I CheckandRequest permission I am using this code:
B4X:
If myphone.SdkVersion>=26 Then
Everything is OK

if I compile same software with SDK=24 or SDK=19 then I get error message in B4A v8.30:
C:\aaa\Objects\bin\extra\res1\res\values-v21\values-v21.xml:8: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/TextAppearance.Material.Notification'.
C:\aaa\Objects\bin\extra\res1\res\values-v21\values-v21.xml:8: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/TextAppearance.Material.Notification.Info'.

and this message I get in LOGS if I run APP in phone with Android 7.1.2. This version of APP is perfectly functined with Android 8.

*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
main$ResumableSub_Activity_Createresume (java line: 1336)
java.lang.SecurityException: getLine1NumberForDisplay: Neither user 10145 nor current process has android.permission.READ_PHONE_STATE or android.permission.READ_SMS.
at android.os.Parcel.readException(Parcel.java:1684)
at android.os.Parcel.readException(Parcel.java:1637)
at com.android.internal.telephony.ITelephony$Stub$Proxy.getLine1NumberForDisplay(ITelephony.java:4136)
at android.telephony.TelephonyManager.getLine1Number(TelephonyManager.java:2317)
at android.telephony.TelephonyManager.getLine1Number(TelephonyManager.java:2294)
at anywheresoftware.b4a.phone.Phone$PhoneId.GetLine1Number(Phone.java:450)
at test.app.mobile.main$ResumableSub_Activity_Create.resume(main.java:1336)
at test.app.mobile.main._activity_create(main.java:1094)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:191)
at test.app.mobile.main.afterFirstLayout(main.java:104)
at test.app.mobile.main.access$000(main.java:17)
at test.app.mobile.main$WaitForLayout.run(main.java:82)
at android.os.Handler.handleCallback(Handler.java:754)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:163)
at android.app.ActivityThread.main(ActivityThread.java:6221)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)

I am doing mistake with
B4X:
If myphone.SdkVersion>=26 Then
or with using some bad SDK?

In manifest I have
B4X:
<uses-sdk android:minSdkVersion="4"/>
I have tried to change this to 10 or 15, but I get same errors

If I compile program with >=SDK26 then it is not compatibile with older Android version?

Thank you very much
p4ppc
 

petr4ppc

Well-Known Member
Licensed User
Longtime User
UPDATE:
It was my mistake
Everything is OK with Android 7.1.2.
Phone have SDK=25 and I had set >=SDK26.

From SDK 23 is Android working wirh runtimepermission so I set:
B4X:
If myphone.SdkVersion>=23 Then

and everything is working now
 
Upvote 0
Top