gpt4 book ai didi

安卓错误 :Execution failed for task ':app:transformClassesWithDexForDebug'

转载 作者:行者123 更新时间:2023-11-30 00:37:09 34 4
gpt4 key购买 nike

我在 android studio 的 android 项目中工作,当我开始运行 gradle build 并显示以下错误。谁帮我看看是什么问题

Error:Execution failed for task ':app:transformClassesWithDexForDebug'. com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/bin/java'' finished with non-zero exit value 3

build.gradle

   apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
applicationId "com.stage.lookara"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled = true
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile files('libs/twitter4j-core-4.0.4.jar')
compile files('libs/slider.jar')
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.facebook.android:facebook-android-sdk:4.0.0'
compile 'com.etsy.android.grid:library:1.0.5'
compile 'com.baoyz.swipemenulistview:library:1.3.0'
compile files('libs/universal-image-loader-1.9.5.jar')
compile 'com.github.darsh2:MultipleImageSelect:v0.0.3'
compile files('libs/pherialize-1.2.1.jar')
compile 'com.wang.avi:library:2.1.3'
compile 'com.mikhaellopez:circularprogressbar:1.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile
'com.toptoche.searchablespinner:searchablespinnerlibrary:1.3.1'
compile 'com.felipecsl:gifimageview:2.1.0'
}

repositories {
jcenter()
}

dependencies {
compile 'org.adw.library:discrete-seekbar:1.0.1'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:19.+'
compile 'org.jsoup:jsoup:1.7.3'
}

最佳答案

您正在编译整个 Google Play 服务库:

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

它可以在编译期间跨越64K 引用限制'..

参见 this

如果您只是使用图书馆的一些服务,您可以 Selectively compiling APIs into your executable

喜欢:

 compile 'com.google.android.gms:play-services-maps:8.3.0'
compile 'com.google.android.gms:play-services-plus:8.3.0'
compile 'com.google.android.gms:play-services-location:8.3.0'

我还建议使用最新版本的播放服务 compile 'com.google.android.gms:play-services:10.2.1'

第二种方式

如果您真的想使用整个库:在您的应用程序中启用 Multidex

在你的 Gradle 中:

    android {
defaultConfig {
...
minSdkVersion 15
targetSdkVersion 25
multiDexEnabled true
}
...
}

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

在应用类中:

 public class MyApplication extends SomeOtherApplication {
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}

在 list 中定义应用程序类:

    <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapp">
<application
android:name="android.support.multidex.MultiDexApplication" >
...
</application>
</manifest>

关于安卓错误 :Execution failed for task ':app:transformClassesWithDexForDebug' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43247206/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com