3
votes

The new Facebook Android SDK requires android min API level 15 but almost all of my apps are at min API level 9. If I integrate new FB Android SDK would that crash my apps on devices with API level below 15?

Also would Share images on FB functionality on API level 9 devices stop working if I get the new SDK?

1

1 Answers

5
votes

The minSdkVersion attribute means that the library was designed without considering the API levels lower than that value. The developers didn't pay attention if a method or a field is unavailable on API level lower than 15, and this is the method to inform you.

For example the field THREAD_POOL_EXECUTOR used in the method getExecutor is available only from API level 11:

public static Executor getExecutor() {
    synchronized (LOCK) {
        if (FacebookSdk.executor == null) {
            FacebookSdk.executor = AsyncTask.THREAD_POOL_EXECUTOR;
        }
    }
    return FacebookSdk.executor;
}

In version 4.5.1 the getExecutor method is different and supports also API level 9:

public static Executor getExecutor() {
    synchronized (LOCK) {
        if (FacebookSdk.executor == null) {
            Executor executor = getAsyncTaskExecutor();
            if (executor == null) {
                executor = new ThreadPoolExecutor(
                        DEFAULT_CORE_POOL_SIZE, DEFAULT_MAXIMUM_POOL_SIZE, DEFAULT_KEEP_ALIVE,
                        TimeUnit.SECONDS, DEFAULT_WORK_QUEUE, DEFAULT_THREAD_FACTORY);
            }
            FacebookSdk.executor = executor;
        }
    }
    return FacebookSdk.executor;
}

In conclusion you shouldn't use the last version of the Facebook SDK but you should stick with the last compatible version (4.5.0).

The change in minApk version is shown in the upgrade log below: - https://developers.facebook.com/docs/android/upgrading-4.x.

and the release of interest is below https://github.com/facebook/facebook-android-sdk/releases?after=sdk-version-4.8.1