Unable to generate libtensorflowlite_flex_jni.so
Hi @pkgoogle

Please look into the issue

Thank You Hi @prerna1124, can you ensure you are following all the directions on this page? https://www.tensorflow.org/lite/android/development, specifically please be sure you have these abiFilters: https://www.tensorflow.org/lite/android/development#lite_lib, if you can share your gradle file or if possible, your entire project we can also take a look. Thanks for your help. This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you. This issue was closed because it has been inactive for 7 days since being marked as stale. Please reopen if you'd like to work on this further. Are you satisfied with the resolution of your issue?
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=Yes&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/62763">Yes</a>
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=No&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/62763">No</a>

### Issue type

Bug

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

Yes

### Source

source

### TensorFlow version

2.10.0

### Custom code

Yes

### OS platform and distribution

_No response_

### Mobile device

_No response_

### Python version

_No response_

### Bazel version

_No response_

### GCC/compiler version

_No response_

### CUDA/cuDNN version

_No response_

### GPU model and memory

_No response_

### Current behavior?

I am working with soong build system. I have created a text based classification model and saved it as ".tflite" with select_tf_ops. Now, I am generating a ".apk" file using Android.bp only which is responsible for doing my classification task. I can push it on my target and it should classify. But I am getting below error.

--------- beginning of crash
10-23 11:33:25.970  4445  4445 E AndroidRuntime: FATAL EXCEPTION: main
10-23 11:33:25.970  4445  4445 E AndroidRuntime: Process: com.test.classifier, PID: 4445
10-23 11:33:25.970  4445  4445 E AndroidRuntime: java.lang.UnsatisfiedLinkError: dlopen failed: library "libtensorflowlite_flex_jni.so" not found
10-23 11:33:25.970  4445  4445 E AndroidRuntime: 	at java.lang.Runtime.loadLibrary0(Runtime.java:1077)
10-23 11:33:25.970  4445  4445 E AndroidRuntime: 	at java.lang.Runtime.loadLibrary0(Runtime.java:998)
10-23 11:33:25.970  4445  4445 E AndroidRuntime: 	at java.lang.System.loadLibrary(System.java:1661)
10-23 11:33:25.970  4445  4445 E AndroidRuntime: 	at org.tensorflow.lite.flex.FlexDelegate.<clinit>(FlexDelegate.java:61)
10-23 11:33:25.970  4445  4445 E AndroidRuntime: 	at java.lang.Class.classForName(Native Method)
10-23 11:33:25.970  4445  4445 E AndroidRuntime: 	at java.lang.Class.forName(Class.java:454)
10-23 11:33:25.970  4445  4445 E AndroidRuntime: 	at java.lang.Class.forName(Class.java:379)
10-23 11:33:25.970  4445  4445 E AndroidRuntime: 	at org.tensorflow.lite.NativeInterpreterWrapper.maybeCreateFlexDelegate(NativeInterpreterWrapper.java:548)
10-23 11:33:25.970  4445  4445 E AndroidRuntime: 	at org.tensorflow.lite.NativeInterpreterWrapper.applyDelegates(NativeInterpreterWrapper.java:510)
10-23 11:33:25.970  4445  4445 E AndroidRuntime: 	at org.tensorflow.lite.NativeInterpreterWrapper.init(NativeInterpreterWrapper.java:88)
10-23 11:33:25.970  4445  4445 E AndroidRuntime: 	at org.tensorflow.lite.NativeInterpreterWrapper.<init>(NativeInterpreterWrapper.java:66)
10-23 11:33:25.970  4445  4445 E AndroidRuntime: 	at org.tensorflow.lite.NativeInterpreterWrapperExperimental.<init>(NativeInterpreterWrapperExperimental.java:44)
10-23 11:33:25.970  4445  4445 E AndroidRuntime: 	at org.tensorflow.lite.Interpreter.<init>(Interpreter.java:228)
10-23 11:33:25.970  4445  4445 E AndroidRuntime: 	at org.tensorflow.lite.Interpreter.<init>(Interpreter.java:212)

### Standalone code to reproduce the issue

```shell
Added below code in /tensorflow/lite/java/Android.bp

 srcs: [
         ":tflite_flex_delegate_java",
         ":tflite_nnapi_delegate_java",
         "src/main/java/org/tensorflow/lite/annotations/*.java",
         "src/main/java/org/tensorflow/lite/*.java",
     ]

Used below code for saving the model:
converter = tf.lite.TFLiteConverter.from_keras_model(model)
converter.allow_custom_ops=True
converter.target_spec.supported_ops = [
  tf.lite.OpsSet.TFLITE_BUILTINS, # enable TensorFlow Lite ops.
  tf.lite.OpsSet.SELECT_TF_OPS # enable TensorFlow ops.
]
```


### Relevant log output

_No response_