当我尝试构建一个项目时我遇到了这个问题,我在android / build.gradle文件中添加了对proguard的支持,如下所示:
// Proguard configuration
buildTypes {
release {
//minifyEnabled true will turn proguard ON
minifyEnabled true
//proguardFiles let you add your own proguard rules ('proguard-project.txt') in this case, as its already created by gdx-setup
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
}
}
我没有proguard-android.txt文件,但我在同一个android模块目录中有一个proguard-project.txt文件,其中包含以下文字:
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.parentDir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
-verbose
-dontwarn android.support.**
-dontwarn com.badlogic.gdx.backends.android.AndroidFragmentApplication
-dontwarn com.badlogic.gdx.utils.GdxBuild
-dontwarn com.badlogic.gdx.physics.box2d.utils.Box2DBuild
-dontwarn com.badlogic.gdx.jnigen.BuildTarget*
-dontwarn com.badlogic.gdx.graphics.g2d.freetype.FreetypeBuild
-keep class com.badlogic.gdx.controllers.android.AndroidControllers
-keepclassmembers class com.badlogic.gdx.backends.android.AndroidInput* {
<init>(com.badlogic.gdx.Application, android.content.Context, java.lang.Object, com.badlogic.gdx.backends.android.AndroidApplicationConfiguration);
}
-keepclassmembers class com.badlogic.gdx.physics.box2d.World {
boolean contactFilter(long, long);
void beginContact(long);
void endContact(long);
void preSolve(long, long);
void postSolve(long, long);
boolean reportFixture(long);
float reportRayFixture(long, float, float, float, float, float);
}
我得到的错误是:
警告:处理任务java.io.FileNotFoundException时发生异常: /home/.../Desktop/Idea/.../android/build/intermediates/proguard-rules/release/aapt_rules.txt (没有这样的文件或目录)
我已经看到其他问题是他们有一个空的proguard规则文件,但显然不是这样。
关于我如何调试这个的任何想法?
提前多多感谢!
答案 0 :(得分:0)
我发现此问题的解决方案是在“文件”菜单中的“无效缓存/重新启动...”之前,完全删除项目中的android / build目录。我没有删除android / build目录之前尝试了几次菜单选项,它没有任何区别。
尽管启用了“在重建时清理项目”复选框,重建项目也不起作用,所以有时候为了在IntelliJ Idea中获得一个干净的项目,你必须自己完成。