Some Android Issues that happened frequently

This is an updated topic with some android issues that i faced during android applications development.

This app won’t run unless you update Google Play Services

Solutions:

  • use hardware device not emulator and this is the simplest way
  • or
  • Let Google play services from your emulator mobile > Settings > App > Google Play Service same version as the one in your gradle

Exception when downloading any content from emulator browser

Problem:

Whenever i click the browser icon in the android emulator; i get the error message ‘Unfortunately browser stopped working’.. I tried couple of AVDs; but with no chance.

Solution:

  • Edit the Android Virtual Device settings inside your AVD manager that you are using and try starting your emulator with the “Use Host GPU” option enabled, this will help to fix your error with the browser.
  • For downloading files with the browser make sure you also add enough size to your SD Card option.
  • After editing both settings, start Android and go to: Settings -> Apps -> Browser. (If needed force to stop the browser) then go to permission and enable storage permission to be enabled. This will fix your error with the browser when downloading files.

Android Studio Gradle Could not reserve enough space for object heap

Solution:

Try to put this in your Module build.gradle:

android {   
...
defaultConfig {
// step 1: Enabling multidex support.
multiDexEnabled true
}
    dexOptions {
// step 2
incremental true
javaMaxHeapSize "4g"
}
}

dependencies {
    ....
// step 3
compile 'com.android.support:multidex:1.0.0'
}

If you are running unit tests, you will want to include this in your Application class:

public class YouApplication extends Application {
    @Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}