Pergunta

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 ?

Foi útil?

Solução

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).

Outras dicas

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.

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?

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).

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'))
);
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top