The output of intel XDK (.apk) is too large ! (android)

别等时光非礼了梦想. 提交于 2020-01-23 07:15:14

问题


i wanna build a web base android application with intel XDK! i tried but the output apk file is too large, My files are totaly 2.4MB but the output is 15.6Mb ! What should I do ?


回答1:


As @HoseinBL indicates, 15.6MB is not that large for a typical APK.

Which Android build are you using? There are actually three available in the current XDK build system. If you're using the one labeled just "Android" the comments above from @Brad Hill and @Tangocoder apply. If you need to use the Canvas API (aka AGI) or the Cordova API you need to build using the "Gold" option. If you only use the Intel XDK API (intel.xdk and appmobi namespaces) you can use the "Lean" option for a slightly smaller APK.

The Crosswalk for Android build will create at minimum a 15MB package, since this option includes a replacement webview that requires a lot of space.

We are in the process of finalizing a 100% Cordova-compatible build (current called "Cordova for Android") that will generate smaller APKs, but it isn't quite ready for prime-time (thus the reason for the "Beta" tag).




回答2:


For now, Crosswalk build is best solution for android app from Intel XDK, however file is very big. I have game all assets and code ~4 mb, where compiled apk with Crosswalk is 22mb, and installed on device is 50mb! This is too large, but with Crosswalk everything works. Sound, events, fullscreen, orientation and other functions.

If you need file smaller, use Cordoba build. With same game files my apk is ~4.7mb only, that's difference. Bad news, Cordoba build is beta and rather alpha. With this build can be problem with sound on older android versions and some devices. For example, on my device with android 4.0.4 I have no sound where on newest versions sound mostly working.




回答3:


When building the application, which code base are you using? The "gold" is the most robust, but that also means it's the largest (with more inclusions). Would your application still work with the lighter "lean" code base?




回答4:


That's the Intel XDK container packaged with your app, and if you want to use DirectCanvas (developing games for example) you're obligated to use the "gold" code base, which is include all their APIs even if you're not using them. That's sad, yah!

Moreover, with all these APIs built with your app, the app will require a lot of permissions on device when installed, and there's nothing to do about it (not that I know of).




回答5:


Usually image is biggest content in a app and you can compress it with gulp task runner with gulp min

https://github.com/sindresorhus/gulp-imagemin

sample:

const gulp = require('gulp');
const imagemin = require('gulp-imagemin');

gulp.task('default', () =>
    gulp.src('src/images/*')
        .pipe(imagemin())
        .pipe(gulp.dest('dist/images'))
);


来源:https://stackoverflow.com/questions/22246214/the-output-of-intel-xdk-apk-is-too-large-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!