Android Proguard - Internet connectivity issue after exporting application - android

I am currently exporting application while proguard is enabled and the issue is that the application works fine but application is deployed without proguard but if exported and deployed while proguard is enabled the application gives error that internet is not connected. following is the proguard file text
-dontshrink
-dontoptimize
-dontwarn com.example.google.tv.**
-dontwarn android.support.**
-dontwarn org.ksoap.**
-dontwarn android.view.**
-dontwarn android.graphics.**
-dontwarn android.content.**
-dontwarn android.util.**
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
#-libraryjars libs/ksoap2-android-assembly-2.5.2-jar-with-dependencies.jar
#-libraryjars libs/android-support-v4.jar
If I remove
-dontwarn android.view.**
-dontwarn android.graphics.**
-dontwarn android.content.**
-dontwarn android.util.**
then here is the log that I receive
[2013-08-02 10:29:04 - Project] Proguard returned with error code 1. See console
[2013-08-02 10:29:04 - Project] Note: there were 4 duplicate class definitions.
[2013-08-02 10:29:04 - Project] Warning: library class android.content.res.XmlResourceParser extends or implements program class org.xmlpull.v1.XmlPullParser
[2013-08-02 10:29:04 - Project] Warning: library class android.content.Intent depends on program class org.xmlpull.v1.XmlPullParser
[2013-08-02 10:29:04 - Project] Warning: library class android.content.IntentFilter depends on program class org.xmlpull.v1.XmlSerializer
[2013-08-02 10:29:04 - Project] Warning: library class android.content.IntentFilter depends on program class org.xmlpull.v1.XmlPullParser
[2013-08-02 10:29:04 - Project] Warning: library class android.content.res.ColorStateList depends on program class org.xmlpull.v1.XmlPullParser
[2013-08-02 10:29:04 - Project] Warning: library class android.graphics.drawable.BitmapDrawable depends on program class org.xmlpull.v1.XmlPullParser
[2013-08-02 10:29:04 - Project] Warning: library class android.graphics.drawable.ColorDrawable depends on program class org.xmlpull.v1.XmlPullParser
[2013-08-02 10:29:04 - Project] Warning: library class android.graphics.drawable.Drawable depends on program class org.xmlpull.v1.XmlPullParser
[2013-08-02 10:29:04 - Project] Warning: library class android.graphics.drawable.Drawable depends on program class org.xmlpull.v1.XmlPullParser
[2013-08-02 10:29:04 - Project] Warning: library class android.graphics.drawable.Drawable depends on program class org.xmlpull.v1.XmlPullParser
[2013-08-02 10:29:04 - Project] Warning: library class android.graphics.drawable.LayerDrawable depends on program class org.xmlpull.v1.XmlPullParser
[2013-08-02 10:29:04 - Project] Warning: library class android.view.LayoutInflater depends on program class org.xmlpull.v1.XmlPullParser
[2013-08-02 10:29:04 - Project] Warning: library class android.view.LayoutInflater depends on program class org.xmlpull.v1.XmlPullParser
[2013-08-02 10:29:04 - Project] You should check if you need to specify additional program jars.
[2013-08-02 10:29:04 - Project] Warning: there were 13 instances of library classes depending on program classes.
[2013-08-02 10:29:04 - Project] You must avoid such dependencies, since the program classes will
[2013-08-02 10:29:04 - Project] be processed, while the library classes will remain unchanged.
[2013-08-02 10:29:04 - Project] java.io.IOException: Please correct the above warnings first.
[2013-08-02 10:29:04 - Project] at proguard.Initializer.execute(Initializer.java:321)
[2013-08-02 10:29:04 - Project] at proguard.ProGuard.initialize(ProGuard.java:211)
[2013-08-02 10:29:04 - Project] at proguard.ProGuard.execute(ProGuard.java:86)
[2013-08-02 10:29:04 - Project] at proguard.ProGuard.main(ProGuard.java:492)

You should remove the package org.xmlpull.v1 from your libraries. It is already present in the Android runtime (which gets precedence anyway). Adding duplicate packages increases the application size at best, and it can cause versioning problems at worst. In this case, ProGuard detects some dependency conflicts.
Note that is "ProGuard", not "Progaurd".

Related

Warning: com.google.android.gms.internal.zzig: can't find referenced class android.security.NetworkSecurityPolicy

