Redex: Error writing mapping file: No such file or directory

Created on 25 Oct 2016  Â·  28Comments  Â·  Source: facebook/redex

Hi there,

I used the tool according to the guide, everything went fine with the installing process. but when I use redex command to compress the apk, I encountered this error: " Error writing mapping file: No such file or directory."
here are my system info and error screenshot.

macosinfo

error2

Can anybody help?

Thanks a lot!

Most helpful comment

{
    "redex": {
        "passes": [
            "ReBindRefsPass",
            "BridgePass",
            "SynthPass",
            "FinalInlinePass",
            "DelSuperPass",
            "SingleImplPass",
            "SimpleInlinePass",
            "StaticReloPass",
            "RemoveEmptyClassesPass",
            "ShortenSrcStringsPass"
        ]
    },
    "ShortenSrcStringsPass": {
        "filename_mappings": "filename_mappings.txt"
    }
}

write redex.conf file.

and

redex ~~ -c redex.conf

filename_mappings default value : /tmp/filename_mappings.txt

/tmp/filename_mappings.txt permission denied

All 28 comments

following. Getting same error

@222xiaohuan did you find any solution to this?

@samyakjain No, I tried to google the error, but didn't find any clue. :(

the same with me.

+1 :(

Can anybody help? any progress @samyakjain @eagertofly @Szmiglo ?

I guess this is jus one warning and you can still gent the output apk file. @222xiaohuan

The same with me, but I can still get a new apk file.
but I fails to install with Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES], look it at readme.md
@eagertofly @222xiaohuan

you need to sign the apk with your keystore @xoder-me

@eagertofly yes, i have readed the offical document... i just try it. but thx!

Yes. It is still generating output file so just ignoring this as a warning
and going ahead.

On Thu, Oct 27, 2016 at 7:34 AM, Jason Wang [email protected]
wrote:

I guess this is jus one warning and you can still gent the output apk
file. @222xiaohuan https://github.com/222xiaohuan

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/facebook/redex/issues/185#issuecomment-256527309, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AB3ZIW5SuAErJjhU-ufHEvKu_F6wrxp7ks5q4AbIgaJpZM4KfgQ3
.

Yes, I can get the package, but before doing the compress, the package size is 18.6M, after doing that, the size is 18.3, so I am not sure if the compress really works. and by the way how the package size changed of yours? @eagertofly @samyakjain @xoder-me

Not much of significant change in package size. That's why i am also in
doubt if redex is properly working or not. Difference of only .1 Mb (from
9.7 to 9.6)

On Fri, Oct 28, 2016 at 1:29 PM, Emily [email protected] wrote:

Yes, I can get the package, but before doing the compress, the package
size is 18.6M, after doing that, the size is 18.3, so I am not sure if the
compress really works. and by the way how the package size changed of
yours? @eagertofly https://github.com/eagertofly @samyakjain
https://github.com/samyakjain @xoder-me https://github.com/xoder-me

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/facebook/redex/issues/185#issuecomment-256859968, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AB3ZIdJ7fTbpDiM07aBbPi016vM6Rxulks5q4atkgaJpZM4KfgQ3
.

Redex usually doesn't decrease the APK size much; it'll usually make the dexes (bytecode) noticeably smaller, but that compresses well anyways so it doesn't make a big difference in APK size. You can check the dex size using aapt.

On Oct 28, 2016, at 2:42 AM, Samyak <[email protected]notifications@github.com> wrote:

Not much of significant change in package size. That's why i am also in
doubt if redex is properly working or not. Difference of only .1 Mb (from
9.7 to 9.6)

On Fri, Oct 28, 2016 at 1:29 PM, Emily <[email protected]notifications@github.com> wrote:

Yes, I can get the package, but before doing the compress, the package
size is 18.6M, after doing that, the size is 18.3, so I am not sure if the
compress really works. and by the way how the package size changed of
yours? @eagertofly https://github.com/eagertofly @samyakjain
https://github.com/samyakjain @xoder-me https://github.com/xoder-me

You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/facebook/redex/issues/185#issuecomment-256859968, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AB3ZIdJ7fTbpDiM07aBbPi016vM6Rxulks5q4atkgaJpZM4KfgQ3
.

You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHubhttps://github.com/facebook/redex/issues/185#issuecomment-256879405, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AEPG3F3j-DOY7V7sAvnbJhtRHGrbCZX-ks5q4cNZgaJpZM4KfgQ3.

