Obfuscate SMP libraries with Proguard for Android Applications

128 Views Asked by At

Recently I built an application for Android using SMP SDK - SAP technologies. For security reasons, I have to obfuscate all the code & jars for the developed application. I tried to obfuscate all the jars but I was having the below errors. Looking for best way to obfuscate the entire application in any other ways without/with using progaurd.

[2016-02-19 16:28:58 - SMP_Bank_Project] Warning: com.sap.mobile.lib.request.DBWrapper: can't find referenced class com.sap.mobile.lib.persistence.PersistenceManagerImpl
[2016-02-19 16:28:58 - SMP_Bank_Project] Warning: com.sap.mobile.lib.request.DBWrapper: can't find referenced class com.sap.mobile.lib.persistence.PersistenceManagerImpl
[2016-02-19 16:28:58 - SMP_Bank_Project] Warning: com.sap.mobile.lib.request.DBWrapper: can't find referenced class com.sap.mobile.lib.persistence.dao.model.RequestSchema
[2016-02-19 16:28:58 - SMP_Bank_Project] Warning: com.sap.mobile.lib.request.DBWrapper: can't find referenced class com.sap.mobile.lib.persistence.dao.model.RequestSchema
[2016-02-19 16:28:58 - SMP_Bank_Project] Warning: com.sap.mobile.lib.request.DBWrapper: can't find referenced class com.sap.mobile.lib.persistence.PersistenceManagerImpl
[2016-02-19 16:28:58 - SMP_Bank_Project] Warning: com.sap.mobile.lib.request.DBWrapper: can't find referenced class com.sap.mobile.lib.persistence.dao.model.RequestSchema
[2016-02-19 16:28:58 - SMP_Bank_Project] Warning: com.sap.mobile.lib.request.DBWrapper: can't find referenced class com.sap.mobile.lib.persistence.dao.model.RequestSchema
[2016-02-19 16:28:58 - SMP_Bank_Project] Warning: com.sap.mobile.lib.request.DBWrapper: can't find referenced class com.sap.mobile.lib.persistence.dao.model.RequestSchema
[2016-02-19 16:28:58 - SMP_Bank_Project] Warning: com.sap.mobile.lib.request.DBWrapper: can't find referenced class com.sap.mobile.lib.persistence.dao.model.RequestSchema
[2016-02-19 16:28:58 - SMP_Bank_Project] Warning: com.sap.mobile.lib.request.DBWrapper: can't find referenced class com.sap.mobile.lib.persistence.dao.model.RequestSchema
[2016-02-19 16:28:58 - SMP_Bank_Project] Warning: com.sap.mobile.lib.request.DBWrapper: can't find referenced class com.sap.mobile.lib.persistence.PersistenceManagerImpl
[2016-02-19 16:28:58 - SMP_Bank_Project] Warning: com.sap.mobile.lib.request.DBWrapper: can't find referenced class com.sap.mobile.lib.persistence.dao.model.RouteManagerSchema
[2016-02-19 16:28:58 - SMP_Bank_Project] Warning: com.sap.mobile.lib.request.DBWrapper: can't find referenced class com.sap.mobile.lib.persistence.dao.model.RouteManagerSchema
[2016-02-19 16:28:58 - SMP_Bank_Project] Warning: com.sap.mobile.lib.request.DBWrapper: can't find referenced class com.sap.mobile.lib.persistence.dao.model.RouteManagerSchema
[2016-02-19 16:28:58 - SMP_Bank_Project] Warning: com.sap.mobile.lib.request.DBWrapper: can't find referenced class com.sap.mobile.lib.persistence.PersistenceManagerImpl
[2016-02-19 16:28:58 - SMP_Bank_Project] Warning: com.sap.mobile.lib.request.DBWrapper: can't find referenced class com.sap.mobile.lib.persistence.PersistenceManagerImpl
[2016-02-19 16:28:58 - SMP_Bank_Project] Warning: com.sap.mobile.lib.request.DBWrapper: can't find referenced class com.sap.mobile.lib.persistence.PersistenceManagerImpl
[2016-02-19 16:28:58 - SMP_Bank_Project] Warning: com.sap.mobile.lib.request.DBWrapper: can't find referenced class com.sap.mobile.lib.persistence.PersistenceManagerImpl
[2016-02-19 16:28:58 - SMP_Bank_Project] Warning: com.sap.mobile.lib.request.DBWrapper: can't find referenced class com.sap.mobile.lib.persistence.dao.model.IDbSchema
[2016-02-19 16:28:58 - SMP_Bank_Project] Warning: com.sap.mobile.lib.request.DBWrapper: can't find referenced class com.sap.mobile.lib.persistence.dao.model.RequestSchema
[2016-02-19 16:28:58 - SMP_Bank_Project] Warning: com.sap.smp.rest.AppSettings: can't find referenced class com.sybase.persistence.DataVault$DVPasswordPolicy
[2016-02-19 16:28:58 - SMP_Bank_Project] Warning: com.sap.smp.rest.AppSettings: can't find referenced class com.sybase.persistence.DataVault$DVPasswordPolicy
[2016-02-19 16:28:58 - SMP_Bank_Project] Warning: com.sap.smp.rest.AppSettings: can't find referenced class com.sybase.persistence.DataVault$DVPasswordPolicy
[2016-02-19 16:28:58 - SMP_Bank_Project] Warning: com.sap.smp.rest.AppSettings: can't find referenced class com.sybase.persistence.DataVault
[2016-02-19 16:28:58 - SMP_Bank_Project] Warning: com.sap.smp.rest.AppSettings: can't find referenced class com.sybase.persistence.DataVault$DVPasswordPolicy
[2016-02-19 16:28:58 - SMP_Bank_Project] Warning: com.sap.smp.rest.AppSettings: [2016-02-19 16:28:58 - SMP_Bank_Project]       You should check if you need to specify additional program jars.
[2016-02-19 16:28:58 - SMP_Bank_Project] Warning: there were 69 unresolved references to classes or interfaces.
[2016-02-19 16:28:58 - SMP_Bank_Project]          You may need to specify additional library jars (using '-libraryjars').
[2016-02-19 16:28:58 - SMP_Bank_Project] java.io.IOException: Please correct the above warnings first.
[2016-02-19 16:28:58 - SMP_Bank_Project]    at proguard.Initializer.execute(Initializer.java:321)
[2016-02-19 16:28:58 - SMP_Bank_Project]    at proguard.ProGuard.initialize(ProGuard.java:211)
[2016-02-19 16:28:58 - SMP_Bank_Project]    at proguard.ProGuard.execute(ProGuard.java:86)
[2016-02-19 16:28:58 - SMP_Bank_Project]    at proguard.ProGuard.main(ProGuard.java:492)

Progaurd.txt file

# 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 *;
#}

-libraryjars ${external.libs.dir}:${libraryjarpath}

-keep class com.sap.smp.** 
-dontwarn com.sap.smp.*
-keep class com.sap.mobile.** 
-dontwarn com.sap.mobile.*

-keep class com.sap.smp.rest.AppSettings.** 
-dontwarn com.sap.smp.rest.AppSettings.*

-printmapping mapping.txt
1

There are 1 best solutions below

0
On

Try this to keep all classes of com.sap package and it's sub packages.

-keep class com.sap.** {
  public protected private *;
}
-dontwarn com.sap.**