Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/210.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 错误:任务';的执行失败:应用程序:dexDebug';使用谷歌播放广告服务_Android_Exception_Keyboard_Build.gradle - Fatal编程技术网

Android 错误:任务';的执行失败:应用程序:dexDebug';使用谷歌播放广告服务

Android 错误:任务';的执行失败:应用程序:dexDebug';使用谷歌播放广告服务,android,exception,keyboard,build.gradle,Android,Exception,Keyboard,Build.gradle,我正在尝试将admob的google play服务添加到我的Android Studio项目中,但是当我尝试运行该应用程序时,它一直失败,只有一个错误。所以我真的不知道出了什么问题 this is Error: Information:Gradle tasks [:app:assembleDebug] :app:preBuild UP-TO-DATE :app:preDebugBuild UP-TO-DATE :app:compileDebugNdk UP-TO-DATE :a

我正在尝试将admob的google play服务添加到我的Android Studio项目中,但是当我尝试运行该应用程序时,它一直失败,只有一个错误。所以我真的不知道出了什么问题

    this is Error:

    Information:Gradle tasks [:app:assembleDebug]
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportSupportV42200Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServices730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAds730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppinvite730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppstate730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBase730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesCast730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesDrive730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesFitness730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGames730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGcm730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesIdentity730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesLocation730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesMaps730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesNearby730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPanorama730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPlus730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesSafetynet730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWallet730Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWearable730Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:compileDebugJava UP-TO-DATE
:app:preDexDebug UP-TO-DATE
:app:dexDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexIndexOverflowException: Cannot merge new index 65540 into a non-jumbo instruction!
    at com.android.dx.merge.InstructionTransformer.jumboCheck(InstructionTransformer.java:109)
    at com.android.dx.merge.InstructionTransformer.access$800(InstructionTransformer.java:26)
    at com.android.dx.merge.InstructionTransformer$StringVisitor.visit(InstructionTransformer.java:72)
    at com.android.dx.io.CodeReader.callVisit(CodeReader.java:114)
    at com.android.dx.io.CodeReader.visitAll(CodeReader.java:89)
    at com.android.dx.merge.InstructionTransformer.transform(InstructionTransformer.java:49)
    at com.android.dx.merge.DexMerger.transformCode(DexMerger.java:842)
    at com.android.dx.merge.DexMerger.transformMethods(DexMerger.java:813)
    at com.android.dx.merge.DexMerger.transformClassData(DexMerger.java:785)
    at com.android.dx.merge.DexMerger.transformClassDef(DexMerger.java:682)
    at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:542)
    at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
    at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
    at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
    at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
    at com.android.dx.command.dexer.Main.run(Main.java:246)
    at com.android.dx.command.dexer.Main.main(Main.java:215)
    at com.android.dx.command.Main.main(Main.java:106)
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_45\bin\java.exe'' finished with non-zero exit value 2
Information:BUILD FAILED
Information:Total time: 35.156 secs
Information:1 error
Information:0 warnings
Information:See complete output in console

    ===========================================================================
    My Gradle file is:

    apply plugin: 'com.android.application'

    android {
        compileSdkVersion 21
        buildToolsVersion "21.1.2"

        defaultConfig {
            applicationId "com.example.keyboard"
            minSdkVersion 11
            targetSdkVersion 21
            versionCode 2

        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }

    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        compile 'com.android.support.appcompat-v7:22.2.0'
        compile 'com.google.android.gms:play-services:7.3.0'

    }
    ==============================================================
    this is my Manifest File:

    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.example.keyboard"
        android:versionCode="2"
        android:versionName="1.1">

        <uses-sdk
            android:minSdkVersion="11"
            android:targetSdkVersion="21"
            />

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



        <application
            android:allowBackup="true"
            android:icon="@drawable/roman"
            android:theme="@style/keyboard_1_style"
            android:label="@string/ime_name"

            >
            <activity
                android:name="com.example.keyboard.help"
                android:label="Example Keypad">
                <intent-filter>
                    <action android:name=".Help"/>
                    <action android:name="android.intent.action.MAIN"/>
                    <category android:name="android.intent.category.LAUNCHER"/>
                </intent-filter>
            </activity>

            <service android:name="SoftKeyboard"
                android:permission="android.permission.BIND_INPUT_METHOD">
                <intent-filter>
                    <action android:name="android.view.InputMethod" />
                </intent-filter>
                <meta-data android:name="android.view.im"
                    android:resource="@xml/method" />
            </service>


            <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"
                android:theme="@android:style/Theme.Translucent"
                >

            </activity>



        </application>
    </manifest>
