Update to Android studio 3.0 the Apk size increases - apk

in the android studio 2.3.3 the apk size 8.9M,but in the android studio 3.0 the apk size is 10.1M.Why this is?

It depends upon the language you used.
Base on this article Comparing APK sizes:
An app that is created in Java which is for example 539 KB will be 550 KB in Kotlin. Programming it using React Native will drastically increase the app size to 7 MB. With Flutter.io it will be 7.5 MB.
Also consider the library that you included, that is also one factor that increase the size.

Related

NativeScript Angular Basic app size on Android is > 160 MB

Basic HelloWorld Nativescript-Angular app size > 160 MB when it is pushed to a android phone.
Basic HelloWorld Native-Android app size is < 4 MB when it is pushed to a android phone.
Why is Nativescript-Angular app is so big and what can be done to reduce its size..?
Steps to reproduce:
tns create HelloWorld --ng
Connect Phone
tns run android
Settings -> Search for "Application manager" -> Tap "Application Manager"
Tap HelloWorld application.
Tap storage to see the size of the app.
This is very much normal here as Native-script works with node_modules and while building app, it's dependency are added in build.
The NativeScript Android Runtime consists of several major parts that provide the core functionality. These include:
Аn embedded version of Google’s JavaScript virtual machine - V8 - to run JavaScript.
A C++ layer that tells V8 what to do with all the Android APIs.
A Java layer that performs the glue behind the native C++/JavaScript to Android APIs (and vice-versa).
The first two layers are native libraries (compiled to machine code) and they are CPU architecture dependent, a.k.a ABI (Application Binary Interface), unlike Java and JavaScript which are dynamically (JIT) compiled
To Optimize the perfomance and bundle size you can use the snapshot plugin. That is only for release buils.You need to provide the --env.snapshot flag along with the other release arguments:
tns build android --bundle --env.snapshot --release

Android studio takes too much memory

