I am working on a project which works fine in Android Studio but when using my wrapper in B4A, I keep getting the following error:
This seems to happen because certain files, depending on file extensions, are being compressed into the Asset-folder when generating the apk.
There are some workarounds as explained here such as inserting the files afterwards in the apk or by using the CacheDir but they are not any good solutions in my opinion, especially since there is a solution already available with Android Studio i.e. you tell AS to not compress files with a certain extension. This is done by inserting a snippet in the build.gradle similar to the one listed below:
Would this be possible with B4A, perhaps using a new attribute?
Or maybe it can already be done by using the #CustomBuildAction attribute. If yes, how would I do that?
Many thanks in advance.
This happens in these code snippets from my wrapper from two different methods:Caused by: java.io.FileNotFoundException: This file can not be opened as a file descriptor; it is probably compressed
B4X:
classifier.interpreter = new Interpreter(classifier.loadModelFile(assetManager, modelPath));
//and
AssetFileDescriptor fileDescriptor = assetManager.openFd(modelPath); //crashes here
This seems to happen because certain files, depending on file extensions, are being compressed into the Asset-folder when generating the apk.
There are some workarounds as explained here such as inserting the files afterwards in the apk or by using the CacheDir but they are not any good solutions in my opinion, especially since there is a solution already available with Android Studio i.e. you tell AS to not compress files with a certain extension. This is done by inserting a snippet in the build.gradle similar to the one listed below:
B4X:
aaptOptions {
noCompress "tflite"
noCompress "lite"
}
Would this be possible with B4A, perhaps using a new attribute?
Or maybe it can already be done by using the #CustomBuildAction attribute. If yes, how would I do that?
Many thanks in advance.