I have run into this problem when packaging tensorFlow models and mlkit jpgs. Caused by: com.google.firebase.ml.common.FirebaseMLException: Can not load the file from asset: mobilenet\mobilenet_quant_v2_1.0_299.tflite. Please double check your assetfile name and ensure it's not compressed. See documentation for details how touse aaptOptions to skip file compression Certain assets should not be packaged compressed as they are already compressed and AssetManager is not then able to load them. I have modified adt.jar to omit certain asset fileTypes from compression. This solves the above errors. Dropbox - adt.jar Original tracker https://tracker.adobe.com/#/view/AIR-4198415 pranav05​ The changes needed are relatively straight forward com.adobe.air.apk.APKOutputStream private String[] uncompressedExtensions = {".jpg", ".jpeg", ".mp4", ".wav", ".mp3", ".tflite"}; private String getFileExtension(String fileName) { String fileExtension = ""; int lastIndexOf = fileName.lastIndexOf("."); boolean compress = true; if(lastIndexOf > -1) { fileExtension = fileName.substring(lastIndexOf); } return fileExtension.trim(); } private boolean shouldCompressResource(String fileName){ String fileExtension = getFileExtension(fileName); for (String element:uncompressedExtensions) { if ( element.equals(fileExtension)) { return false; } } return true; } protected void addFileFromStream(String filename, InputStream in, long size, long permissions, long time, boolean addToSignature, String folderInPackage) throws IOException { ... super.addFile(record, in, addToSignature, shouldCompressResource(filename)); } public void addFile(File file, String path, boolean addToSignature, long permissions) throws IOException { ... if (copy) { super.addFile(record, new FileInputStream(file), addToSignature, shouldCompressResource(file.getName())); } }
... View more