这是一个错误:
信息:渐变任务[:app:assembleDebug]
:app:预构建最新版本
:app:preDebugBuild-TO-DATE
:app:compiledbugndk最新
:app:checkDebugManifest
:app:prerelease建立最新版本
:app:PrepareCommandroidSupportV42200库最新
:app:prepareComgoogleandroidgmsplayservices730最新库
:app:prepareComGoogleAndroidGmsPlayServicesAds730Library最新
:app:prepareComgoogleandroidgmsplayservicesanalytics730库最新
:app:PrepareComgoogleandroidGMSplayServicesIndexing730Library最新
:app:prepareComgoogleandroidgmsplayservicesapproid库最新
:app:prepareComgoogleandroidgmsplayservicesapstate730最新库
:app:PrepareComgoogleandroidgmsPlayServicesBase730库最新
:app:prepareComGoogleAndroidGmsPlayServicesCast730Library最新
:app:prepareComGoogleAndroidGmsPlayServicesDrive730Library最新
:app:prepareComGoogleAndroidGmsPlayServicesFitness730Library最新
:app:prepareComGoogleAndroidGmsPlayServicesGames730Library最新
:app:prepareComGoogleAndroidGmsPlayServicesGcm730Library最新
:app:PrepareComgoogleandroidgmsPlayServiceSideEntity730最新库
:app:prepareComGoogleAndroidGmsPlayServicesLocation730Library最新
:app:prepareComGoogleAndroidGmsPlayServicesMaps730Library最新
:app:PrepareComgoogleandroidgmsPlayServicesNerby730库最新
:app:prepareComGoogleAndroidGmsPlayServicesPanorama730Library最新
:app:prepareComGoogleAndroidGmsPlayServicesPlus730Library最新
:app:prepareComGoogleAndroidGmsPlayServicesSafetynet730Library最新
:app:PrepareComgoogleandroidGMSplayServicesWallet730最新库
:app:PrepareComgoogleandroidGMSplayServicesWebable730Library最新
:app:preparedebug依赖项
:app:compiledBugaidl最新版本
:app:CompiledBugRenderScript最新版本
:app:generateDebugBuildConfig最新
:app:generateDebugAssets最新
:app:mergeDebugAssets最新
:app:generateDebugResValues最新
:app:generateDebugResources最新
:app:mergeDebugResources最新
:app:processDebugManifest最新
:app:processDebugResources最新
:app:generateDebugSources最新
:app:compiledBugJava最新版本
:app:preDexDebug最新
:app:dexDebug
意外的顶级异常:
com.android.dex.DexIndexOverflowException:无法将新索引65540合并到非巨型指令中!
位于com.android.dx.merge.InstructionTransformer.jumboCheck(InstructionTransformer.java:109)
访问com.android.dx.merge.InstructionTransformer.access$800(InstructionTransformer.java:26)
在com.android.dx.merge.InstructionTransformer$StringVisitor.visit(InstructionTransformer.java:72)上
在com.android.dx.io.codereder.callVisit(codereder.java:114)
在com.android.dx.io.codereder.visitAll(codereder.java:89)
位于com.android.dx.merge.InstructionTransformer.transform(InstructionTransformer.java:49)
位于com.android.dx.merge.dexmerge.transformCode(dexmerge.java:842)
位于com.android.dx.merge.dexmmerge.transformMethods(dexmmerge.java:813)
在com.android.dx.merge.dexmerge.transformClassData上(dexmerge.java:785)
在com.android.dx.merge.dexmmerge.transformClassDef(dexmmerge.java:682)上
在com.android.dx.merge.dexmmerge.mergeClassDefs(dexmmerge.java:542)上
位于com.android.dx.merge.dexmerge.mergeDexes(dexmerge.java:171)
位于com.android.dx.merge.dexmmerge.merge(dexmmerge.java:189)
位于com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
位于com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
位于com.android.dx.command.dexer.Main.run(Main.java:246)
位于com.android.dx.command.dexer.Main.Main(Main.java:215)
位于com.android.dx.command.Main.Main(Main.java:106)
错误:任务“:app:dexDebug”的执行失败。
>com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:process'command'C:\Program Files\Java\jdk1.7.0_45\bin\Java.exe''以非零退出值2结束
信息:生成失败
信息:总时间:35.156秒
信息:1个错误
信息:0个警告
信息:请参阅控制台中的完整输出
===========================================================================
我的Gradle文件是:
应用插件:“com.android.application”
安卓{
编译DK21版
BuildTools版本“21.1.2”
默认配置{
applicationId“com.example.keyboard”
明斯克版本11
targetSdkVersion 21
版本代码2
}
建筑类型{
释放{
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard rules.pro'
}
}
}
依赖关系{
编译文件树(目录:“libs”,包括:['*.jar'])
编译'com.android.support.appcompat-v7:22.2.0'
编译'com.google.android.gms:play services:7.3.0'
}
==============================================================
这是我的清单文件:

如果有人能给我一些指点,告诉我哪里出了问题,我将不胜感激。

使用超过65K种方法构建应用程序:

您可以使用multidex支持库来启用multidex

1) 将其包含在依赖项中:

dependencies {
  ...
  compile 'com.android.support:multidex:1.0.0'
}
2) 在应用程序中启用它:

defaultConfig {
    ...
    minSdkVersion 14
    targetSdkVersion 21
    ....
    multiDexEnabled true
}
(三)
public class MyApplication extends Application {
  ....
   @Override
   protected void attachBaseContext(Context context) {
    super.attachBaseContext(context);
    MultiDex.install(this);
   }
}
<application
    ...
    android:name="android.support.multidex.MultiDexApplication">
    ...
</application>