Im trying to compile an andriod app API level 7 with Admob Sdk 6.3.1 but Im get an error related to
"android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize">"
I googled it and learnt that I've to compile against Android 3.2 and set SDK Min to 13. But that way my app will not be compatible with Android 2.1, am I correct? Is there any workaround? Am I missing something?
No, you can compile against a higher level, but still support lower SDK levels. Per the Admob Documentation:
The Google AdMob Ads SDK for Android requires a run-time of Android 1.5 or later (set android:minSdkVersion to at least 3 in your AndroidManifest.xml). This means you can develop with the latest version of the Android SDK and your app will still run on an earlier Android version (1.5 minimum).
Related
I am new to Android development. I am told to create an android app that should support android Version 5 (Lollipop) and android Version 9 (Pie). How should I approach this? Should i create 2 different apps supporting Version 5 and Version 9?
Is there any way to make a single app that runs on both version 5 and version 9?
If I use AndroidX, then will it make sure that the app look and function same on both version 5 and 9?
P.S.: I am told to build the app using Xamarin Android Native (not Xamarin Forms).
Thanks.
First you need to understand the following Settings:
Target Framework :Specifies which framework to use in building your application. This API level is used at compile time by Xamarin.Android.
Minimum Android Version:Specifies the oldest Android version that you want your app to support. This API level is used at run time by Android.
Target Android Version:Specifies the version of Android that your app is intended to run on. This API level is used at run time by Android.
Normally, all three Xamarin.Android API levels are set to the same value. On the Application page, set Compile using Android version (Target Framework) to the latest stable API version (or, at a minimum, to the Android version that has all of the features you need)strong text
On the Android Manifest page, set the Minimum Android version to Use Compile using SDK version and set the Target Android version to the same value as the Target Framework version.
If you want to maintain backward compatibility with an earlier version of Android, set Minimum Android version to target to the oldest version of Android that you want your app to support.
Then in you case,you could set the Target Framework version to Android 9.0,and Minimum Android Version to Android 5,Target Android Version to Android 9.0.
I am trying to make a basic Xamarin.forms (pcl) application (in Visual studio 2017) and i want to Target Lolipop (5.0.0, api level 21).
So i made a basic Xamarin solution and i adjusted the Android properties all to Android 5.0 lollipop
Compile using Android version "Android 5.0 (Lollipop)"
Minimum Android to target "Android 5.0 (API Level 21 - Lollipop)"
Target Android Version "Android 5.0 (API Level 21 - Lollipop)"
Unfortunately in my warning list i get the following
Severity Code Description Project File Line Suppression State
Warning The $(TargetFrameworkVersion) for Xamarin.Forms.Platform.dll (v7.0) is greater than the $(TargetFrameworkVersion) for your project (v5.0). You need to increase the $(TargetFrameworkVersion) for your project. Prolang.Android C:\Projects\Prolang\Prolang\Prolang.Android\Prolang.Android.csproj
If i google for this error most people say to indeed update your android project to use the latest Targetframework version. But in my case i really want to only be able to call Api calls that are available to level 21 aka Android 5.0 Lollipop. As in i want the compile time safety net that i only use Api Calls from Api level 21.
To me it seems like i have to downgrade my xamarin.Forms dll to a version that is made specifically for android lollipop since the one i use right now targets a higher version.
So should i downgrade my xamarin.forms dll to achieve this and get rid of the error? And if i downgrade to what version do i need to downgrade so i target Android 5.0 Lollipop? This information is all pretty unclear to me.
Xamarin.Forms is designed using the Android's support libraries so it will run on a wide range of APIs without any additional actions from the developer.
If you are using native APIs via Xamarin.Android (assumably via Forms' Dependency Service) then yes you would have to be aware of the API level of the method calls.
That said, since Xamarin.Forms uses the com.android.support.* libraries and you would have to have to a Forms versions that uses com.android.support:design:21.x.x and the associated Android build tools for API 21.
Now you can review the package dependancies and you will see that your choices are Forms' is 1.4
`1.4.0.6336-pre1` to `1.4.4.6449`
Note: v1.5.x moved to version 22 of the Android support libraries
IMHO using Forms's 1.4 would a bad mistake due to its age and the mountain of improvements and bugs fixes since 2015, you are so much better off:
Using the latest Forms version
Set the Framework version to latest (7.1)
Set the Target Android version to Android 5.0 (API Level 21)
Set the Minimum Android version to whatever you need...
Forgo the compile time API checks
Check runtime API issues via API-21 devices and emulators
if i use android 4.1.2 (API 16) Android SDK will my apps work on Android 2.3 phones. i have downloaded android 4.1.2 sdk tools and other packages.
You will need to set the minimum SDK attribute in your manifest to 2.3 to ensure you app will work on earlier versions of the OS.
Your app will work fine, assuming you are not using any API calls from a later version.
The Android Dev team suggests you always compile against the newest version you can support. So, you are on the right track.
So bottom line, you are on the right track, just make sure to test your app against a 2.3.3 version of the emulator to ensure you are not using any un-supported API calls.
No, if your minimum sdk version is 16 it wont work on that android version.
if you want it to work on that specific version then set the minimum sdk version to 9. You can change this in the apps manifest file.
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="21"
/>
If you are getting errors probably saying "This code uses the minimum sdk to be api 16 or higher"
find alternate ways to modify the code for older android phones. If that does not work then dont support old version of android maybe.
I've already asked Google support about this and they were no help ...
In my manifest I have
uses-sdk android:minSdkVersion="10"
which corresponds to version 2.3.3 however when I publish the app to the market it says that the minimum version required is 2.3.7 and uses that in the filter.
How do I tell the market to use 2.3.3 as the minimum version ??
Thanks.
2.3.7 is the latest revision of Gingerbread_MR1. I would recommend switching to SDK version 9 if supporting 2.3.3 is really that important.
I suspect your manifest filter entries (or) API used is compatible of 2.3.7 than 2.3.3 (I suspect you might upgraded to 2.3.7) which prevents using 2.3.3 even though you use min-sdk 10.
see this comment from documentation
o use APIs introduced in Android 2.3.3 in your application, you need compile the application against the Android library that is provided in the Android 2.3.3 SDK platform.
While creating an android project if i say that the Build Target of my Android porject is 2.2 (API Level is picked as 8) and in the text box for Min SDK version. If i put some value apart from the API level (smaller or greater than 8) of the build target then what happens?
Does the build happen according to the build target specified, but the application developed is compatible with the smaller android versions (if i specify API level < 8 ). Or the application developed is only compatible for the higher android version (if i specify API level > 8 ).
Can anyone please explain?
There is a similiar question already posted with an excellent answer:
Read the post by Steve H.
Android Min SDK Version vs. Target SDK Version
Say you set the manifest API level to 4, then the app will work on any api 4 device provided. BUT the project will be built to API level 8 so if you have any post-level 4 api methods in your code then the app will crash.
You can only put min SDK version less than your target version,it tell that your application can support to that min SDK version,but you should confirm that your application should run under min SDK version supported devices since the Build target versions may use new APIs which are available for that specific version and those APIs may not available in min SDK versions
ok.. if you have developed an application using particular sdk for instance Android 2.2 and your minSDKversion is < 8 then application is falsely declaring to android system that It can be installed in Android device having sdk version less than Android 2.2. In that case if application happens to install on Android 2.1 and if you re using API that are exculsiviely avaialbe in Android 2.2 platform and not on Android 2.1 then your application will crash on the device. if your minsdkversion > 8 then application won't get installed on the device having Android sdk 2.2 or lower version