Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
427 views
in Technique[技术] by (71.8m points)

java - I get: Error:Execution failed for task ':app:transformClassesWithDexForDebug'. when making Google maps App

I followed the instructions in this link: https://developers.google.com/maps/documentation/android-api/start to make a simple android app with Google Maps API but I always get this error below when I run the app on my phone:

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

clean and see still error is there if yes,

1.go to your build.gradle file. add multiDexEnabled true

 defaultConfig {
    multiDexEnabled true
}

2.in your dependencies add compile 'com.android.support:multidex:1.0.1'

dependencies {
 compile 'com.android.support:multidex:1.0.1'
}

3.inside your application tag in menifest add android:name="android.support.multidex.MultiDexApplication"

<application
        android:name="android.support.multidex.MultiDexApplication"
    ....

4.use this override method on your launching activity

 @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(this);
    }

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...