Raj*_*ana 6 java xerces gradle xml-parsing android-studio
当我在Xerces库中导入时,我似乎无法构建我的应用程序.由于之前的问题,我已经在使用multidex,因此我知道这一切都已正确设置.
我花了几天时间在线查看并尝试各种版本的Xerces并调整到我的build.gradle但无法解决问题.我已经尝试过清理重建,重新设置Android Studio /我的PC,使用jar直接编译,现在正式出于想法.
下面是我的build.gradle设置:
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "#packageid#"
minSdkVersion 18
targetSdkVersion 23
versionCode 1
versionName "0.8"
multiDexEnabled true
}
buildTypes {
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
// compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'me.dm7.barcodescanner:zbar:1.8.4'
compile project(':rangebar-1.3')
compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
transitive = true;
}
compile 'com.batch.android:batch-sdk:1.5'
compile 'xerces:xercesImpl:2.11.0'
// compile files('libs/xercesImpl-2.9.1.jar')
}
Run Code Online (Sandbox Code Playgroud)
我已经扩展了我的应用程序,因此在课堂上使用了以下内容:
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
Run Code Online (Sandbox Code Playgroud)
但是,每次我尝试构建时,我都会遇到以下错误:
Error:Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_79\bin\java.exe'' finished with non-zero exit value 1
Run Code Online (Sandbox Code Playgroud)
下面是我的gradle构建错误日志的结尾部分:
Reading program jar [C:\Documents\MobileProjects\IA\Android\app\build\intermediates\transforms\jarMerging\debug\jars\1\1f\combined.jar]
Reading library jar [C:\AppData\Local\Android\sdk\build-tools\23.0.2\lib\shrinkedAndroid.jar]
Preparing output jar [C:\Documents\MobileProjects\IA\Android\app\build\intermediates\multi-dex\debug\componentClasses.jar]
Copying resources from program jar [C:\Documents\MobileProjects\IA\Android\app\build\intermediates\transforms\jarMerging\debug\jars\1\1f\combined.jar]
:app:transformClassesWithMultidexlistForDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_79\bin\java.exe'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Run Code Online (Sandbox Code Playgroud)
我从你的 build.gradle 中看到你的项目似乎包含不同的模块(compile project(':rangebar-1.3'))。
我在我的多模块项目中遇到了同样的问题。根本原因是同一个库被显式包含在多个模块中。
假设您的项目具有以下结构:
Project
+-Module1 (includes Module2, Module3)
+-Module2 (includes Lib.jar)
+-Module3 (includes Lib.jar)
Run Code Online (Sandbox Code Playgroud)
在此配置中,我在尝试编译 Module1 时遇到了同样的错误。解决方案是重新配置模块以仅在一个位置包含 Lib.jar,例如:
Project
+-Module1 (includes Module2, Module3)
+-Module2 (includes Module3)
+-Module3 (includes Lib.jar)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1343 次 |
| 最近记录: |