title: How to enable stripping for cmake on Android
body: <p>We're developing an Android library with native part. We're mostly Java developers, not C++. Our tiny C++ experience was enough to write the native code we need but we've encountered unexpected troubles with stripping (which doesn't related to programming directly). Due to some reasons we do need the output native library (<em>xxx.so</em> file) stripped. The problem is it's hard to find info how to do this in our particular case. There are a lot of results in Google but we don't' understand how to apply them. The most popular answer is "just check the related checkbox in your IDE". Hmm, what checkbox? We tried to set <code>Jni Debuggable</code> checkbox to true in config (it looks relevant) - no effect. We added -s flag (as suggested in many answers) as follows:</p>
  
  <pre><code>defaultConfig {
      ..
      externalNativeBuild {
          cmake {
              cppFlags "-fexceptions -s"
              abiFilters 'armeabi', 'x86'
          }
      }
  }
  </code></pre>
  
  <p>No effect. We added the same flag according to <a href="https://stackoverflow.com/questions/38675403/how-to-config-cmake-for-strip-file">this</a> answer like the following:</p>
  
  <pre><code>set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -s")
  set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -s")
  set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -s")
  set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -s")
  </code></pre>
  
  <p>No effect again! Finally we tried the straightforward variant to apply strip utility to our output library manually (as many guys suggested). The problem is the utility says <em>Unable to recognize the format of the input file 'xxx.so'</em>. Weird... Our C++ developers (not for Android) couldn't help us, they "just check the related checkbox in IDE". We're absolutely sure it shouldn't be difficult but spent a lot of time for this task and read tons of pages without result.</p>
  
  <p>@anton-malyshev is right! I used <em>elfedit</em> and <em>objdump</em> from the same package before and they worked well with the same file that confused me. I applied appropriate strip from NDK, now it works without errors but do nothing though. I used</p>
  
  <pre><code>strip -s -v xxx.so
  </code></pre>
  
  <p>syntax, this shows message <em>copy from 'xxx.so' [elf32-littlearm] to 'sta10988' [elf32-littlearm]</em>, but xxx.so file stays unchanged. What is sta10988? A temp file? If my understanding is correct then the utility should reduce library size since it contains many symbols (according to elfedit and objdump). I tried to apply other options for strip (like -I -O) but didn't manage to get any working combination. Sorry, I'm not a fan of console apps. How to use this utility correctly?</p>