gpt4 book ai didi

由于输出 jar 库为空,Android Studio proguardRelease FAILED

转载 作者:太空宇宙 更新时间:2023-11-03 12:06:57 26 4
gpt4 key购买 nike

我已经将一个项目从 Eclipse 导入到 Android Studio 1.0.1 中,该项目包含一个 Android 库项目 (RuletaAfortunadaCore) 和一个 Android 项目 (RuletaAfortunada),还有一些第三方库依赖项。在导入过程中,一切似乎都很好,但现在当我尝试构建它时,我从 Gradle 收到了这条错误消息:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':ruletaAfortunadaCore:proguardRelease'.
> java.io.IOException: The output jar is empty. Did you specify the proper '-keep' options?

从构建过程开始的整个输出:

Executing tasks: [clean, :ruletaAfortunada:compileDebugSources, :facebookSDK:compileDebugSources, :ruletaAfortunadaCore:compileDebugSources]

Configuration on demand is an incubating feature.
:facebookSDK:clean
:ruletaAfortunada:clean UP-TO-DATE
:ruletaAfortunadaCore:clean
:facebookSDK:compileLint
:facebookSDK:copyReleaseLint UP-TO-DATE
:facebookSDK:mergeReleaseProguardFiles UP-TO-DATE
:facebookSDK:preBuild
:facebookSDK:preReleaseBuild
:facebookSDK:checkReleaseManifest
:facebookSDK:prepareReleaseDependencies
:facebookSDK:compileReleaseAidl
:facebookSDK:compileReleaseRenderscript
:facebookSDK:generateReleaseBuildConfig
:facebookSDK:generateReleaseAssets UP-TO-DATE
:facebookSDK:mergeReleaseAssets
:facebookSDK:generateReleaseResValues UP-TO-DATE
:facebookSDK:generateReleaseResources
:facebookSDK:packageReleaseResources
:facebookSDK:processReleaseManifest
:facebookSDK:processReleaseResources
:facebookSDK:generateReleaseSources
:facebookSDK:compileReleaseJava
:facebookSDK:processReleaseJavaRes UP-TO-DATE
:facebookSDK:packageReleaseJar
:facebookSDK:compileReleaseNdk
:facebookSDK:packageReleaseJniLibs UP-TO-DATE
:facebookSDK:packageReleaseLocalJar
:facebookSDK:packageReleaseRenderscript UP-TO-DATE
:facebookSDK:bundleRelease
:ruletaAfortunada:preBuild
:ruletaAfortunada:preDebugBuild
:ruletaAfortunada:checkDebugManifest
:ruletaAfortunada:preReleaseBuild
:ruletaAfortunadaCore:compileLint
:ruletaAfortunadaCore:copyReleaseLint UP-TO-DATE
:ruletaAfortunadaCore:preBuild
:ruletaAfortunadaCore:preReleaseBuild
:ruletaAfortunadaCore:checkReleaseManifest
:ruletaAfortunadaCore:preDebugBuild
:ruletaAfortunadaCore:preDebugTestBuild
:ruletaAfortunadaCore:prepareComAndroidSupportSupportV42100Library
:ruletaAfortunadaCore:prepareComGoogleAndroidGmsPlayServices6587Library
:ruletaAfortunadaCore:prepareRuletaAfortunadaFacebookSDKUnspecifiedLibrary
:ruletaAfortunadaCore:prepareReleaseDependencies
:ruletaAfortunadaCore:compileReleaseAidl
:ruletaAfortunadaCore:compileReleaseRenderscript
:ruletaAfortunadaCore:generateReleaseBuildConfig
:ruletaAfortunadaCore:generateReleaseAssets UP-TO-DATE
:ruletaAfortunadaCore:mergeReleaseAssets
:ruletaAfortunadaCore:generateReleaseResValues UP-TO-DATE
:ruletaAfortunadaCore:generateReleaseResources
:ruletaAfortunadaCore:mergeReleaseResources
:ruletaAfortunadaCore:processReleaseManifest
:ruletaAfortunadaCore:processReleaseResources
:ruletaAfortunadaCore:generateReleaseSources
:ruletaAfortunadaCore:compileReleaseJava
:ruletaAfortunadaCore:extractReleaseAnnotations
:ruletaAfortunadaCore:mergeReleaseProguardFiles UP-TO-DATE
:ruletaAfortunadaCore:compileReleaseNdk
:ruletaAfortunadaCore:packageReleaseJniLibs UP-TO-DATE
:ruletaAfortunadaCore:packageReleaseRenderscript UP-TO-DATE
:ruletaAfortunadaCore:packageReleaseResources
:ruletaAfortunadaCore:proguardRelease FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':ruletaAfortunadaCore:proguardRelease'.
> java.io.IOException: The output jar is empty. Did you specify the proper '-keep' options?

此类库项目的 build.gradle 文件内容:

apply plugin: 'com.android.library'

android {
compileSdkVersion 13
buildToolsVersion "21.1.2"

defaultConfig {
minSdkVersion 9
targetSdkVersion 17
}

buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
}
}
}

dependencies {
compile project(':facebookSDK')
compile 'com.android.support:support-v4:18.0.0'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.google.android.gms:play-services:+'
compile files('libs/chartboost.jar')
compile files('libs/mint-4.0.7.jar')
}

更新:我意识到名为 RuletaAfortunadaCore 的 Android 库项目可以构建为独立项目或作为模块制作,完全没有问题。只有在构建使用它的整个 RuletaAfortunada Android 项目时,它才会构建失败。

这样的 Android 项目的 build.gradle 文件是 Android Studio 默认创建的文件,我想,所以里面没有什么有趣的东西。无论如何,以防万一:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}

allprojects {
repositories {
jcenter()
}
}

这是 settings.gradle:

include ':facebookSDK'
include ':ruletaAfortunadaCore'
include ':ruletaAfortunada'

最后,为了拥有所有这些,这是 facebookSDK 模块 build.gradle:

apply plugin: 'com.android.library'

android {
compileSdkVersion 9
buildToolsVersion "21.1.2"

defaultConfig {
minSdkVersion 9
targetSdkVersion 9
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}

dependencies {
compile 'com.android.support:support-v4:18.0.0'
compile files('libs/bolts-android-1.1.2.jar')
}

最佳答案

正如一个人所建议的那样,答案现在似乎已经消失了 :-?,我的解决方案是在我的图书馆项目的 build.gradle 中将 minifyEnabled 设置为 false。就我为 Android 项目本身将其设置为 true 而言,proguard 无论如何都会执行并且错误已消失。

关于由于输出 jar 库为空,Android Studio proguardRelease FAILED,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27529178/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com