質問

I'm developing Android app that among other things use iBeacons. I'm using this iBeacon library, with min-sdk 18.

What I'm trying to do, is to set min-sdk in my app to 14, but then I get:

Error:Main manifest has <uses-sdk android:minSdkVersion='17'> but library uses minSdkVersion='18'

I'm aware that I can't use iBeacons on lower sdk than 18, nonetheless I want to be able to install this app - without iBeacons functionalities - on devices with lower sdk.

役に立ちましたか?

解決

If you are using the Android iBeacon Library, no minSDK is required, and you can safely call most methods even on devices before Android 4.3, although doing so on older operating systems will do nothing but put a warning in LogCat. See here: http://developer.radiusnetworks.com/ibeacon/android/backward-compatibility.html

For this to work, just be sure you are using the Android iBeacon Library version 0.7.6 or higher or the Pro version Android Proximity Library 1.1.2 or higher.

Generally you will want to check capabilities in code so you can appropriately message the user or make alternate functional arrangements using code like below. But the API does not require that you do this.

public String getIncompatibilityReason(Context context) {
    if (android.os.Build.VERSION.SDK_INT < 18) {
        return "requires Android 4.3";
    }
    if (!context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) {
        return "requires Bluetooth LE";
    }
    return null;
}   

他のヒント

Set the minSdk property of the library to 14 and check the SDK version before you use anything from the library.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top