【问题标题】:Where to find the warning of `Warnings found during shrinking`?在哪里可以找到`Warnings found during shrinking`的警告?
【发布时间】:2017-06-06 12:11:26
【问题描述】:

将 RxAndroid 和 Retrofit 库添加到我的 gradle 并编译后,我收到以下错误,显示在我的 Android Studio 消息面板中。

Error:Execution failed for task 
':app:transformClassesWithNewClassShrinkerForProductionDebug'.
> Warnings found during shrinking, please use -dontwarn or -ignorewarnings to suppress them.

在我的调试中,我使用

        minifyEnabled true
        useProguard false

我相信我可以使用-dontwarn 或ignorewarnings 来抑制并让编译继续。但我想知道那是什么警告。我在哪里可以找到警告?

【问题讨论】:

    标签: android android-studio gradle proguard android-proguard


    【解决方案1】:

    找到了。只需打开Gradle Console(通常是右下角的选项卡)即可查看Gradle Log。

    据说

    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task 
    ':app:transformClassesWithNewClassShrinkerForProductionDebug'.
    > Warnings found during shrinking, please use -dontwarn or -ignorewarnings to suppress them.
    
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
    

    或者,我可能只需要使用--debug 选项在命令行上运行gradlew。

    ./gradlew :app:transformClassesWithNewClassShrinkerForInternalDebug --debug
    

    【讨论】:

      【解决方案2】:

      就像默认收缩器已更改。添加配置以打开 ProGuard 开始工作。

      buildTypes {
          release {
              debuggable false
              minifyEnabled true
              useProguard true
              getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
          }
          debug {
              debuggable true
              minifyEnabled true
              useProguard true
              getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
          }
      }
      

      【讨论】:

        猜你喜欢
        • 2011-09-28
        • 1970-01-01
        • 1970-01-01
        • 2012-07-31
        • 2018-03-13
        • 2018-11-13
        • 2021-12-02
        • 1970-01-01
        • 2012-11-30
        相关资源
        最近更新 更多