Android Question Configure Paths - SDK, and JDKs

Dave G

Active Member
Licensed User
I've noticed that Configure Path (JDK, SDK) appear to be global to B4A vs unique to a project. So I can't have different JDK or SDK targets for different B4A projects. With Xamarin I can set different SDK depending on the environment of a Solution (compile target SDK and minimum SDK). Is there a way to accomplish with with B4A (and B4I)?

Thanks
 

DonManfred

Expert
Licensed User
Longtime User
What is the reason to use differen SDKs???? It is not needed.

I do have unlimited amount of projects. ALL of them uses the same SDK.
 
Upvote 0

Dave G

Active Member
Licensed User
B4A may be different than Xamarin. An example is applications that will be installed on a newer Android version e.g. 8.0 Oreo, but must be compiled against 4.4 (KitKat) so the user doesn't have to Accept the application writing to Storage. I have a client with several hundred Android devices (4.4 and 8.0) with bar code scanners and the customer doesn't want the user answering questions regarding privileges or keeping 4.4 and 8.0 APKs. By compiling to 4.4 they can deploy the same APK to older (4.4) and newer (8.0) devices. Another example is Android Wear as it targets 4.4w specifically.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
An example is applications that will be installed on a newer Android version e.g. 8.0 Oreo, but must be compiled against 4.4 (KitKat) so the user doesn't have to Accept the application writing to Storage.
You still need to use the 28 android.jar to compile against.

I use the same sdk and targetsdk for Oreo and KitKat. I don´t see a problem here.

You can for sure inside your app check which sdk is the app running on and then decide to request permission for anything or not.
 
Upvote 0

Dave G

Active Member
Licensed User
For example, if I compile against 8.0 (Oreo) and install on a device > API 21 (KitKat) then Android will force the user to Accept Write privilege question (I can test for it and be part of the dialog, but the user must answer the question). If I compile against API 21 (Lollipop) or less, then Android will not force the use to answer the privilege question even if it's a newer version e.g. 8.0. When a client is dealing with hundreds of stores and devices they need them all to act in the same manner even if the devices are different Android versions. Relying on the user to answer the question correctly isn't an option. BTW, it took me many days to figure out how to get around the privilege question being asked because it wasn't asked on older device, but was asked on newer devices. Not much in the way of documentation on the issue on the internet. Later.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
There is no reason to use multiple SDKs.

For example, if I compile against 8.0 (Oreo) and install on a device > API 21 (KitKat) then Android will force the user to Accept Write privilege question (I can test for it and be part of the dialog, but the user must answer the question
That's not correct.

Everything is explained here: android.jar / targetSdkVersion / minSdkVersion
 
Upvote 0

Dave G

Active Member
Licensed User
Xamarin is a bit different than B4A. With Xamarin you set a minimum and a target. The target SDK is used to compile and if it is > API 21 (5.0 Lollipop) then the resulting APK will enforce runtime permissions as mentioned in the link you provided.

The attached screen clip 'androidOreo' produces an APK that enforces runtime permissions. The screen clip androidLollipop produces an APK that doesn't enforce runtime permissions. Same source different APKs. Either one will run on minimum of 4.1 and either <= 5.0 or > 5.0. So, it appears that I can set the min (4.4) and target (5.0) with B4A and select an SDK such as Oreo (8.0) and not force runtime permissions. Correct?
 

Attachments

  • androidOreo.png
    androidOreo.png
    11.1 KB · Views: 115
  • androidLollipop.png
    androidLollipop.png
    10.8 KB · Views: 111
Upvote 0

Dave G

Active Member
Licensed User
Thanks DonMandred. Is I mentioned Xamarin is a bit different so I'm in the process of transitioning. Being able to indicate which SDK to use independent of min and target is new to me and I'll incorporate into my thinking.
 
Upvote 0
Top