Proguard警告已删除的类



我在Android Studio中使用proguard来混淆我的代码。我已经从我的项目中删除了许多类,并且没有使用它们,但是proguard警告我这些删除的类。如果我不使用proguard,应用程序可以正常编译。

我尝试了Invalidate Caches/Restart选项,但没有效果。

以下是警告:

Warning: com.mypack.myapp.FaceServiceClient$1: can't find superclass or interface com.google.gson.reflect.TypeToken
Warning: com.mypack.myapp.FaceServiceClient$2: can't find superclass or interface com.google.gson.reflect.TypeToken
Warning: com.mypack.myapp.FaceServiceClient$3: can't find superclass or interface com.google.gson.reflect.TypeToken
Warning: com.mypack.myapp.FaceServiceClient$4: can't find superclass or interface com.google.gson.reflect.TypeToken
Warning: com.mypack.myapp.FaceServiceClient$5: can't find superclass or interface com.google.gson.reflect.TypeToken
Warning: com.mypack.myapp.FaceServiceClient$6: can't find superclass or interface com.google.gson.reflect.TypeToken
Warning: com.mypack.myapp.FaceServiceClient$7: can't find superclass or interface com.google.gson.reflect.TypeToken
Warning: com.mypack.myapp.AddFaceToPersonActivity$1: can't find referenced class com.mypack.myapp.AddFaceToPersonActivity
Warning: com.mypack.myapp.AddFaceToPersonActivity$1: can't find referenced class com.mypack.myapp.AddFaceToPersonActivity
Warning: com.mypack.myapp.AddFaceToPersonActivity$AddFaceTask: can't find referenced class com.mypack.myapp.SampleApp
Warning: com.mypack.myapp.AddFaceToPersonActivity$AddFaceTask: can't find referenced class com.mypack.myapp.AddFaceToPersonActivity
Warning: com.mypack.myapp.AddFaceToPersonActivity$AddFaceTask: can't find referenced class com.mypack.myapp.AddFaceToPersonActivity
Warning: com.mypack.myapp.AddFaceToPersonActivity$AddFaceTask: can't find referenced class com.mypack.myapp.AddFaceToPersonActivity$FaceGridViewAdapter
Warning: com.mypack.myapp.AddFaceToPersonActivity$AddFaceTask: can't find referenced class com.mypack.myapp.AddFaceToPersonActivity
Warning: com.mypack.myapp.AddFaceToPersonActivity$AddFaceTask: can't find referenced class com.mypack.myapp.AddFaceToPersonActivity
Warning: com.mypack.myapp.AddFaceToPersonActivity$AddFaceTask: can't find referenced class com.mypack.myapp.AddFaceToPersonActivity
Warning: com.mypack.myapp.AddFaceToPersonActivity$AddFaceTask: can't find referenced class com.mypack.myapp.AddFaceToPersonActivity
Warning: com.mypack.myapp.AddFaceToPersonActivity$AddFaceTask: can't find referenced class com.mypack.myapp.AddFaceToPersonActivity
Warning: com.mypack.myapp.AddFaceToPersonActivity$AddFaceTask: can't find referenced class com.mypack.myapp.SampleApp
Warning: com.mypack.myapp.AddFaceToPersonActivity$AddFaceTask: can't find referenced class com.mypack.myapp.AddFaceToPersonActivity
Warning: com.mypack.myapp.AddFaceToPersonActivity$AddFaceTask: can't find referenced class com.mypack.myapp.AddFaceToPersonActivity$FaceGridViewAdapter
Warning: com.mypack.myapp.AddFaceToPersonActivity$AddFaceTask: can't find referenced class com.mypack.myapp.AddFaceToPersonActivity
Warning: com.mypack.myapp.AddFaceToPersonActivity$AddFaceTask: can't find referenced class com.mypack.myapp.AddFaceToPersonActivity
Warning: com.mypack.myapp.AddFaceToPersonActivity$DetectionTask: can't find referenced class com.mypack.myapp.SampleApp
Warning: com.mypack.myapp.AddFaceToPersonActivity$DetectionTask: can't find referenced class com.mypack.myapp.AddFaceToPersonActivity
Warning: com.mypack.myapp.AddFaceToPersonActivity$DetectionTask: can't find referenced class com.mypack.myapp.AddFaceToPersonActivity
Warning: com.mypack.myapp.AddFaceToPersonActivity$DetectionTask: can't find referenced class com.mypack.myapp.AddFaceToPersonActivity
Warning: com.mypack.myapp.AddFaceToPersonActivity$DetectionTask: can't find referenced class com.mypack.myapp.AddFaceToPersonActivity
Warning: com.mypack.myapp.AddFaceToPersonActivity$DetectionTask: can't find referenced class com.mypack.myapp.AddFaceToPersonActivity
Warning: com.mypack.myapp.AddFaceToPersonActivity$DetectionTask: can't find referenced class com.mypack.myapp.SampleApp
Warning: com.mypack.myapp.AddFaceToPersonActivity$DetectionTask: can't find referenced class com.mypack.myapp.AddFaceToPersonActivity
Warning: com.mypack.myapp.AddFaceToPersonActivity$DetectionTask: can't find referenced class com.mypack.myapp.AddFaceToPersonActivity
Warning: com.mypack.myapp.AddFaceToPersonActivity$DetectionTask: can't find referenced class com.mypack.myapp.AddFaceToPersonActivity
Warning: com.mypack.myapp.AddFaceToPersonActivity$DetectionTask: can't find referenced class com.mypack.myapp.AddFaceToPersonActivity
Warning: com.mypack.myapp.AddFaceToPersonActivity$DetectionTask: can't find referenced class com.mypack.myapp.AddFaceToPersonActivity
Warning: com.mypack.myapp.AddFaceToPersonActivity$FaceGridViewAdapter$1: can't find referenced class com.mypack.myapp.AddFaceToPersonActivity$FaceGridViewAdapter
Warning: com.mypack.myapp.AddFaceToPersonActivity$FaceGridViewAdapter$1: can't find referenced class com.mypack.myapp.AddFaceToPersonActivity$FaceGridViewAdapter
Warning: com.mypack.myapp.AddFaceToPersonActivity$FaceGridViewAdapter$1: can't find referenced class com.mypack.myapp.AddFaceToPersonActivity
Warning: com.mypack.myapp.AddFaceToPersonActivity$FaceGridViewAdapter$1: can't find referenced class com.mypack.myapp.AddFaceToPersonActivity$FaceGridViewAdapter
Warning: com.mypack.myapp.AddFaceToPersonActivity$FaceGridViewAdapter$1: can't find referenced class com.mypack.myapp.AddFaceToPersonActivity$FaceGridViewAdapter
Warning: com.mypack.myapp.AddFaceToPersonActivity$FaceGridViewAdapter$1: can't find referenced class com.mypack.myapp.AddFaceToPersonActivity$FaceGridViewAdapter
Warning: com.mypack.myapp.FaceServiceClient: can't find referenced class com.google.gson.Gson
Warning: com.mypack.myapp.FaceServiceClient: can't find referenced class com.google.gson.Gson
Warning: com.mypack.myapp.FaceServiceClient: can't find referenced method 'java.lang.reflect.Type getType()' in program class com.mypack.myapp.FaceServiceClient$1
Warning: com.mypack.myapp.FaceServiceClient: can't find referenced class com.google.gson.Gson
Warning: com.mypack.myapp.FaceServiceClient: can't find referenced method 'java.lang.reflect.Type getType()' in program class com.mypack.myapp.FaceServiceClient$2
Warning: com.mypack.myapp.FaceServiceClient: can't find referenced method 'java.lang.reflect.Type getType()' in program class com.mypack.myapp.FaceServiceClient$3
Warning: com.mypack.myapp.FaceServiceClient: can't find referenced method 'java.lang.reflect.Type getType()' in program class com.mypack.myapp.FaceServiceClient$4
Warning: com.mypack.myapp.FaceServiceClient: can't find referenced class com.google.gson.Gson
Warning: com.mypack.myapp.FaceServiceClient: can't find referenced method 'java.lang.reflect.Type getType()' in program class com.mypack.myapp.FaceServiceClient$5
Warning: com.mypack.myapp.FaceServiceClient: can't find referenced method 'java.lang.reflect.Type getType()' in program class com.mypack.myapp.FaceServiceClient$6
Warning: com.mypack.myapp.FaceServiceClient: can't find referenced method 'java.lang.reflect.Type getType()' in program class com.mypack.myapp.FaceServiceClient$7
Warning: com.mypack.myapp.FaceServiceClient: can't find referenced class com.google.gson.Gson
Warning: com.mypack.myapp.FaceServiceClient$1: can't find referenced class com.google.gson.reflect.TypeToken
Warning: com.mypack.myapp.FaceServiceClient$1: can't find referenced class com.google.gson.reflect.TypeToken
Warning: com.mypack.myapp.FaceServiceClient$1: can't find referenced class com.google.gson.reflect.TypeToken
Warning: com.mypack.myapp.FaceServiceClient$2: can't find referenced class com.google.gson.reflect.TypeToken
Warning: com.mypack.myapp.FaceServiceClient$2: can't find referenced class com.google.gson.reflect.TypeToken
Warning: com.mypack.myapp.FaceServiceClient$2: can't find referenced class com.google.gson.reflect.TypeToken
Warning: com.mypack.myapp.FaceServiceClient$3: can't find referenced class com.google.gson.reflect.TypeToken
Warning: com.mypack.myapp.FaceServiceClient$3: can't find referenced class com.google.gson.reflect.TypeToken
Warning: com.mypack.myapp.FaceServiceClient$3: can't find referenced class com.google.gson.reflect.TypeToken
Warning: com.mypack.myapp.FaceServiceClient$4: can't find referenced class com.google.gson.reflect.TypeToken
Warning: com.mypack.myapp.FaceServiceClient$4: can't find referenced class com.google.gson.reflect.TypeToken
Warning: com.mypack.myapp.FaceServiceClient$4: can't find referenced class com.google.gson.reflect.TypeToken
Warning: com.mypack.myapp.FaceServiceClient$5: can't find referenced class com.google.gson.reflect.TypeToken
Warning: com.mypack.myapp.FaceServiceClient$5: can't find referenced class com.google.gson.reflect.TypeToken
Warning: com.mypack.myapp.FaceServiceClient$5: can't find referenced class com.google.gson.reflect.TypeToken
Warning: com.mypack.myapp.FaceServiceClient$6: can't find referenced class com.google.gson.reflect.TypeToken
Warning: com.mypack.myapp.FaceServiceClient$6: can't find referenced class com.google.gson.reflect.TypeToken
Warning: com.mypack.myapp.FaceServiceClient$6: can't find referenced class com.google.gson.reflect.TypeToken
Warning: com.mypack.myapp.FaceServiceClient$7: can't find referenced class com.google.gson.reflect.TypeToken
Warning: com.mypack.myapp.FaceServiceClient$7: can't find referenced class com.google.gson.reflect.TypeToken
Warning: com.mypack.myapp.FaceServiceClient$7: can't find referenced class com.google.gson.reflect.TypeToken
Warning: com.mypack.myapp.WebServiceRequest: can't find referenced class com.google.gson.Gson
Warning: com.mypack.myapp.WebServiceRequest: can't find referenced class com.google.gson.Gson
Warning: com.mypack.myapp.WebServiceRequest: can't find referenced class com.mypack.myapp.ServiceCallException
Warning: com.mypack.myapp.WebServiceRequest: can't find referenced class com.google.gson.Gson
Warning: com.mypack.myapp.WebServiceRequest: can't find referenced class com.mypack.myapp.ServiceCallException
Warning: com.mypack.myapp.WebServiceRequest: can't find referenced class com.mypack.myapp.ServiceCallException
Warning: com.mypack.myapp.WebServiceRequest: can't find referenced class com.mypack.myapp.ServiceCallException
Warning: com.mypack.myapp.WebServiceRequest: can't find referenced class com.mypack.myapp.ServiceCallException
Warning: com.mypack.myapp.WebServiceRequest: can't find referenced class com.mypack.myapp.ServiceCallException
Warning: com.mypack.myapp.WebServiceRequest: can't find referenced class com.mypack.myapp.ServiceCallException

build.gradleproguard相关部分:

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

这是proguard-rules.pro文件:

-verbose
-dontwarn android.support.**
-keep class -verbose
-dontwarn android.support.**
-keep class -verbose
-dontwarn android.support.**
-keep class com.mypack.myapp.R { 
*;
}
#below commands for including the line numbers in traces
-renamesourcefileattribute SourceFile    
-keepattributes SourceFile,LineNumberTable.R { 
*;
}

对于任何有相同问题的人,只需删除整个build文件夹即可解决问题。

相关内容

  • 没有找到相关文章

最新更新