Building TFLite for Android with CMake requires Android 26
Hi @GoldFeniks 

As this issue is being tracked in #61312 , can we close this as duplicate?

Thanks. Hello @pjpratik,

I would argue that it's a separate issue.

In the docs the minimal supported version is still 19 or 21 for most of the modules: https://www.tensorflow.org/lite/android/development Hi, @pjpratik !
This is a separate issue. Seems like tensorflow 2.13 includes `AHardwareBuffer_*` functions, which are only available starting with Android 26, though the minimal version reported in documentation is Android 19. Does gpu delegate require Android 26 starting with tensorflow 2.13? Thanks for the clarification @AntonMalyshev @GoldFeniks 

I was able to reproduce this. 
<img width="567" alt="image" src="https://github.com/tensorflow/tensorflow/assets/118897289/72eb0045-45f1-4928-9bb9-0200c27063d2">

@pkgoogle Can we have update about this for >=TF2.13?

Thanks. I run into the same issues on master and nightly, I run into a different issue on r2.12 actually.

My reproduce steps:
1. Install Android NDK (in my case via Android Studio)
2. Setup ANDROID_NDK variable to point to Android NDK directory

3. clone repo, make build dir
```sh
git clone https://github.com/tensorflow/tensorflow.git
cd tensorflow
mkdir build
cd build
```

4. run commands in problem description:
```sh
cmake -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake -DANDROID_PLATFORM=android-19 -DANDROID_ABI=arm64-v8a -DCMAKE_ANDROID_NDK_VERSION=25 -DTFLITE_ENABLE_GPU=ON -DCMAKE_BUILD_TYPE=Release ../tensorflow/lite/
make
```

Hi @terryheo, can you please take a look? Thanks.
### Issue type

Build/Install

### Have you reproduced the bug with TensorFlow Nightly?

Yes

### Source

source

### TensorFlow version

2.13

### Custom code

Yes

### OS platform and distribution

Linux 6.3.1, EndeavourOS

### Mobile device

_No response_

### Python version

_No response_

### Bazel version

_No response_

### GCC/compiler version

clang version 14.0.7

### CUDA/cuDNN version

_No response_

### GPU model and memory

_No response_

### Current behavior?

Building libtensorflow-lite.a with CMake with GPU delegate enabled requires `AHardwareBuffer_*` functions only available with 26+ Android API level, though minSdkVersion is stated to be 19 for tensorflow-lite-gpu [here](https://www.tensorflow.org/lite/android/development#minimum_android_sdk_versions_for_libraries). Tested on branches r2.13, nighly and master. Branch r2.12 builds without issues.

### Standalone code to reproduce the issue

```shell
cmake -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake -DANDROID_PLATFORM=android-19 -DANDROID_ABI=arm64-v8a -DCMAKE_ANDROID_NDK_VERSION=25 -DTFLITE_ENABLE_GPU=ON -DCMAKE_BUILD_TYPE=Release ../tensorflow/lite/
make
```


### Relevant log output

```shell
tensorflow/lite/delegates/gpu/delegate.cc:787:7: error: 'AHardwareBuffer_acquire' is unavailable: introduced in Android 26
      AHardwareBuffer_acquire(ahwb);
      ^
/opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/android/hardware_buffer.h:386:6: note: 'AHardwareBuffer_acquire' has been explicitly marked unavailable here
void AHardwareBuffer_acquire(AHardwareBuffer* _Nonnull buffer) __INTRODUCED_IN(26);
     ^
tensorflow/lite/delegates/gpu/delegate.cc:795:9: error: 'AHardwareBuffer_release' is unavailable: introduced in Android 26
        AHardwareBuffer_release(b);
        ^
/opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/android/hardware_buffer.h:394:6: note: 'AHardwareBuffer_release' has been explicitly marked unavailable here
void AHardwareBuffer_release(AHardwareBuffer* _Nonnull buffer) __INTRODUCED_IN(26);
     ^
tensorflow/lite/delegates/gpu/delegate.cc:803:7: error: 'AHardwareBuffer_describe' is unavailable: introduced in Android 26
      AHardwareBuffer_describe(uptr_ahwb.get(), &desc_ahwb);
      ^
/opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/android/hardware_buffer.h:402:6: note: 'AHardwareBuffer_describe' has been explicitly marked unavailable here
void AHardwareBuffer_describe(const AHardwareBuffer* _Nonnull buffer,
     ^
tensorflow/lite/delegates/gpu/delegate.cc:1185:18: error: 'AHardwareBuffer_lock' is unavailable: introduced in Android 26
          return AHardwareBuffer_lock(buffer, this->usage_, -1 /* fence */,
                 ^
/opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/android/hardware_buffer.h:457:5: note: 'AHardwareBuffer_lock' has been explicitly marked unavailable here
int AHardwareBuffer_lock(AHardwareBuffer* _Nonnull buffer, uint64_t usage, int32_t fence,
    ^
tensorflow/lite/delegates/gpu/delegate.cc:1212:24: error: 'AHardwareBuffer_unlock' is unavailable: introduced in Android 26
                return AHardwareBuffer_unlock(buffer, nullptr /* fence */);
                       ^
/opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/android/hardware_buffer.h:479:5: note: 'AHardwareBuffer_unlock' has been explicitly marked unavailable here
int AHardwareBuffer_unlock(AHardwareBuffer* _Nonnull buffer, int32_t* _Nullable fence)
```
