App在Lollipop中运行良好,但在KitKat中崩溃

时间:2016-07-14 13:04:37

标签: android

我在Android中开发了一个应用程序,它在棒棒糖设备中运行良好,但在KitKat设备中崩溃。请帮我找到解决方案。

apply plugin: 'com.android.application'

android {
    compileSdkVersion 19
    buildToolsVersion '21.1.1'
    defaultConfig {
        applicationId "com.example.itsoft37.kitkat"
        minSdkVersion 11
        targetSdkVersion 19
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:19.1.0'
}

错误显示不幸在设备上停止。

2 个答案:

答案 0 :(得分:0)

当我更改api版本时..

    apply plugin: 'com.android.application'

    android {
        compileSdkVersion 19
        buildToolsVersion '19.1.0'

        defaultConfig {
    applicationId "com.example.itsoft37.kitkat"
    minSdkVersion 11
    targetSdkVersion 19
        }

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

    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        compile 'com.android.support:appcompat-v7:19.1.0'
    }

此错误将显示..                 错误:任务':app:transformClassesWithDexForDebug'执行失败。

  

com.android.build.api.transform.TransformException:java.lang.RuntimeException:com.android.ide.common.process.ProcessException:java.util.concurrent.ExecutionException:java.lang.IllegalStateException:Multi dex require构建工具21.0.0 /当前:19.1

答案 1 :(得分:0)

申请插件:' com.android.application'

android {
    compileSdkVersion 19
    buildToolsVersion '19.1.0'

    defaultConfig {
applicationId "com.example.itsoft37.kitkat"
minSdkVersion 11
targetSdkVersion 19

**multiDexEnabled true**
    }

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

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:19.1.0'


    **compile 'com.android.support:multidex:1.0.1'**
}