嗨我写了一个可以在我的手机上运行的应用程序(api 23,Android 6.0.1),但是当我想在Geneymotion上启动应用程序(api 17上的虚拟android设备)时出现此错误
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.DexException:多个dex文件定义Landroid /支持/ V4 / accessibilityservice / AccessibilityServiceInfoCompat $ AccessibilityServiceInfoVersionImpl;
我为该api编写应用程序,但我不知道为什么会发生这种情况
gradle这个
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion '25.0.3'
defaultConfig {
applicationId "app.mma.introsliderproject"
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
maven { url "https://jitpack.io" }
}
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:24.2.1'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7'
compile 'com.android.support:design:24.2.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.volley:volley:1.0.0'
compile 'com.github.halysongoncalves:pugnotification:1.8.1'
compile 'me.tatarka.support:jobscheduler:0.1.1'
compile 'com.android.support:support-v4:24.2.1'
compile 'com.android.support:support-vector-drawable:24.2.1'
compile 'de.hdodenhof:circleimageview:2.2.0'
compile 'com.victor:lib:1.0.4'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.github.sd6352051:NiftyDialogEffects:v1.0.2'
compile 'com.google.firebase:firebase-messaging:10.0.1'
compile 'com.github.flavienlaurent.discrollview:library:0.0.2@aar'
compile 'com.github.alxrm:animated-clock-icon:1.0.2'
compile 'com.google.firebase:firebase-crash:10.0.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
答案 0 :(得分:0)
在您的app build.gradle
中添加此内容configurations {
compile.exclude group:'com.android.support', module: 'support-v4'
compile.exclude group:'com.android.support', module: 'support-annotations'
}
答案 1 :(得分:0)
在您的应用程序级app.gradle
中添加以下内容
在dependencies
,
compile 'com.android.support:multidex:1.0.2'
在defaultConfig
multiDexEnabled true
如果您使用自己的Application
课程,请按照以下步骤更改
Application
扩展为扩展MultiDexApplication
同时添加此内容。
@Override
protected void attachBaseContext(Context newBase) {
MultiDex.install(newBase);
super.attachBaseContext(newBase);
}
如果您不使用任何自定义Application
,请更改AndroidManifest.xml
<application
android:name="android.support.multidex.MultiDexApplication"
... >
</application>