【问题标题】:Note: the configuration keeps the entry point `XXX`, but not the descriptor class 'xxx' in Android Studio注意:配置保留入口点 `XXX`,但不保留 Android Studio 中的描述符类 'xxx'
【发布时间】:2015-08-04 12:11:34
【问题描述】:

在 Android Studio v1.1.0 中启用minifyEnabled 时出现以下错误

班级是:

package com.example.FFmpegBridge;
public class FFmpegBridge {
    static {
        System.loadLibrary("xxx");
    }

    public native void init(AVOptions options, int audio) throws IOException;

    static public class AVOptions {


    }
}

proguard-rules.pro 是默认的:

# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/jerikc/Library/Android/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# 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 *;
#}

错误是:

19:55:06.080 [INFO] [system.out] Note: the configuration keeps the entry point 'com.example.FFmpegBridge { void init(com.example.FFmpegBridge$AVOptions,int); }', but not the descriptor class 'com.example.FFmpegBridge$AVOptions'
19:55:06.086 [INFO] [system.out] Note: there were 2 references to unknown classes.
19:55:06.086 [INFO] [system.out]       You should check your configuration for typos.
19:55:06.086 [INFO] [system.out]       (http://proguard.sourceforge.net/manual/troubleshooting.html#unknownclass)
19:55:06.086 [INFO] [system.out] Note: there were 1 unkept descriptor classes in kept class members.
19:55:06.087 [INFO] [system.out]       You should consider explicitly keeping the mentioned classes
19:55:06.087 [INFO] [system.out]       (using '-keep').
19:55:06.088 [INFO] [system.out]       (http://proguard.sourceforge.net/manual/troubleshooting.html#descriptorclass)
19:55:06.088 [INFO] [system.out] Ignoring unused library classes...
19:55:06.088 [INFO] [system.out]   Original number of library classes: 3686
19:55:06.089 [INFO] [system.out]   Final number of library classes:    326
19:55:06.089 [INFO] [system.out] Printing kept classes, fields, and methods...
19:55:06.125 [INFO] [system.out] Shrinking...
19:55:06.313 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':library:proguardRelease'
19:55:06.313 [LIFECYCLE] [class org.gradle.TaskExecutionLogger] :library:proguardRelease FAILED
19:55:06.313 [INFO] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] :library:proguardRelease (Thread[main,5,main]) completed. Took 1.17 secs.
19:55:06.314 [DEBUG] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] Task worker [Thread[main,5,main]] finished, busy: 1.763 secs, idle: 0.013 secs
19:55:06.328 [ERROR] [org.gradle.BuildExceptionReporter] 
19:55:06.328 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
19:55:06.329 [ERROR] [org.gradle.BuildExceptionReporter] 
19:55:06.329 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
19:55:06.329 [ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ':library:proguardRelease'.
19:55:06.329 [ERROR] [org.gradle.BuildExceptionReporter] > java.io.IOException: The output jar is empty. Did you specify the proper '-keep' options?
19:55:06.329 [ERROR] [org.gradle.BuildExceptionReporter] 
19:55:06.329 [ERROR] [org.gradle.BuildExceptionReporter] * Try:
19:55:06.330 [ERROR] [org.gradle.BuildExceptionReporter] Run with --stacktrace option to get the stack trace. 
19:55:06.331 [LIFECYCLE] [org.gradle.BuildResultLogger] 
19:55:06.331 [LIFECYCLE] [org.gradle.BuildResultLogger] BUILD FAILED
19:55:06.331 [LIFECYCLE] [org.gradle.BuildResultLogger] 
19:55:06.331 [LIFECYCLE] [org.gradle.BuildResultLogger] Total time: 12.014 secs

如何解决编译错误?

【问题讨论】:

    标签: android android-studio android-proguard


    【解决方案1】:

    你可能忘记保护你的proguard-rules.pro中的一些包

    例如,如果您的aidl 文件夹中有IPackageDataObserver.aidl android\content\pm。你应该添加

    -不要警告 android.content.pm**
    -keep class android.content.pm.** { *;}

    到您的proguard-rules.pro 文件

    【讨论】:

      猜你喜欢
      • 2016-12-28
      • 2014-04-10
      • 2023-03-25
      • 2020-08-26
      • 1970-01-01
      • 1970-01-01
      • 2014-03-30
      • 1970-01-01
      • 2020-12-10
      相关资源
      最近更新 更多