2017-04-24 39 views
-1

当我编译代码时,我得到 错误:任务':app:transformClassesWithDexForDebug'的执行失败。Android manifest.xml意图过滤器错误

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.

这是我的代码:

<?xml version="1.0" encoding="utf-8"?> 

<uses-permission android:name="android.permission.INTERNET"/> 
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> 




<application 
    android:allowBackup="true" 
    android:icon="@drawable/police" 
    android:label="@string/app_name" 
    android:supportsRtl="true" 
    android:theme="@style/AppTheme"> 

    <meta-data android:name="com.google.android.gms.version" 
     android:value="@integer/google_play_services_version"/> 
    <activity 
     android:name="com.google.android.gms.ads.AdActivity" 
     android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/> 


    <activity 
     android:name=".MainActivity"> 

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

      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 
</application> 

+0

http://stackoverflow.com/questions/15209831/unable-to-execute-dex-method-id-not-in-0-0xffff-65536 – CommonsWare

+1

可能重复的[错误:执行失败的任务':应用程序:transformClassesWithDexForDebug'](http://stackoverflow.com/questions/33717886/errorexecution-failed-for-task-apptransformclasseswithdexfordebug) – sziraqui

+0

Probabaly内存问题。增加Android Manifest android:name =“android.support.multidex.MultiDexApplication”中的内存或增加build.gradle中的堆大小javaMaxHeapSize“4g” – sivaprakash

回答

-1

添加这些播放服务趋于介绍DEX错误。首先尝试通过你的IDE清洗你的应用程序,

如果不工作添加此建立.gradle

defaultConfig { 
    multiDexEnabled true 
} 
+0

请详细解释如何解决开发人员遇到的'DexIndexOverflowException'错误越来越。另外,一个''不需要*'元素,尽管它可以有一个元素。 – CommonsWare

+0

我的错误,删除该位 –

0

尝试加入这个在你摇篮

android { 

    defaultConfig { 
     ... 

     // Enabling multidex support. 
     multiDexEnabled true 
    } 
    ... 
} 

dependencies { 
    compile 'com.android.support:multidex:1.0.0' 
} 
+0

不幸的兄弟:( –

0

您没有使用整个Google Play Services API,所以不要编译build.gradle文件中的整个软件包,而是尝试编译您项目所需的单个服务。 从版本6.5开始,您可以选择性地将Google Play服务API编译到您的应用中。 例如,只包括谷歌飞度和Android Wear的API,替换您的build.gradle文件中的以下行:

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

这些行:

compile 'com.google.android.gms:play-services-fitness:9.0.0' 
compile 'com.google.android.gms:play-services-wearable:9.0.0' 

您需要检查哪些服务你将要求并相应地编译它们。