0

I have been using android studio 2.2.3 I have got problem when checking the google play service apk is enabled on my physical device and i have got this exception i have also include multiDexEnabled true this in gradle(app) but still i can't get a toast message which i have include in java code to check whether i have successfully enabled google play service or not. Please help.

Here is my exception.

Error:Execution failed for task ':app:transformClassesWithDexForDebug'.

com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException:

java.util.concurrent.ExecutionException:

com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536

Manifest.xml

package="com.mapgoogle.googlemap">

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>

<application
    android:allowBackup="true"

    android:icon="@mipmap/ic_launcher"

    android:label="@string/app_name"

    android:supportsRtl="true"

    android:theme="@style/AppTheme">

    <activity android:name=".MainActivity">

        <intent-filter>

            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />

        </intent-filter>
    </activity>

android:value="api_key"/>

    <meta-data android:name="com.google.android.gms.version"

        android:value="@integer/google_play_services_version"/>

</application>

gradle(app)

apply plugin: 'com.android.application'

android {

compileSdkVersion 25

buildToolsVersion "24.0.3"

defaultConfig {

    applicationId "com.mapgoogle.googlemap"

    minSdkVersion 14

    targetSdkVersion 25

    versionCode 1

    versionName "1.0"

    testInstrumentationRunner 

"android.support.test.runner.AndroidJUnitRunner"

    multiDexEnabled true

}

buildTypes {

    release {

        minifyEnabled false

        proguardFiles getDefaultProguardFile('proguard-android.txt'), 

'proguard-rules.pro'

    }
}

}

dependencies {

compile fileTree(include: ['*.jar'], dir: 'libs')


androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', 

{

    exclude group: 'com.android.support', module: 'support-annotations'

})

compile 'com.android.support:appcompat-v7:25.1.1'

testCompile 'junit:junit:4.12'

compile 'com.google.android.gms:play-services:10.0.1'

}

MainActivity.java

package com.mapgoogle.googlemap;

import android.app.Dialog;

import android.support.v7.app.AppCompatActivity;

import android.os.Bundle;

import android.telecom.Connection;

import android.widget.Toast;

import com.google.android.gms.common.ConnectionResult;

import com.google.android.gms.common.GooglePlayServicesUtil;

import com.google.android.gms.maps.GoogleMap;

public class MainActivity extends AppCompatActivity {

GoogleMap mMap;

private static final int Dialog_erroe=9001;

@Override

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
   // setContentView(R.layout.activity_main);

    if(serviceok()){
        setContentView(R.layout.activity_map);

        Toast.makeText(this,"Ready to map",Toast.LENGTH_SHORT).show();

}else{
        setContentView(R.layout.activity_main);

    }

}

public boolean serviceok(){

    int isAvaiable= 

GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);

    if(isAvaiable== ConnectionResult.SUCCESS) {
    }

    else if(GooglePlayServicesUtil.isUserRecoverableError(isAvaiable)){
        Dialog 

dialog=GooglePlayServicesUtil.getErrorDialog(isAvaiable,this,Dialog_erroe);

        dialog.show();

    }else{

        Toast.makeText(this,"Can't connect to 

internet",Toast.LENGTH_SHORT).show();

    }

return false;

}

}

bilal mughal
  • 5
  • 2
  • 4

1 Answers1

0

This exception is not related with google play services.

You have to enable multidex to get over the 65k method limit.

Check THIS question for details

Community
  • 1
  • 1
Manza
  • 3,427
  • 4
  • 36
  • 57