apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion '24.0.1'
defaultConfig {
applicationId "com.example.calendarquickstart"
minSdkVersion 11
targetSdkVersion 24
versionCode 1
multiDexEnabled true
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.google.android.gms:play-services-auth:9.4.0'
compile 'pub.devrel:easypermissions:0.1.5'
compile('com.google.api-client:google-api-client-android:1.22.0') {
exclude group: 'org.apache.httpcomponents'
}
compile('com.google.apis:google-api-services-calendar:v3-rev210-1.22.0') {
exclude group: 'org.apache.httpcomponents'
}
}
我试图使用谷歌API的日历,但我得到以下错误,而运行应用程序"
信息:Gradle tasks [:app:clean,:app:generateDebugSources,:应用:mockableAndroidJar:应用:prepareDebugUnitTestDependencies,:应用程序:generateDebugAndroidTestSources,应用:assembleDebug):错误:任务执行失败应用:transformClassesWithDexForDebug。
com.android.build.api.transform。TransformException: java.lang.RuntimeException: java.lang.RuntimeException: 没有索引文件在C:Usersuser AndroidStudioProjects CalendarQuickstart app 制造中间体 敏捷转换调试 1000 文件夹番石榴jdk5 - 17.0 _bbc68f1b67df2c58337cd00757b7bfd105bb5573"
我正在遵循这个链接的步骤
需要在gradle文件中做什么更改来运行这个应用程序?
尝试在构建中启用多重索引支持。
android {
compileSdkVersion 21
buildToolsVersion "21.1.0"
defaultConfig {
...
minSdkVersion 14
targetSdkVersion 21
...
// Enabling multidex support.
multiDexEnabled true
}
...
}
dependencies {
compile 'com.android.support:multidex:1.0.0'
}
额外的阅读:
Android应用程序(APK)文件包含Dalvik executable (DEX)文件形式的可执行字节码文件,其中包含用于运行应用程序的编译代码。Dalvik executable规范将单个DEX文件中可引用的方法总数限制为65,536 -包括Android框架方法,库方法和您自己代码中的方法。在计算机科学的语境中,术语Kilo, K,表示1024(或2^10)。因为65,536等于64 X 1024,所以这个限制被称为"64K参考限制"。要超过这个限制,你需要配置你的应用程序构建过程来生成多个DEX文件,称为多索引配置。