I'm exporting android application (in Eclipse) and get the following error:
[2016-07-31 09:21:57 - EnglishPhonics] Proguard returned with error code 1. See console
[2016-07-31 09:21:57 - EnglishPhonics] Warning: com.google.android.gms.internal.zzig: can't find referenced class android.security.NetworkSecurityPolicy
[2016-07-31 09:21:57 - EnglishPhonics] Warning: com.google.android.gms.internal.zzig: can't find referenced class android.security.NetworkSecurityPolicy
[2016-07-31 09:21:57 - EnglishPhonics] Warning: com.google.android.gms.internal.zzig: can't find referenced class android.security.NetworkSecurityPolicy
[2016-07-31 09:21:57 - EnglishPhonics] You should check if you need to specify additional program jars.
[2016-07-31 09:21:57 - EnglishPhonics] Warning: there were 3 unresolved references to classes or interfaces.
[2016-07-31 09:21:57 - EnglishPhonics] You may need to specify additional library jars (using '-libraryjars').
[2016-07-31 09:21:57 - EnglishPhonics] java.io.IOException: Please correct the above warnings first.
[2016-07-31 09:21:57 - EnglishPhonics] at proguard.Initializer.execute(Initializer.java:321)
[2016-07-31 09:21:57 - EnglishPhonics] at proguard.ProGuard.initialize(ProGuard.java:211)
[2016-07-31 09:21:57 - EnglishPhonics] at proguard.ProGuard.execute(ProGuard.java:86)
[2016-07-31 09:21:57 - EnglishPhonics] at proguard.ProGuard.main(ProGuard.java:492)
I'm using Google Billing service with lastest version. Does anyone know how to solve this problem?

Android: Proguard error in eclipse

I am trying to built the signed apk of my app. But i am getting the error pop up as
Proguard returned with error code 1. See console
And error log in console as :
[2016-04-15 11:36:44 - MyApp] Proguard returned with error code 1. See console
[2016-04-15 11:36:44 - MyApp] Note: there were 85 duplicate class definitions.
[2016-04-15 11:36:44 - MyApp] Warning: org.acra.ErrorReporter: can't find referenced method 'void setLatestEventInfo(android.content.Context,java.lang.CharSequence,java.lang.CharSequence,android.app.PendingIntent)' in class android.app.Notification
[2016-04-15 11:36:44 - MyApp] You should check if you need to specify additional program jars.
[2016-04-15 11:36:44 - MyApp] Warning: there were 1 unresolved references to program class members.
[2016-04-15 11:36:44 - MyApp] Your input classes appear to be inconsistent.
[2016-04-15 11:36:44 - MyApp] You may need to recompile them and try again.
[2016-04-15 11:36:44 - MyApp] Alternatively, you may have to specify the option
[2016-04-15 11:36:44 - MyApp] '-dontskipnonpubliclibraryclassmembers'.
[2016-04-15 11:36:44 - MyApp] java.io.IOException: Please correct the above warnings first.
[2016-04-15 11:36:44 - MyApp] at proguard.Initializer.execute(Initializer.java:321)
[2016-04-15 11:36:44 - MyApp] at proguard.ProGuard.initialize(ProGuard.java:211)
[2016-04-15 11:36:44 - MyApp] at proguard.ProGuard.execute(ProGuard.java:86)
[2016-04-15 11:36:44 - MyApp] at proguard.ProGuard.main(ProGuard.java:492)
I am not able to understand what is the issue. For last version it works fine. I just provide support to Marsh Mellow in this version.
Please suggest me what changes or steps to perform to built signed apk with out Proguard error.
Try to add this to Proguard configuration file:
-keep class org.apache.http.** { *; }
-dontwarn org.apache.http.**
-dontwarn android.net.**

Android Proguard error with Google Drive API

