最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

android - Separate build for each architecture but the resulting APK files are identical? - Stack Overflow

programmeradmin1浏览0评论

I want individual builds for each architecture, to distribute them separately. So I did some research and for example had a look at Android - build separate APKs for different processor architectures and linked article / and I seem to follow those steps, as far as I can tell. Following these resources, I added the following to my build.gradle:

...
android {
    ...
    splits {
        abi {
            enable true
            reset()
            include "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
            universalApk false
        }
    }
}
...

With those changes, I'm indeed getting individual APKs for each architecture. However, the resulting files are identical:

$ md5sum *
9673c9c50c3d2d8dbe02b073676b90d4  app-arm64-v8a-release-unsigned.apk
9673c9c50c3d2d8dbe02b073676b90d4  app-armeabi-v7a-release-unsigned.apk
9673c9c50c3d2d8dbe02b073676b90d4  app-x86_64-release-unsigned.apk
9673c9c50c3d2d8dbe02b073676b90d4  app-x86-release-unsigned.apk

How is this possible? What am I doing wrong? Unfortunately, I don't have devices for each architecture, to test. But it seems wrong to me that the build should yield the same checksum for each architecture.

In case it's relevant, here is my full build.gradle:

I want individual builds for each architecture, to distribute them separately. So I did some research and for example had a look at Android - build separate APKs for different processor architectures and linked article https://androidbycode.wordpress.com/2015/06/30/android-ndk-version-code-scheme-for-publishing-apks-per-architecture/ and I seem to follow those steps, as far as I can tell. Following these resources, I added the following to my build.gradle:

...
android {
    ...
    splits {
        abi {
            enable true
            reset()
            include "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
            universalApk false
        }
    }
}
...

With those changes, I'm indeed getting individual APKs for each architecture. However, the resulting files are identical:

$ md5sum *
9673c9c50c3d2d8dbe02b073676b90d4  app-arm64-v8a-release-unsigned.apk
9673c9c50c3d2d8dbe02b073676b90d4  app-armeabi-v7a-release-unsigned.apk
9673c9c50c3d2d8dbe02b073676b90d4  app-x86_64-release-unsigned.apk
9673c9c50c3d2d8dbe02b073676b90d4  app-x86-release-unsigned.apk

How is this possible? What am I doing wrong? Unfortunately, I don't have devices for each architecture, to test. But it seems wrong to me that the build should yield the same checksum for each architecture.

In case it's relevant, here is my full build.gradle: https://pastebin.com/v6Ya3Kan

Share Improve this question asked Jan 19 at 1:52 Ruben P. GradyRuben P. Grady 151 silver badge6 bronze badges 0
Add a comment  | 

1 Answer 1

Reset to default 2

APK files are just zip files. You can unzip them to inspect. You can also use the APK Analyzer to see what they contain.

If your Android project only includes Java/Kotlin code, that code will be compiled into dex files which doesn't depend on the CPU architecture of the device.

If you have C/C++ code (for games, performance computation, cross platform libraries) that will be processed via the Android Native Development Kit (NDK) into CPU architecture libraries which will need to included in the appropriate APK files.

发布评论

评论列表(0)

  1. 暂无评论