当前位置: 首页 > 知识库问答 >
问题:

':app:transformClasses WithdexForDebug'.>网站: 当我在我的工作室项目中添加了Facebook最新的SDK时

笪烨
2023-03-14

当我尝试将Facebook添加为图书馆或毕业生时,我遇到错误

//compile 'com.facebook.android:facebook-android-sdk:4.7.0'

这是我的android Studio项目结构我的主要App文件夹gradle有以下库。

  compile fileTree(include: ['*.jar'], dir: 'libs')

    compile project(':twitter-core-release')
    compile project(':tweet-ui-release')
    compile project(':twitter-release')
    compile project(':tweet-composer-release')
    //compile 'com.facebook.android:facebook-android-sdk:4.7.0'
    compile project(':facebook_sk')
    compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'com.android.support:design:23.0.1'
    compile 'com.squareup.retrofit:retrofit:2.0.0-beta1'
    compile 'com.squareup.retrofit:converter-jackson:2.0.0-beta1'
    compile 'com.squareup.retrofit:adapter-rxjava:2.0.0-beta1'
    compile 'com.twotoasters.jazzylistview:library:1.2.1'
    compile 'com.twotoasters.jazzylistview:library-recyclerview:1.2.1'
    compile 'com.pnikosis:materialish-progress:1.7'
    compile 'com.google.android.gms:play-services-gcm:8.1.0'
    compile 'com.android.support:recyclerview-v7:23.0.1'
    compile 'io.realm:realm-android:0.82.2'
    compile 'com.google.android.gms:play-services-analytics:8.1.0'
    compile 'jp.wasabeef:recyclerview-animators:1.3.0'
    compile 'com.google.code.gson:gson:2.3'
    compile 'io.fabric.sdk.android:fabric:1.3.+@aar'
    compile 'com.digits.sdk.android:digits:1.7.+@aar'

在我的应用程序库中,它有universal-image-loader-1.9.4.jar

在facebook_sk中,它有以下内容

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    //compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'com.android.support:support-v4:23.0.1'
}

在facebook libs中,它bolts-android-1.1.2.jar

如果我删除了facebook skd并构建了我的项目,那么它在工作室中运行良好,但当我无法使用facebook sdk时,它会给我以下错误:

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

我需要使用multidex吗?

共有3个答案

林英朗
2023-03-14

我必须启用多Dex并分配javaMax堆大小“4g”,否则会出现内存不足错误。

需要以下在应用程序内构建等级文件,在Android内部,默认配置已经存在,只需要添加多DexEnabled真实在那里,dexOptions是新的。

defaultConfig {
    multiDexEnabled true
}

dexOptions {
    javaMaxHeapSize "4g"
}
马侯林
2023-03-14

当我有不同版本的重复依赖项时,我收到相同的错误。

尝试此命令并检查是否有东西两次:

gradle dependencies
孟彦
2023-03-14

现在,我通过添加多指数来解决这个问题

defaultConfig {
        applicationId "com.xxxxx"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        // Enabling multidex support.
        multiDexEnabled true
    }


dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile project(':twitter-core-release')
    compile project(':tweet-ui-release')
    compile project(':twitter-release')
    compile project(':tweet-composer-release')
    //compile 'com.facebook.android:facebook-android-sdk:4.7.0'
    compile project(':facebook_sk')
    compile 'com.squareup.retrofit:retrofit:2.0.0-beta1'
    compile 'com.squareup.retrofit:converter-jackson:2.0.0-beta1'
    compile 'com.squareup.retrofit:adapter-rxjava:2.0.0-beta1'
    compile 'com.twotoasters.jazzylistview:library:1.2.1'
    compile 'com.twotoasters.jazzylistview:library-recyclerview:1.2.1'
    compile 'com.pnikosis:materialish-progress:1.7'
    compile 'com.google.android.gms:play-services-gcm:8.1.0'
    compile 'com.google.android.gms:play-services-analytics:8.1.0'
    compile 'io.realm:realm-android:0.82.2'
    compile 'jp.wasabeef:recyclerview-animators:1.3.0'
    compile 'com.google.code.gson:gson:2.3'
    compile 'io.fabric.sdk.android:fabric:1.3.+@aar'
    compile 'com.digits.sdk.android:digits:1.7.+@aar'
    compile 'com.android.support:multidex:1.0.1'
}

对于脸书开发工具包:

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    //compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'com.android.support:support-v4:23.0.1'
    compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'com.android.support:design:23.0.1'
    compile 'com.android.support:recyclerview-v7:23.0.1'
}
 类似资料:
  • 有一个 lib for selenium org.seleniumhq.selenium:selenium-java : 2.53.1 org.seleniumhq。硒:硒服务器:2.44.0 现在我需要为我在这个项目中的新任务添加selenium服务器依赖项,但在添加selenium服务器依赖项时,我遇到了没有一些类的问题(例如'java.lang.NoClassDefFoundError: o

  • 但我需要一个解释,因为代码的工作方式与预期的不同。 我想在我的网站上有一个链接,用户可以点击whatsapp链接,开始与联系人的对话。 我添加的代码是这样的: null 这段代码在Android和iPhone上都可以使用,但它不允许我添加自定义联系号码: abid只能是已保存在您手机中的联系人的ID,否则它将打开whatsapp中的联系人选择页面 请不要在没有内容解释的情况下分享链接,因为我不是一

  • 因此,我创建了一个新的laravel项目,并使用npm run dev在public文件夹中生成css文件。就像我的上一个项目一样,我试着像这样加载我的CSS 但那不起作用。我的文件夹结构是这样的 我查了很多帖子,但没有一个奏效。加载文件的唯一方法如下所示 或 我的问题是为什么asset helper不起作用? 我尝试更改url,更改env'asset_url'等 我知道这是一个很基本的问题,但这

  • 我面临这个问题已经有一段时间了,我必须每30分钟重新克隆我的项目,因为这个错误显示,不让我建立我的项目。 `失败:生成失败,出现异常。 > try:使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获得更多日志输出。使用--scan运行以获得完整的洞察力。 在https://help.gradle.org获得更多帮助 在6s中生成失败异常:Gradle

  • 当我尝试运行我的世博会项目时,我收到以下信息: 如果我运行npm安装,我会得到以下结果: 这就是我运行时得到的结果: 这是因为我尝试更新expo sdk,但我不知道我做错了什么。有人能帮我吗?

  • 好的,我有一个包含两个restful web服务类Login.class和Subscribe.class的包,当我将它们部署到app engine并测试它们时,它们工作了。现在,我将一个名为User s.class的新服务类添加到包中。现在,我的服务都不起作用了。当我调用它们时,我得到一个内部服务器错误。 严重:产生介质类型冲突。The resource Methods public javax.