I stated using Google Drive API in my project.. Every thing works fine if i run the project on phone using the debug keystore.
when i try to create a signed APK, proguard throws me the following error
[2013-10-07 12:59:01 - My Project] Proguard returned with error code 1. See console
[2013-10-07 12:59:01 - My Project] Proguard returned with error code 1. See console
[2013-10-07 12:59:01 - My Project] Warning: org.apache.harmony.awt.datatransfer.DataProxy: can't find superclass or interface java.awt.datatransfer.Transferable
[2013-10-07 12:59:01 - My Project] Warning: org.apache.harmony.awt.datatransfer.NativeClipboard: can't find superclass or interface java.awt.datatransfer.Clipboard
[2013-10-07 12:59:01 - My Project] Warning: javax.activation.CommandInfo: can't find referenced class java.beans.Beans
[2013-10-07 12:59:01 - My Project] Warning: javax.activation.CommandInfo: can't find referenced class java.beans.Beans
[2013-10-07 12:59:01 - My Project] Warning: org.apache.harmony.awt.ContextStorage: can't find referenced class java.awt.Toolkit
[2013-10-07 12:59:01 - My Project] Warning: org.apache.harmony.awt.ContextStorage: can't find referenced class java.awt.GraphicsEnvironment
[2013-10-07 12:59:01 - My Project] Warning: org.apache.harmony.awt.ContextStorage: can't find referenced class java.awt.GraphicsEnvironment
[2013-10-07 12:59:01 - My Project] Warning: org.apache.harmony.awt.datatransfer.DTK: can't find referenced class java.awt.datatransfer.DataFlavor
[2013-10-07 12:59:01 - My Project] Warning: org.apache.harmony.awt.datatransfer.DTK: can't find referenced class java.awt.datatransfer.SystemFlavorMap
[2013-10-07 12:59:01 - My Project] Warning: org.apache.harmony.awt.datatransfer.DTK: can't find referenced class java.awt.datatransfer.SystemFlavorMap
[2013-10-07 12:59:01 - My Project] Warning: org.apache.harmony.awt.datatransfer.TextFlavor: can't find referenced class java.awt.datatransfer.DataFlavor
[2013-10-07 12:59:01 - My Project] Warning: org.apache.harmony.awt.datatransfer.TextFlavor: can't find referenced class java.awt.datatransfer.DataFlavor
[2013-10-07 12:59:01 - My Project] Warning: org.apache.harmony.awt.datatransfer.TextFlavor: can't find referenced class java.awt.datatransfer.SystemFlavorMap
[2013-10-07 12:59:01 - My Project] Warning: org.apache.harmony.awt.datatransfer.TextFlavor: can't find referenced class java.awt.datatransfer.SystemFlavorMap
[2013-10-07 12:59:01 - My Project] Warning: org.apache.harmony.awt.datatransfer.TextFlavor: can't find referenced class java.awt.datatransfer.SystemFlavorMap
[2013-10-07 12:59:01 - My Project] Warning: org.apache.harmony.awt.datatransfer.TextFlavor: can't find referenced class java.awt.datatransfer.SystemFlavorMap
[2013-10-07 12:59:01 - My Project] Warning: org.apache.harmony.awt.datatransfer.TextFlavor: can't find referenced class java.awt.datatransfer.SystemFlavorMap
[2013-10-07 12:59:01 - My Project] Warning: org.apache.harmony.awt.datatransfer.TextFlavor: can't find referenced class java.awt.datatransfer.DataFlavor
[2013-10-07 12:59:01 - My Project] Warning: org.apache.harmony.awt.datatransfer.TextFlavor: can't find referenced class java.awt.datatransfer.SystemFlavorMap
[2013-10-07 12:59:01 - My Project] Warning: org.apache.harmony.awt.datatransfer.TextFlavor: can't find referenced class java.awt.datatransfer.SystemFlavorMap
[2013-10-07 12:59:01 - My Project] Warning: org.apache.harmony.awt.datatransfer.TextFlavor: can't find referenced class java.awt.datatransfer.DataFlavor
[2013-10-07 12:59:01 - My Project] You should check if you need to specify additional program jars.
[2013-10-07 12:59:01 - My Project] Warning: there were 224 unresolved references to classes or interfaces.
[2013-10-07 12:59:01 - My Project] You may need to specify additional library jars (using '-libraryjars').
[2013-10-07 12:59:01 - My Project] java.io.IOException: Please correct the above warnings first.
[2013-10-07 12:59:01 - My Project] at proguard.Initializer.execute(Initializer.java:321)
[2013-10-07 12:59:01 - My Project] at proguard.ProGuard.initialize(ProGuard.java:211)
[2013-10-07 12:59:01 - My Project] at proguard.ProGuard.execute(ProGuard.java:86)
[2013-10-07 12:59:01 - My Project] at proguard.ProGuard.main(ProGuard.java:492)
I also tried adding the following into proguard-project.txt
-dontwarn org.apache.harmony.**
-dontwarn javax.activation.**
If I add the above, APK is created, but the APP crashes on launch
can anyone please help me!
You're referencing classes that aren't part of the Android runtime. Either remove the classes referencing them, or if you just want to suppress the warnings, try adding
-dontwarn java.awt.**,java.beans.** to your proguard config.
Additional info in the ProGuard Troubleshooting Guide.

