What does exporting an Android application do, exactly?

The instructions at http://developer.android.com/tools/publishing/preparing.html indicate that I must export the Android application before releasing it to the public. What steps are taken during export?

Here is what I know about:

  • android: debuggable in <Application> for AndroidManifest.xml set to false.
  • The APK is signed by the developer key (my), not by the built-in debug key
  • zipalign runs on a signed APK

    I set android: debuggable to false manually in my AndroidManifest.xml and compared the debug and export apk. These are the only files that were different:

    Binary files ../../release/x//classes.dex and x/classes.dex differ
    Binary files ../../release/x//META-INF/CERT.RSA and x/META-INF/CERT.RSA differ
    diff -r ../../release/x//META-INF/CERT.SF x/META-INF/CERT.SF
    diff -r ../../release/x//META-INF/MANIFEST.MF x/META-INF/MANIFEST.MF

    So does my list above include everything? Or do the various .dex classes indicate that there is some other difference between the debug and export apk?

    Thanks to error 454 below, I ran baksmali in the classes.dex file in each apk, and I found one difference:

    diff -r out/xx/xx/xx/BuildConfig.smali ../../../release/x/out//xx/xx/xx/BuildConfig.smali
    7c7
    < .field public static final DEBUG:Z = true
    ---
    > .field public static final DEBUG:Z

    So, I can add the fourth element to this list:

  • In the BuildConfig class (gen /.../ BuildConfig.java), DEBUG is set to false.

+5
source share
3 answers

In addition to what you specified, proguard also starts during export.

If you are incredibly interested in learning about the difference in classes.dex, you can grab baksmali , unzip your apk and decompile the classes.dex file:

java -jar baksmali-1.3.3.jar classes.dex

This will create an out / folder with content that you can share between old / new.

, BuildConfig.DEBUG , , Release Debug, SDK 17:

​​, . Builds BuildConfig, DEBUG , . (BuildConfig.DEBUG) .

+5

, , debug release. , android-sdk/tools/ant/build.xml

target name="release". depends, , . a release debug. , (, android-sdk/platform-tools), , , - .

, , , , .

, , eclipse, ant build.xml , .

, , -set-release-mode, , , release, .

+1

Or do different .dex classes indicate that there are other differences between debug and export apk?

Even with identical code, the resulting .dex classes do not have to be binary, identical to previously compiled versions. This is because of different ways the compiler optimizes AFAIK code.

0
source

All Articles