E/EasyAR: invalid trackable 1: c4220114-e345-49c1-9494-8058ffd945a3

0 votes
asked Jan 30, 2023 by fbuckeri (130 points)
Hey guys, I apologize for my English...

I'm having trouble with "tracker.loadTarget".

When I add the images in the project's "ASSETS" folder, I get the expected result.

However, when I play these images in an API to be downloaded to the device in the "filesDir" folder, it returns the following error: invalid trackable 1: c4220114-e345-49c1-9494-8058ffd945a3

I'm using Kotlin with EasyAR version 4.5.0.9653.

Has anyone gone through this or can give me a directional?

1 Answer

0 votes
answered Jan 30, 2023 by kenn (18,750 points)
make sure the file path is correct and can be read
commented Jan 31, 2023 by fbuckeri (130 points)
I had thought about that too.

In fact, I still haven't convinced myself that this isn't the error, but I haven't been able to fix it.

Before running loadTarget, I check if the file exists.

var file = File(context.filesDir, "${tag.recognitionId}.png")
if(file.exists()) {
//I already changed the StorageType.Assets to [ APP, Absolute and Assets ]
   var storageType = StorageType.Assets
   loadFromImage(tracker, "${file.absolutePath}/${tag.recognitionId!!}.png", "${tag.recognitionId!!}", storageType)
}

And if so, I call loadFromImage.

When I open the file (image), I am able to save it to another location or view it. But in loadTarget it always returns this error, as the file does not exist. Or the walk is broken.

        val target = ImageTarget.createFromImageFile(path, storageType, name, UUID.randomUUID().toString(), "", 1.0f)

        if (target == null) {
            Log.e("HelloAR", "target create failed or key is not correct")
            return
        }
        tracker.loadTarget(target, scheduler!!) { target, status ->
            Log.i("LoadImagemTarget", String.format("load target (%b): %s (%d)", status, target.name(), target.runtimeID()))
        }
commented Feb 7, 2023 by kenn (18,750 points)

There should be other error logs from EasyAR with tag EasyAR. Try not ignore them. If you do not see other errors, then most likely the file is not readable by EasyAR using c++ std::ifstream if the file is not packaged into Assets.

Welcome to EasyAR SDK Q&A, where you can ask questions and receive answers from other members of the community.
...