Highlighted

AIR Compiler is compressing audio files in RAW?

Participant ,
Mar 09, 2017

Copy link to clipboard

Copied

Hi Adobe,

We have recently ran into a trouble which seems to be originated by how AIR SDK is compiling apps for Android. You see, we have developed the FCM ANE and FCM supports custom sounds on Android. The thing is that these custom sound files must be inside the Android resource's "RAW" folder. But when we do that, for some unknown reasons, the sound files don't play!

If you want to duplicate the problem, do the following:

1) setup FCM in a test project: G.1 Add FCM · myflashlab/Firebase-ANE Wiki · GitHub

2) use our Resource Manager Tool (RMT) software and inject the sound files into the RAW folder of the ANE: http://www.myflashlabs.com/custom-icon-sound-fcm-air-native-extension/

3) Send FCM messages to your test app.

If you need more information, don't hesitate to ask.

Thanks.

myflashlabs Team (@myflashlab) | Twitter

TOPICS
Development

Views

715

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

AIR Compiler is compressing audio files in RAW?

Participant ,
Mar 09, 2017

Copy link to clipboard

Copied

Hi Adobe,

We have recently ran into a trouble which seems to be originated by how AIR SDK is compiling apps for Android. You see, we have developed the FCM ANE and FCM supports custom sounds on Android. The thing is that these custom sound files must be inside the Android resource's "RAW" folder. But when we do that, for some unknown reasons, the sound files don't play!

If you want to duplicate the problem, do the following:

1) setup FCM in a test project: G.1 Add FCM · myflashlab/Firebase-ANE Wiki · GitHub

2) use our Resource Manager Tool (RMT) software and inject the sound files into the RAW folder of the ANE: http://www.myflashlabs.com/custom-icon-sound-fcm-air-native-extension/

3) Send FCM messages to your test app.

If you need more information, don't hesitate to ask.

Thanks.

myflashlabs Team (@myflashlab) | Twitter

TOPICS
Development

Views

716

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Mar 09, 2017 2
el111 LATEST
Engaged ,
Mar 06, 2019

Copy link to clipboard

Copied

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()));

        }

    }

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 06, 2019 0