I had installed Android Studio 1.0 RC 2. I have 4GB of RAM installed, but after starting Android Studio and launching Android Emulator, more than 90% of physical memory has been used by only these two. Is there is any way to reduce this memory use? Due to this memory issue, I can't open other applications at the same time.
I'm currently running Android Studio on Windows 8.1 machine with 6 gigs of RAM.
I found that disabling VCS in android studio and using an external program to handle VCS helped a lot. You can disable VCS by going to File->Settings->Plugins and disable the following:
CVS Integration
Git Integration
GitHub
Google Cloud Testing
Google Cloud Tools Core
Google Cloud Tools for Android Studio
hg4idea
Subversion Integration
Mercurial Integration
TestNG-J
In my case, there were two main sources of memory hogging: the IDE and Gradle:
Android Studio (up to 1.5GB)
The IDE's JVM is configured to have a max heap size. You can see this in the lower-right corner of the main interface:
You can reduce this by editing the memory-related settings in the .vmoptions file. For example, I changed my max heap size to 512MB:
-Xmx512m
Unfortunately, I found that lowering this value increases the frequency of Android Studio temporarily freezing, perhaps to do its garbage collection.
Gradle (up to 1.5GB)
Gradle can also use a lot of RAM after developing for a while. Windows just shows it as Java(TM) Platform SE Binary:
You can fix this by changing the Gradle JVM options. You can do this on a per-user basis by editing gradle.properties:
Open the gradle.properties file, creating it if it doesn't exist:
Windows: %USERPROFILE%\.gradle\gradle.properties
Linux/Mac: ~/.gradle/gradle.properties
Update the org.gradle.jvmargs property, creating it if necessary. I set mine to this:
org.gradle.jvmargs=-Xmx256m -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
I haven't noticed any difference in build performance for my small project with the max heap size set to 256MB (-Xmx256m).
Note that you might need to restart Android Studio so the old Gradle process is killed; otherwise you might end up with both running at the same time.
Emulator
Regarding the emulator taking up a lot of your RAM, your screenshot shows it taking about 800MB. You can choose how much RAM to allocate to the emulator:
Edit the AVD
Press Show Advanced Settings
Reduce the value of RAM
You can speed up your Eclipse or Android Studio work, you just follow these:
Use/open single project at a time
clean your project after running your app in emulator every time
use mobile/external device instead of emulator
don't close emulator after using once, use same emulator for running app each time
Disable VCS by using File->Settings->Plugins and disable the following things :
1.CVS Integration
2.Git Integration
3.GitHub
4.Google Cloud Tools for Android Studio
5.Subversion Integration
I am also using Android Studio with 4-GB installed main memory but following these statements really boost my Android Studio performance.
Android Studio has recently published an official guide for low-memory machines: Guide
If you are running Android Studio on a machine with less than the recommended specifications (see System Requirements), you can customize the IDE to improve performance on your machine, as follows:
Reduce the maximum heap size available to Android Studio: Reduce the maximum heap size for Android Studio to 512Mb.
Update Gradle and the Android plugin for Gradle: Update to the latest versions of Gradle and the Android plugin for Gradle to ensure you are taking advantage of the latest improvements for performance.
Enable Power Save Mode: Enabling Power Save Mode turns off a number of memory- and battery-intensive background operations, including error highlighting and on-the-fly inspections, autopopup code completion, and automatic incremental background compilation. To turn on Power Save Mode, click File > Power Save Mode.
Disable unnecessary lint checks: To change which lint checks Android Studio runs on your code, proceed as follows:
Click File > Settings (on a Mac, Android Studio > Preferences) to open the Settings dialog.In the left pane, expand the Editor section and click Inspections. Click the checkboxes to select or deselect lint checks as appropriate for your project. Click Apply or OK to save your changes.
Debug on a physical device: Debugging on an emulator uses more memory than debugging on a physical device, so you can improve overall performance for Android Studio by debugging on a physical device.
Include only necessary Google Play Services as dependencies: Including Google Play Services as dependencies in your project increases the amount of memory necessary. Only include necessary dependencies to improve memory usage and performance. For more information, see Add Google Play Services to Your Project.
Reduce the maximum heap size available for DEX file compilation: Set the javaMaxHeapSize for DEX file compilation to 200m. For more information, see Improve build times by configuring DEX resources.
Do not enable parallel compilation: Android Studio can compile independent modules in parallel, but if you have a low-memory system you should not turn on this feature. To check this setting, proceed as follows:
Click File > Settings (on a Mac, Android Studio > Preferences) to open the Settings dialog. In the left pane, expand Build, Execution, Deployment and then click Compiler. Ensure that the Compile independent modules in parallel option is unchecked.If you have made a change, click Apply or OK for your change to take effect.
Turn on Offline Mode for Gradle: If you have limited bandwitch, turn on Offline Mode to prevent Gradle from attempting to download missing dependencies during your build. When Offline Mode is on, Gradle will issue a build failure if you are missing any dependencies, instead of attempting to download them. To turn on Offline Mode, proceed as follows:
Click File > Settings (on a Mac, Android Studio > Preferences) to
open the Settings dialog.
In the left pane, expand Build, Execution, Deployment and then click Gradle.
Under Global Gradle settings, check the Offline work checkbox.
Click Apply or OK for your changes to take effect.
I have used all of Sam's recommendations above, but I found that the VM command line options are no longer supported as described. (I received an error when used)
As an alternative, I was able to reduce gradle dramatically by adding the following line to the "gradle.properties" file
org.gradle.jvmargs=-Xms512m -Xmx1024m
As of A.S. ver 1.3, the file is located in the same folder level as "gradle.build".
The above configuration is a "memory stack" of 512 meg, and "memory heap" of 1024 meg.
I tested this on a small project, using settings where both memory sizes were set to 256 meg. It limited the JVM sizes as expected. In all my tests, I restarted A.S. to force the JVM to restart.
Hopefully, this will save others dealing with this issue from getting those "Get yourself a better computer" responses. :-)
To run Android envirorment on low configuration machine.
Close the uncessesory web tabs in browser
For Antivirus users, exclude the build folder which is auto generated
Android studio have 1.2 Gb default heap can decrease to 512 MB
Help > Edit custom VM options
studio.vmoptions
-Xmx512m
Layouts performace will be speed up
For Gradle one of the core component in Android studio Mkae sure
like right now 3.0beta is latest one
Below tips can affect the code quality so please use with cautions:
Studio contain Power safe Mode when turned on it will close background operations that lint , code complelitions and so on.
You can run manually lint check when needed ./gradlew lint
Most of are using Android emulators on average it consume 2 GB RAM so if possible use actual Android device these will reduce your resource load on your computer. Alternatively you can reduce the RAM of the emulator and it will automatically reduce the virtual memory consumption on your computer. you can find this in virtual device configuration and advance setting.
Gradle offline mode is a feature for bandwidth limited users to disable the downloading of build dependencies. It will reduce the background operation that will help to increase the performance of Android studio.
Android studio offers an optimization to compile multiple modules in parallel. On low RAM machines this feature will likely have a negative impact on the performance. You can disable it in the compiler settings dialog.
You can adjust the heap size of the IDE and Gradle daemons from inside the Android Studio.
Read and follow the instructions in the settings screen:
Also, see this page on Android Developers site
I have Android Studio 2.1.1 Bro use genymotion emulator It Faster If Use Android Marshmallow. And My Ram Is 4gb.And Install Plugin for genymotion in Android Studio.You Will see good result in instead of wasting time start android emualtor it will take 5 min.genymotion 10 to 20 second speed and faster so I recommended to you use genymotion.
To reduce the lag i would recommend the follwing steps
my pc specs : 2 gb ram, processor: intel core2 duo
first kill all background process, if you have server or database running you could stop them first with following commands
sudo service apache2 stop
sudo service mysql stop
Then enable power saving mode in android studio by file>powersaving mode
It could disable background process, and then studio appears to go well
Try switching your JVM to eclipse openj9. Its gonna use way less memory. I swapped it and its using 600Mb constantly.
I don't know if it is a solution but Invalidate Cache and Restart solved this problem in my case. I am currently using Android Studio 3.6
I fond this YouTube video from Google where are some tips and tricks for it. The video also includes advantages and disadvantages of suggested changes.
Improving Android Studio Performance on Memory-Constrained Machines
Open below mention path on your system and delete all your avd's (Virtual devices: Emulator)
C:\Users{Username}.android\avd
Note: - Deleting Emulator only from android studio will not delete all the spaces grab by their avd's. So delete all avd's from above given path and then create new emulator, if you needed.

