安卓apk版本使用proguard失败

时间:2016-05-19 09:49:26

标签: android cordova android-proguard

我的APK在debug& amp;在我的测试设备上发布变体和安装,按预期工作,但是当签署APK for playstore版本时,它就可以到ProGuard部分并且抱怨Cordova XWalk插件。

> ProGuard, version 5.2.1
Reading input...
Reading program jar [/home/Evil_Wizard/Projects/Taxicode/App/Android/build/intermediates/exploded-aar/org.xwalk/xwalk_core_library/14.43.343.25/jars/classes.jar] (filtered)
Reading program jar [/home/Evil_Wizard/Projects/Taxicode/App/Android/build/intermediates/exploded-aar/Android/CordovaLib/unspecified/release/jars/classes.jar] (filtered)
Reading program directory [/home/Evil_Wizard/Projects/Taxicode/App/Android/build/intermediates/classes/armv7/release] (filtered)
Reading library jar [/home/Evil_Wizard/Android/Sdk/platforms/android-21/android.jar]
Initializing...
Warning: org.apache.cordova.CordovaInterfaceImpl: can't find referenced method 'void requestPermissions(java.lang.String[],int)' in library class android.app.Activity
Warning: org.apache.cordova.CordovaInterfaceImpl: can't find referenced method 'int checkSelfPermission(java.lang.String)' in library class android.app.Activity
Note: org.chromium.base.library_loader.Linker calls '(org.chromium.base.library_loader.Linker$TestRunner)Class.forName(variable).newInstance()'
Note: org.chromium.net.DefaultAndroidKeyStore: can't find dynamically referenced class org.apache.harmony.xnet.provider.jsse.OpenSSLRSAPrivateKey
Note: org.chromium.net.DefaultAndroidKeyStore: can't find dynamically referenced class org.apache.harmony.xnet.provider.jsse.OpenSSLEngine
Note: org.chromium.media.MediaPlayerBridge accesses a field 'PAUSE_AVAILABLE' dynamically
Note: org.chromium.media.MediaPlayerBridge accesses a field 'SEEK_FORWARD_AVAILABLE' dynamically
Note: org.chromium.media.MediaPlayerBridge accesses a field 'SEEK_BACKWARD_AVAILABLE' dynamically
Note: the configuration keeps the entry point 'org.chromium.base.library_loader.Linker { boolean nativeLoadLibrary(java.lang.String,long,org.chromium.base.library_loader.Linker$LibInfo); }', but not the descriptor class 'org.chromium.base.library_loader.Linker$LibInfo'
Note: the configuration keeps the entry point 'org.chromium.base.library_loader.Linker { boolean nativeLoadLibraryInZipFile(java.lang.String,java.lang.String,long,org.chromium.base.library_loader.Linker$LibInfo); }', but not the descriptor class 'org.chromium.base.library_loader.Linker$LibInfo'
Note: the configuration keeps the entry point 'org.chromium.base.library_loader.Linker { boolean nativeCreateSharedRelro(java.lang.String,long,org.chromium.base.library_loader.Linker$LibInfo); }', but not the descriptor class 'org.chromium.base.library_loader.Linker$LibInfo'
Note: the configuration keeps the entry point 'org.chromium.base.library_loader.Linker { boolean nativeUseSharedRelro(java.lang.String,org.chromium.base.library_loader.Linker$LibInfo); }', but not the descriptor class 'org.chromium.base.library_loader.Linker$LibInfo'
Note: the configuration keeps the entry point 'org.chromium.content.browser.ContentViewCore { long nativeInit(org.chromium.content_public.browser.WebContents,org.chromium.ui.base.ViewAndroid,long,java.util.HashSet); }', but not the descriptor class 'org.chromium.content_public.browser.WebContents'
Note: the configuration keeps the entry point 'org.chromium.content.browser.ContentViewCore { long nativeInit(org.chromium.content_public.browser.WebContents,org.chromium.ui.base.ViewAndroid,long,java.util.HashSet); }', but not the descriptor class 'org.chromium.ui.base.ViewAndroid'
Note: the configuration keeps the entry point 'org.chromium.content.browser.ContentViewCore { org.chromium.content.browser.ContentViewCore nativeFromWebContentsAndroid(org.chromium.content_public.browser.WebContents); }', but not the descriptor class 'org.chromium.content_public.browser.WebContents'
Note: the configuration keeps the entry point 'org.chromium.content.browser.MediaDrmCredentialManager { void nativeResetCredentials(org.chromium.content.browser.MediaDrmCredentialManager$MediaDrmCredentialManagerCallback); }', but not the descriptor class 'org.chromium.content.browser.MediaDrmCredentialManager$MediaDrmCredentialManagerCallback'
Note: the configuration keeps the entry point 'org.chromium.content.browser.ServiceRegistry { void nativeAddService(long,org.chromium.mojo.bindings.Interface$Manager,org.chromium.content.browser.ServiceRegistry$ImplementationFactory,java.lang.String); }', but not the descriptor class 'org.chromium.mojo.bindings.Interface$Manager'
Note: the configuration keeps the entry point 'org.chromium.content.browser.ServiceRegistry { void nativeAddService(long,org.chromium.mojo.bindings.Interface$Manager,org.chromium.content.browser.ServiceRegistry$ImplementationFactory,java.lang.String); }', but not the descriptor class 'org.chromium.content.browser.ServiceRegistry$ImplementationFactory'
Note: the configuration keeps the entry point 'org.chromium.content.browser.framehost.NavigationControllerImpl { void nativeGetDirectedNavigationHistory(long,org.chromium.content_public.browser.NavigationHistory,boolean,int); }', but not the descriptor class 'org.chromium.content_public.browser.NavigationHistory'
Note: the configuration keeps the entry point 'org.chromium.content.browser.webcontents.WebContentsImpl { void nativeEvaluateJavaScript(long,java.lang.String,org.chromium.content_public.browser.JavaScriptCallback); }', but not the descriptor class 'org.chromium.content_public.browser.JavaScriptCallback'
Note: the configuration keeps the entry point 'org.chromium.mojo.system.impl.CoreImpl { org.chromium.mojo.system.impl.CoreImpl$AsyncWaiterCancellableImpl nativeAsyncWait(int,int,long,org.chromium.mojo.system.AsyncWaiter$Callback); }', but not the descriptor class 'org.chromium.mojo.system.AsyncWaiter$Callback'
Note: the configuration keeps the entry point 'org.xwalk.core.internal.XWalkContent { void nativeSetJavaPeers(long,org.xwalk.core.internal.XWalkContent,org.xwalk.core.internal.XWalkWebContentsDelegateAdapter,org.xwalk.core.internal.XWalkContentsClientBridge,org.xwalk.core.internal.XWalkContentsIoThreadClient,org.chromium.components.navigation_interception.InterceptNavigationDelegate); }', but not the descriptor class 'org.xwalk.core.internal.XWalkWebContentsDelegateAdapter'
Note: the configuration keeps the entry point 'org.xwalk.core.internal.XWalkContent { void nativeSetJavaPeers(long,org.xwalk.core.internal.XWalkContent,org.xwalk.core.internal.XWalkWebContentsDelegateAdapter,org.xwalk.core.internal.XWalkContentsClientBridge,org.xwalk.core.internal.XWalkContentsIoThreadClient,org.chromium.components.navigation_interception.InterceptNavigationDelegate); }', but not the descriptor class 'org.xwalk.core.internal.XWalkContentsIoThreadClient'
Note: the configuration keeps the entry point 'org.xwalk.core.internal.XWalkContent { void nativeSetJavaPeers(long,org.xwalk.core.internal.XWalkContent,org.xwalk.core.internal.XWalkWebContentsDelegateAdapter,org.xwalk.core.internal.XWalkContentsClientBridge,org.xwalk.core.internal.XWalkContentsIoThreadClient,org.chromium.components.navigation_interception.InterceptNavigationDelegate); }', but not the descriptor class 'org.chromium.components.navigation_interception.InterceptNavigationDelegate'
Note: the configuration keeps the entry point 'org.xwalk.core.internal.XWalkSettings { long nativeInit(org.chromium.content_public.browser.WebContents); }', but not the descriptor class 'org.chromium.content_public.browser.WebContents'
Note: there were 17 unkept descriptor classes in kept class members.
      You should consider explicitly keeping the mentioned classes
      (using '-keep').

