FileNotFoundException on proguard-rules.pro file

前端 未结 6 1239
逝去的感伤
逝去的感伤 2021-01-17 19:05

I\'m using Android Studio v.1.0 My build file :

  buildTypes {

    debug {
        minifyEnabled false
        proguardFiles getDefaultProguardFile(\'prog         


        
6条回答
  •  悲&欢浪女
    2021-01-17 19:50

    If you don't need any specific ProGuard configuration:

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

    (The warning might happened)

    Or specify "rules" and put it here:

    .../app/proguard-rules.pro
    

    For example I use "Butter Knife" and my proguard-rules.pro looks like:

    -keep class butterknife.** { *; }
    -dontwarn butterknife.internal.**
    -keep class **$$ViewInjector { *; }
    
    -keepclasseswithmembernames class * {
        @butterknife.* ;
    }
    
    -keepclasseswithmembernames class * {
        @butterknife.* ;
    }
    

    Or, possibly you can leave build.gradle file as it is (if you don't like warnings )), And just put an empty proguard-rules.pro to that location.

提交回复
热议问题