App Crashes if run without an internet connection

Hello everyone,

I found that my app was crashing after ~10 seconds when I was not connected to the internet.
I successfully replicated the problem with the PoseEstimationApp example.

Tested with:

  • implementation “ai.fritz:core:6.0.0”
    implementation “ai.fritz:vision:6.0.0”
    implementation “ai.fritz:vision-pose-estimation-model-fast:3.0.0”
  • Android Device: Umidigi F1 running Android 9.0 (API 28)

This is what I have done:

  • Downloaded the last version from master (git revision number: c71e1806db1dc265b0f9b25d02cdf6375e1c1f9a)
  • Set my API Key in fritz.xml file
  • Replaced my applicationId in build.gradle
  • Replaced the model with Pose estimation fast
  • Run the application without internet connection on
  • After ~10 seconds (even without looking at a human) the app crashes

In console, this is what is showed:

D/FritzTFLiteInterpreter: Inference Time: 74
D/PostRequestTask: Api Request: https://api.fritz.ai/sdk/v1/model/track
I/eyou.sizeyoude: The ClassLoaderContext is a special shared library.
E/libc: Access denied finding property "persist.vendor.log.tel_dbg"
D/NetworkSecurityConfig: No Network Security Config specified, using platform default
I/eyou.sizeyoude: The ClassLoaderContext is a special shared library.
W/PostRequestTask: Api Request failed: Unable to resolve host "api.fritz.ai": No address associated with hostname
E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
    Process: it.sizeyou.sizeyoudev, PID: 19612
    java.lang.RuntimeException: An error occurred while executing doInBackground()
        at android.os.AsyncTask$3.done(AsyncTask.java:354)
        at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
        at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
        at java.util.concurrent.FutureTask.run(FutureTask.java:271)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:764)
     Caused by: kotlin.KotlinNullPointerException
        at ai.fritz.core.api.PostRequestTask.doInBackground(PostRequestTask.kt:44)
        at ai.fritz.core.api.PostRequestTask.doInBackground(PostRequestTask.kt:13)
        at android.os.AsyncTask$2.call(AsyncTask.java:333)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:764) 
W/System: A resource failed to call destroy. 
D/FritzVisionImage: Image Processing Time(ms): 57
W/System: A resource failed to call destroy. 
    A resource failed to call destroy. 
I/BufferQueueProducer: [SurfaceTexture-0-19612-0](this:0x78d9e84800,id:0,api:4,p:613,c:19612) queueBuffer: slot 0 is dropped, handle=0x78f041b9a0
D/FritzTFLiteInterpreter: Inference Time: 79
I/BufferQueueProducer: [SurfaceTexture-0-19612-0](this:0x78d9e84800,id:0,api:4,p:613,c:19612) queueBuffer: slot 1 is dropped, handle=0x78f041bc40
    [SurfaceTexture-0-19612-0](this:0x78d9e84800,id:0,api:4,p:613,c:19612) queueBuffer: fps=14.36 dur=1044.80 max=78.48 min=56.32
I/BufferQueueProducer: [ImageReader-1440x1080f23m2-19612-0](this:0x78f04eb000,id:1,api:4,p:613,c:19612) queueBuffer: fps=14.36 dur=1044.27 max=78.59 min=56.52
I/BufferQueueProducer: [SurfaceTexture-0-19612-0](this:0x78d9e84800,id:0,api:4,p:613,c:19612) queueBuffer: slot 2 is dropped, handle=0x78f041c960
I/BufferQueueProducer: [SurfaceTexture-0-19612-0](this:0x78d9e84800,id:0,api:4,p:613,c:19612) disconnect(P): api 4
D/BufferQueueConsumer: [SurfaceTexture-0-19612-0](this:0x78d9e84800,id:0,api:4,p:-1,c:19612) getReleasedBuffers: returning mask 0xffffffffffffffff
I/BufferQueueProducer: [ImageReader-1440x1080f23m2-19612-0](this:0x78f04eb000,id:1,api:4,p:613,c:19612) disconnect(P): api 4
D/BufferQueueConsumer: [ImageReader-1440x1080f23m2-19612-0](this:0x78f04eb000,id:1,api:4,p:-1,c:19612) getReleasedBuffers: returning mask 0xffffffffffffffff
I/BufferQueueConsumer: [ImageReader-1440x1080f23m2-19612-0](this:0x78f04eb000,id:1,api:4,p:-1,c:-1) disconnect(C)
D/BaseCameraActivity: onPause ai.fritz.camera.MainActivity@6919f97
D/FritzLifecycleCallbacks: Flushing events on app background
D/PostRequestTask: Api Request: https://api.fritz.ai/sdk/v1/model/track
W/PostRequestTask: Api Request failed: Unable to resolve host "api.fritz.ai": No address associated with hostname
I/Process: Sending signal. PID: 19612 SIG: 9

And this is the MainActivity.java onCreate:

    @Override
    public void onCreate(final Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Fritz.configure(this);
        // The code below loads a custom trained pose estimation model and creates a predictor that will be used to identify poses in live video.
        // Custom pose estimation models can be trained with the Fritz AI platform. To use a pre-trained pose estimation model,
        // see the FritzAIStudio demo in this repo.
        PoseOnDeviceModel poseEstimationOnDeviceModel = FritzVisionModels.getHumanPoseEstimationOnDeviceModel(ModelVariant.FAST);
        predictor = FritzVision.PoseEstimation.getPredictor(poseEstimationOnDeviceModel);
    }

Is this a bug or there is a configuration for disabling the call to “https://api.fritz.ai/sdk/v1/model/track” ?

1 Like

Hi,

I confirm that I, too, am having the same issue.

Any news on this topic?

Samuel