我在 GitHub 上有一个项目,我在家里的办公室都在做这个项目。大约两个月来,两台机器都运行良好。然后两周前,它停止在我的家用电脑上运行,但是在我的工作电脑上仍然可以正常工作.
这是我得到的错误:
:app:shrinkDebugMultiDexComponents 失败
失败:构建失败并出现异常。
- 什么地方出了错:
任务“:app:shrinkDebugMultiDexComponents”执行失败。
java.io.IOException:无法读取 [D:\dev\gitRepo\app\android\app\build\intermediates\multi-dex\debug\allclasses.jar] (无法处理类 [__MACOSX/com/stripe /android/._BuildConfig.class](类中无效的幻数 [51607]))
- 尝试:
使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。
The stripe
给我错误的包是第三方库你可以在这里找到 https://github.com/stripe/stripe-android。我将其列为 build.gradle 文件中的依赖项,正如他们所说的那样。
compile 'com.stripe:stripe-android:+'
我已经注释掉了所有相关代码stripe
该应用程序运行完全正常,所以我确实知道它与我处理该包的方式有关。
不幸的是,我不记得我做了什么才使它停止工作。我确实认为在这件事发生的前一周我升级了 Android Studio,并花了相当多的时间搞乱ProGuard
配置。
我尝试过的:
- 致力于
master
没有分支的地方ProGuard
已经做出了改变。
- 卸载并重新安装 Android Studio
- 重新克隆 git 存储库
- 安装 API 17(Eclipse 的条带需要这个。不是 Studio,但我尝试过)。
- 联系了 stripe 客户支持,但他们没有任何线索。
-
这个堆栈溢出帖子 https://stackoverflow.com/questions/18798090/java-io-ioexception-cant-process-class-when-running-proguard-in-maven-build-of。然而,没有Mac电脑接触过这个项目,也没有我亲自压缩过任何与该项目相关的东西
stripe
.
-
从这里 http://slightlyrandombrokenthoughts.blogspot.com/2010/03/reverse-engineering-java-class-magic.html,将幻数从十六进制转换为 ASCII。结果是Q`我不认识。
我认为这可能与我为 ProGuard 所做的事情有关,但我不明白是怎么回事。我所在的分支与任何 Proguard 工作完全不同,有一个干净的 AndroidStudio 安装,一个干净的存储库克隆,当我在办公室时,该项目仍然可以正常工作。
EDIT
我正在运行这个debug
构建类型。这是我的 3 个 gradle 文件。第一个是整个项目,第二个是应用程序模块,第三个是本地 android 库模块。
Project build.gradle
:
构建脚本{
存储库{
jcenter()
行家{网址'http://download.crashlytics.com/maven http://download.crashlytics.com/maven'}
}
依赖项{
类路径'com.android.tools.build:gradle:1.2.3'
类路径 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
}
}
allprojects {
repositories {
jcenter()
maven{ url 'http://download.crashlytics.com/maven' }
}
}
安卓应用模块build.gradle
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.app.android"
renderscriptTargetApi 19
renderscriptSupportModeEnabled true
minSdkVersion 16
targetSdkVersion 22
multiDexEnabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
buildConfigField 'Boolean', 'enableCrashlytics', 'true'
}
debug {
buildConfigField 'Boolean', 'enableCrashlytics', 'false'
}
adhoc {
debuggable true
signingConfig signingConfigs.debug
buildConfigField 'Boolean', 'enableCrashlytics', 'true'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
}
dependencies {
compile project(':localLibrary')
compile 'com.facebook.android:facebook-android-sdk:3.21.1'
compile 'commons-io:commons-io:2.4'
compile 'com.github.bumptech.glide:glide:3.6.1'
compile 'com.android.support:support-v4:22.0.1'
compile 'com.google.android.gms:play-services-identity:8.1.0'
compile 'com.google.android.gms:play-services-plus:8.1.0'
compile 'com.google.android.gms:play-services-maps:8.1.0'
compile 'com.android.support:multidex:1.0.1'
compile 'io.card:android-sdk:5.0.1'
compile 'com.stripe:stripe-android:+'
compile('com.crashlytics.sdk.android:crashlytics:2.5.2@aar') {
transitive = true;
}
}
本地Android库模块build.gradle
apply plugin: 'com.android.library'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
minSdkVersion 16
targetSdkVersion 22
multiDexEnabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:22.1.0'
compile 'com.google.code.gson:gson:2.2.2'
compile 'com.android.support:multidex:1.0.0'
compile group: 'org.apache.httpcomponents' , name: 'httpmime' , version: '4.3.5'
compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5'
}