>Note: there were 2 unresolved dynamic references to classes or interfaces.
      You should check if you need to specify additional program jars.

>Note: there were 1 class casts of dynamically created class instances.
      You might consider explicitly keeping the mentioned classes and/or
      their implementations (using '-keep').

>Note: there were 3 accesses to class members by means of introspection.
      You should consider explicitly keeping the mentioned class members
      (using '-keep' or '-keepclassmembers').

>Warning: there were 2 unresolved references to library class members.
         You probably need to update the library versions.

>Warning: Exception while processing task java.io.IOException: Please correct the above warnings first.
:transformClassesAndResourcesWithProguardForArmv7Release FAILED

>FAILURE: Build failed with an exception.

>*What went wrong:

>Execution failed for task  ':transformClassesAndResourcesWithProguardForArmv7Release'.
 java.io.IOException: Please correct the above warnings first.

>*Try:
>Run with --stacktrace option to get the stack trace. Run with --info or -
debug option to get more log output.

>BUILD FAILED

>Total time: 1 mins 31.84 secs

由于我是App开发的新手,我可以以某种方式禁用ProGuard,直到我知道如何使用/配置它?或者我是否需要使用更高版本的SDK版本重建这些数字设置的许多地方之一?

2 个答案:

答案 0 :(得分:0)

只是将ProGuard minifyEnabled标志设置为true导致问题。将标志设置为false允许将构建签名并释放到Playstore。我知道一旦我知道如何调试问题,我就会重新启用它。

  

的build.gradle

buildTypes { debug { debuggable true jniDebuggable false renderscriptDebuggable true zipAlignEnabled true } release { debuggable false jniDebuggable false renderscriptDebuggable false renderscriptOptimLevel 3 minifyEnabled false pseudoLocalesEnabled false zipAlignEnabled true } }

答案 1 :(得分:0)

android studio中的默认设置是仅在发布APK上运行proguard。 你可以在构建文件中更改它   buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro' } } 并且您还尝试在您的proguard规则-keep class !my.package.** { *; }中写入以保留所有库类