Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/184.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android Google Play Services v23 Proguard配置_Android_Google Play Services_Proguard - Fatal编程技术网

Android Google Play Services v23 Proguard配置

Android Google Play Services v23 Proguard配置,android,google-play-services,proguard,Android,Google Play Services,Proguard,升级到Google Play services v23后,我在尝试在Eclipse中导出签名应用程序时看到以下消息: Proguard returned with error code 1. See console Warning: com.google.android.gms.common.GooglePlayServicesUtil: can't find referenced class android.content.pm.PackageInstaller Warning: com.go

升级到Google Play services v23后,我在尝试在Eclipse中导出签名应用程序时看到以下消息:

Proguard returned with error code 1. See console
Warning: com.google.android.gms.common.GooglePlayServicesUtil: can't find referenced class android.content.pm.PackageInstaller
Warning: com.google.android.gms.common.GooglePlayServicesUtil: can't find referenced class android.content.pm.PackageInstaller$SessionInfo
Warning: com.google.android.gms.common.GooglePlayServicesUtil: can't find referenced class android.content.pm.PackageInstaller
Warning: com.google.android.gms.common.GooglePlayServicesUtil: can't find referenced class android.content.pm.PackageInstaller$SessionInfo
Warning: com.google.android.gms.common.GooglePlayServicesUtil: can't find referenced method 'android.content.pm.PackageInstaller getPackageInstaller()' in class android.content.pm.PackageManager
Warning: com.google.android.gms.internal.zzif: can't find referenced method 'void setMixedContentMode(int)' in class android.webkit.WebSettings
      You should check if you need to specify additional program jars.
Warning: there were 4 unresolved references to classes or interfaces.
         You may need to specify additional library jars (using '-libraryjars').
Warning: there were 2 unresolved references to program class members.
         Your input classes appear to be inconsistent.
         You may need to recompile them and try again.
         Alternatively, you may have to specify the option 
         '-dontskipnonpubliclibraryclassmembers'.
java.io.IOException: Please correct the above warnings first.
    at proguard.Initializer.execute(Initializer.java:321)
    at proguard.ProGuard.initialize(ProGuard.java:211)
    at proguard.ProGuard.execute(ProGuard.java:86)
    at proguard.ProGuard.main(ProGuard.java:492)
我添加了这个,如中所述

并尝试添加

-keep class android.content.pm.PackageInstaller.**
proguard project.txt
,但这没有帮助


我遗漏了什么?

嘿,我犯了完全相同的错误,我通过添加:

-keep class com.google.android.gms.** { *; }
-dontwarn com.google.android.gms.**

对于我的proguard.cfg,我也有同样的问题,但使用的是Android Studio。基于Lary Ciminera的解决方案,我补充道

-dontwarn com.google.android.gms.**

到proguard project.txt。

我通过将此添加到proguard-project.txt来修复它:

-keep class android.content.pm.PackageInstaller
-keep class android.content.pm.PackageInstaller$SessionInfo
-keep class android.content.pm.PackageManager

-dontwarn android.content.pm.PackageInstaller
-dontwarn android.content.pm.PackageInstaller$SessionInfo
-dontwarn android.content.pm.PackageManager

-keep class android.webkit.WebSettings
-dontwarn android.webkit.WebSettings

将目标SDK版本升级到至少21应该可以解决此问题。PackageInstaller和相关的类被添加到API版本21中:

如何
-保留类android.content.pm.*
在谷歌官方文档中有一个关于使用Eclipse+ADT构建的部分,所以它也应该在那里工作。这难道不妨碍应用程序在android低于5.0的设备上使用吗?因为这相当于所有设备的3%。@LaryCiminera不,目标与minsdk版本不同;targetSdk可能会触发兼容模式。您应该将targetSdk设置为应用程序使用的最新版本。此解决方案对我有所帮助,但中的第二个建议使apk文件大小大大减小。我尝试过相同的方法,但现在build正在运行。Android studio没有生成apk。有人能帮忙吗?文档中说,没有必要为此手动添加proguard规则
-keep class android.content.pm.PackageInstaller
-keep class android.content.pm.PackageInstaller$SessionInfo
-keep class android.content.pm.PackageManager

-dontwarn android.content.pm.PackageInstaller
-dontwarn android.content.pm.PackageInstaller$SessionInfo
-dontwarn android.content.pm.PackageManager

-keep class android.webkit.WebSettings
-dontwarn android.webkit.WebSettings