Proguard error, can't export app

[2013-01-25 15:20:55 - CQAQI] Proguard returned with error code 1. See console
[2013-01-25 15:20:55 - CQAQI] Note: there were 208 duplicate class definitions.
[2013-01-25 15:20:55 - CQAQI] Warning: android.support.v4.view.ViewCompatJellybeanMr1: can't find referenced method 'int getLabelFor()' in class android.view.View
[2013-01-25 15:20:55 - CQAQI] Warning: android.support.v4.view.ViewCompatJellybeanMr1: can't find referenced method 'void setLabelFor(int)' in class android.view.View
[2013-01-25 15:20:55 - CQAQI] Warning: there were 2 unresolved references to program class members.
[2013-01-25 15:20:55 - CQAQI] Your input classes appear to be inconsistent.
[2013-01-25 15:20:55 - CQAQI] You may need to recompile them and try again.
[2013-01-25 15:20:55 - CQAQI] Alternatively, you may have to specify the option
[2013-01-25 15:20:55 - CQAQI] '-dontskipnonpubliclibraryclassmembers'.
[2013-01-25 15:20:55 - CQAQI] Error: Please correct the above warnings first.
When I export app I get an error, even after updating to Proguard 4.8. What can I do?
try this:
-dontwarn android.support.v4.view.**
-keep class android.support.v4.** { *; }
I had the same error.
Building with SDK level 4.2.2 worked for me!

Getting error while generating the .apk file if proguard is ON

I am using proguard to obfuscate the code.
I am getting the following error in console
Proguard returned with error code 1. See console
Warning: org.apache.cordova.CameraLauncher: can't find referenced class org.apache.commons.codec.binary.Base64
Warning: org.apache.cordova.CameraLauncher: can't find referenced class org.apache.commons.codec.binary.Base64
Warning: org.apache.cordova.CordovaWebView: can't find referenced method 'WebView(android.content.Context,android.util.AttributeSet,int,boolean)' in class android.webkit.WebView
Warning: org.apache.cordova.CordovaWebViewClient: can't find referenced method 'android.webkit.WebResourceResponse shouldInterceptRequest(android.webkit.WebView,java.lang.String)' in class android.webkit.WebViewClient
Warning: org.apache.cordova.CordovaWebViewClient: can't find referenced class android.webkit.WebResourceResponse
Warning: org.apache.cordova.CordovaWebViewClient: can't find referenced class android.webkit.WebResourceResponse
Warning: org.apache.cordova.CordovaWebViewClient: can't find referenced class android.webkit.WebResourceResponse
Warning: org.apache.cordova.CordovaWebViewClient: can't find referenced class android.webkit.WebResourceResponse
Warning: org.apache.cordova.CordovaWebViewClient: can't find referenced class android.webkit.WebResourceResponse
Warning: org.apache.cordova.FileUtils: can't find referenced class org.apache.commons.codec.binary.Base64
Warning: org.apache.cordova.FileUtils: can't find referenced class org.apache.commons.codec.binary.Base64
Warning: there were 9 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)
My project.properties file is here
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
proguard.config=~/Desktop/Android/android-sdk-macosx/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-10
My proguard-project.txt is here
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# 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 *;
#}
How to solve this?
I fixed it by adding this in my proguard-project.txt
-keep public class * extends com.phonegap.api.Plugin
-keep public class org.apache.cordova.DroidGap
-keep public class org.apache.cordova.**
-libraryjars /Users/Nasir/Desktop/libs/commons-codec.jar
-dontwarn android.webkit.*
You can add the following to your proguard-project.txt. It worked for me on Cordova (PhoneGap) 2.1:
-keep public class * extends com.phonegap.api.Plugin
-keep public class * extends org.apache.cordova.api.Plugin
-keep public class org.apache.cordova.DroidGap
-keep public class org.apache.cordova.**
-libraryjars libs/commons-codec-1.7.jar
-dontwarn android.webkit.*
-dontwarn org.apache.**

Categories

Resources