当前在我的项目中包括和firebase库之后,在我的android应用程序中进行操作,不能运行代码。
app: prepackagemarkerfordebug: transformclasseswithdexfordebug: 在进程中运行,Gradle守护进程需要更大的堆。 它目前有大约 910 MB 。 为了快速构建,将Gradle守护进程的最大堆大小增加到 2048 MB 。 要在项目 gradle.properties 中设置 org 。gradle 。jvmargs=-xmx2048m 。 有关更多信息,请参阅 https://docs.gradle.org/current/userguide/build_environment.html 在. dex 文件中的方法引用数量不能超过1 K 。 了解如何在 https://developer.android.com/tools/building/multidex.html: 应用程序中解决这里问题:任务': 应用程序:transformclasseswithdexfordebug'的transformclasseswithdexfordebug失败 Error:Execution 失败。 com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util. concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: 进程''/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/bin/java''完成了非零退出值 2
我的build.gradle 文件在这里:apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion"23.0.2"
defaultConfig {
applicationId"xyz.in.network"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName"1.0"
}
buildTypes {
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
multiDexEnabled true
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile project(':libs:ViewPagerIndicator')
compile 'com.google.android.gms:play-services:9.0.0'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.google.android.gms:play-services-maps:9.0.0'
compile 'com.google.android.gms:play-services-location:9.0.0'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.getbase:floatingactionbutton:1.10.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.volley:volley:1.0.0'
compile 'com.google.firebase:firebase-messaging:9.0.0'
compile 'com.android.support:multidex:1.0.1'
}
apply plugin: 'com.google.gms.google-services'
我的manifestfile在这儿
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:name="android.support.multidex.MultiDexApplication"
android:supportsRtl="true"
android:theme="@style/AppTheme">
android:screenOrientation="portrait"
android:theme="@style/Theme.Transparent">
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version"/>
将堆大小增加到 2048 M 之后。 Gradle给出这里错误
Error:Execution 对任务': 应用程序:transformclasseswithdexfordebug'失败。 com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util. concurrent.ExecutionException: com.android.dex.DexIndexOverflowException: 方法ID不在 [0, 0 xffff] 中: 65536
我遵循了android开发者站点提供的所有指导,但仍然有这个问题。 如何 解决 这个 问题?