2017-07-28 27 views
0

當我嘗試建立我已經在我的Android /的build.gradle文件中添加了proguard的支持項目如下,我面臨這個問題:aapt_rules.txt未發現:在IntelliJ IDEA的libGDX項目

// 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

我發現這個問題的解決方案是刪除我的項目裏面的android/build目錄一共,在文件菜單中的「Invalidate Cache/Restart ...」之前。我已經嘗試了幾次該菜單選項,而不刪除android/build目錄,它沒有任何區別。

儘管啓用了「清理項目重建」複選框,但重建項目並不起作用,所以似乎有時要在IntelliJ Idea中獲得一個乾淨的項目,您必須自己完成。

相關問題