how can I decrease the size of the final package of the Oracle MAF applications?

i'm developing oracle MAF Applications for mobile devices. the initial size of the packages r about 20 MB..
the MAF architecture has a built-in lightweight JVM (ORACLE MOBILE APPLICATION FRAMEWORK DATA SHEET) for business logic...
can I choose which libraries should b exported in final package to decrease the size?
You should deploy in Release mode - for Android the instructions are here.
Speed up ADF Mobile Deployment to Android with Keystore and "Release" Packaging.
It's not possible to choose which libs should be exported.
The only thing you can do is deploy to production instead of debug (initial size is minimum 15mb).

iOS 7 memory issues

I was recently trying to make my iOS 6 compatible app work with iOS 7 (noted still in beta). So i had my boss install iOS 7 on his iPhone 4S. We noticed that camera picker was slow and not responsive, and when we take a picture everything freezes. When i run the profile with memory allocations i notice that we have a really high memory usage : 160 MB. and btw we received a loot of memory warnings. So i tried running on the iPhone that still has ios6 and the maximum memory spike was 16 MB. Has anyone encountered this problem? Thank you
I do observe different Memory numbers on iOS 6 & iOS 7.
I have an app that makes use of openGL (a 3D viewer), and of AVFoundation (my own camera implementation, with AVCaptureDevice...)
I ran the app on iPhone 4S with iOS 6, and on iPhone 4 with iOS 7, my observations so far :
Allocations, Dirty & resident VM sizes reported by Instruments seem higher on iOS 7 than iOS 6 (50% to 100% higher)
BUT
I get much less Memory warning with iOS 7 (although I probably would have to repeat these tests to get more reliable results)
In iOS 7, apple introduce more restriction on memory allocation for single instance. If the single thread uses more memory it should crash.
This is not only related to native application but also related to hybrid app.
Ex: Google Maps getting crashed only in iOS 7, if it uses more memory. You can able to get more information in the below link.
Crashes in iOS7

Flash Builder iPhone app size

I have a mobile Flex project which I am deploying to iPhone/iPod and Android. I'm having an issue getting my app under the 20 MB 3g size limit. I am including some images and a video which amount to 1.5 MB. The swf for the build is 2.8 MB and the resulting ipa is 9.7 MB with the app file being 22.4MB. The app store shows the final size as 21.1 MB, though I understand Apple needs to add additional things to the package is it really supposed to grow that significantly? What started as 3.3 MB has now grown to over 20 MB.
I've seen people say that all that matters is the ipa size, which is obviously not what is happening here. Any thoughts?
ipa is a compressed format and the download size is uncompressed. In other words, users don't download the ipa file in it's compressed state to their iPhone/iPod/iPad. If you rename ipa to zip and unzip it this is what you want to try and get below 20 mb. I'm having the exact same problem as you since the AIR overhead eats up a significant part of that 20 mb. Hope this explanation helps - good luck!
-Tom

Resources