{
    "redex": {
        "passes": [
            "ReBindRefsPass",
            "BridgePass",
            "SynthPass",
            "FinalInlinePass",
            "DelSuperPass",
            "SingleImplPass",
            "SimpleInlinePass",
            "StaticReloPass",
            "RemoveEmptyClassesPass",
            "ShortenSrcStringsPass"
        ]
    },
    "ShortenSrcStringsPass": {
        "filename_mappings": "filename_mappings.txt"
    }
}

write redex.conf file.

and

redex ~~ -c redex.conf

filename_mappings default value : /tmp/filename_mappings.txt

/tmp/filename_mappings.txt permission denied

I have the same problem.:(

I have the same problem.:(

And the command line not working:
ANDROID_SDK=/Users/yiwowang/Library/Android/sdk redex app-debug.apk -o output12345.apk -c config/default.config

@yiwowang
Did you create a "config / default.config" file?

I have appended the code
"
"ShortenSrcStringsPass": {
"filename_mappings": "filename_mappings.txt"
}
"
in the 'default.config' file, then tried again with a signed apk, the output apk is generated successfully with the same error message on the terminal "Error writing mapping file: No such file or directory ", but I can't install the apk file.Only change in the apk size is .1 Mb

I write redex.conf.

{
    "redex": {
        "passes": [
            "ReBindRefsPass",
            "BridgePass",
            "SynthPass",
            "FinalInlinePass",
            "DelSuperPass",
            "SingleImplPass",
            "SimpleInlinePass",
            "StaticReloPass",
            "RemoveEmptyClassesPass",
            "ShortenSrcStringsPass"
        ]
    },
    "ShortenSrcStringsPass": {
        "filename_mappings": "filename_mappings.txt"
    }
}

and run redex

$ redex ~~~ -c redex.conf

In 'redex ~ -c redex.conf' ' ~' means path of the config file ?

no. ~~~ is other arguments.

example

$ redex xx.apk -o r.apk -sign --keystore ~~ --proguard-map ~~ --proguard-config ~~  -c /path/redex.conf

ok, thanks
I tried it(without proguard) but the same result again, I have attached a screenshot of the terminal.

untitled

Did you put the following in default.config?

{
    "redex": {
        "passes": [
            "ReBindRefsPass",
            "BridgePass",
            "SynthPass",
            "FinalInlinePass",
            "DelSuperPass",
            "SingleImplPass",
            "SimpleInlinePass",
            "StaticReloPass",
            "RemoveEmptyClassesPass",
            "ShortenSrcStringsPass"
        ]
    },
    "ShortenSrcStringsPass": {
        "filename_mappings": "filename_mappings.txt"
    }
}

And did you reinstall redex to the latest version?

opt/shorten-srcstrings/Shorten.cpp

...
  // generate mapping
  FILE* fd = fopen(map_path, "w");
  if (fd == nullptr) {
    perror("Error writing mapping file");
    return;
  }
...

If the error persists Try removing ShortenSrcStringsPass as it seems to be related to "Shorten".

{
    "redex": {
        "passes": [
            "ReBindRefsPass",
            "BridgePass",
            "SynthPass",
            "FinalInlinePass",
            "DelSuperPass",
            "SingleImplPass",
            "SimpleInlinePass",
            "StaticReloPass",
            "RemoveEmptyClassesPass"
        ]
    }
}

If not, I do not know. sorry.

Great, *Thanks @asamaru7 for the solution, The third method is work for me, Now there is no error related to the mapping file.Apk is generated without any error message, but *unable to install the apk file .

Updated to latest, still getting the same warning. But I have also noticed that my after redux my apk's download size reduced by .9mb . So i am assuming redux is working fine.

This warning should be gone in master. The next release version will fix it for good

On Jan 28, 2017, at 9:50 AM, Samyak <[email protected]notifications@github.com> wrote:

Updated to latest, still getting the same warning. But I have also noticed that my after redux my apk's download size reduced by .9mb . So i am assuming redux is working fine.

-
You are receiving this because you commented.
Reply to this email directly, view it on GitHubhttps://github.com/facebook/redex/issues/185#issuecomment-275862906, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AEPG3EiFpwMkY4nBaWErhkUbRZk3AwTOks5rW3_KgaJpZM4KfgQ3.

It sounds like this was fixed back in January. Closing. Please re-open or create a new issue if you see this error again.

Was this page helpful?
0 / 5 - 0 ratings