我试图在Android工作室中构建一个APK。 我收到这个错误:
:myApp:transformClassesWithMultidexlistForDebug FAILED
Reading program jar [C:\MyApp\myApp\build\intermediates\transforms\jarMerging\debug\jars\1\1f\combined.jar]
Reading library jar [C:\Users\myUser\AppData\Local\Android\sdk\build-tools\24.0.1\lib\shrinkedAndroid.jar]
Preparing output jar [C:\MyApp\myApp\build\intermediates\multi-dex\debug\componentClasses.jar]
Copying resources from program jar [C:\MyApp\myApp\build\intermediates\transforms\jarMerging\debug\jars\1\1f\combined.jar]
Error:Execution failed for task ':myApp: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
gradle:
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 23
buildToolsVersion "24.0.1"
useLibrary 'org.apache.http.legacy'
compileOptions.encoding = 'UTF-8'
defaultConfig {
multiDexEnabled true
applicationId "com.myapp.app"
minSdkVersion 16
targetSdkVersion 23
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
lintOptions {
checkReleaseBuilds false
}
buildTypes {
release {
minifyEnabled false
//proguardFiles getDefaultProguardFile('proguard-android.txt')
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
buildscript {
repositories {
jcenter()
// mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
// The Fabric Gradle plugin uses an open ended version to
// react quickly to Android tooling updates
classpath 'io.fabric.tools:gradle:1.+'
}
}
dependencies {
compile 'com.android.support:multidex:'
...
..
many different dependencies..
..
}
这一切都是在我遇到项目结构选项问题后开始的 - 它不会打开。 所以我在build-tools中删除了一些文件夹,然后项目就不会编译了。 所以我再次将该文件夹从另一台计算机复制回该buils-tools文件夹。好像电话和模拟器上的一切都运行良好。但是现在我已经尝试构建一个APK,而这正是我所得到的。
答案 0 :(得分:0)
我认为buildToolsVersion和目标api应该是同一级别,不确定难度。尝试将构建工具版本更改为:23.0.2
答案 1 :(得分:0)
将您的sdk更新为最新的构建工具,并将构建版本更改为最新构建工具的版本,或者您可以从sdk manager下载构建工具23.0.2并安装它。