Titanium JIRA Archive
Appcelerator Community (AC)

[AC-2423] Android: proGuard issue (relates to TIMOB-2782)

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionDuplicate
Resolution Date2014-07-14T22:26:16.000+0000
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsandroid, module, proGarud, progarud.cfg, shareSDK
Reporter曹俊
AssigneeMauro Parra-Miranda
Created2014-01-16T02:28:33.000+0000
Updated2016-03-08T07:41:27.000+0000

Description

The 'proguard.cfg' must exists in "$project-dir/platform/android" even if the 'proguard.cfg' exists in module('platform/android'). There are no way to config 'this.proguard' in '_build.js'. I think the module could config 'this.proguard' in build.xml or timodule.xml. I know this feature will be publish in 3.3.0, but I need it right now. So I try to modify '_build.js', I read about proGuard in "http://proguard.sourceforge.net/index.html#manual/usage.html", I have some questions. The option "-injars" need set file-path, I do not know clearly which folder has "*.jar". Which is core in titanium , which is third-party in module. "_build.js" seems create temp folder to build and compile "*.jar". PS: The "$project-dir/build/android/lib" has not any "*.jar", I confuse it. When executes the process "runProguard"? My purpose is using third-party "shareSDK" what is a SDK of Chinese social sharing platform. (http://sharesdk.cn)
  I try build shareSDK in module and install into device of android mobile, it will throw like this:
  [exec] [INFO] Compiling Android Resources... This could take some time
     [exec] [DEBUG] /Users/apple/android-sdk/platform-tools/dx -JXmx1536M -JXX:-UseGCOverheadLimit --dex --output=/var/folders/w2/khz8t6h10q51lx_hvw8ds9wr0000gn/T/mRMP1dUti/cleansharesdk/build/android/bin/classes.dex /var/folders/w2/khz8t6h10q51lx_hvw8ds9wr0000gn/T/mRMP1dUti/cleansharesdk/build/android/bin/classes "/Users/apple/Library/Application Support/Titanium/mobilesdk/osx/3.2.0.GA/android/kroll-v8.jar" "/Users/apple/Library/Application Support/Titanium/mobilesdk/osx/3.2.0.GA/android/modules/titanium-media.jar" "/Users/apple/Library/Application Support/Titanium/mobilesdk/osx/3.2.0.GA/android/modules/titanium-locale.jar" "/Users/apple/Library/Application Support/Titanium/mobilesdk/osx/3.2.0.GA/android/modules/titanium-platform.jar" "/Users/apple/Library/Application Support/Titanium/mobilesdk/osx/3.2.0.GA/android/modules/titanium-ui.jar" "/Users/apple/Library/Application Support/Titanium/mobilesdk/osx/3.2.0.GA/android/ti-commons-codec-1.3.jar" "/Users/apple/Library/Application Support/Titanium/mobilesdk/osx/3.2.0.GA/android/kroll-common.jar" "/Users/apple/Library/Application Support/Titanium/mobilesdk/osx/3.2.0.GA/android/modules/titanium-analytics.jar" "/Users/apple/Library/Application Support/Titanium/mobilesdk/osx/3.2.0.GA/android/modules/titanium-app.jar" "/Users/apple/Library/Application Support/Titanium/mobilesdk/osx/3.2.0.GA/android/titanium.jar" "/Users/apple/Library/Application Support/Titanium/mobilesdk/osx/3.2.0.GA/android/jaxen-1.1.1.jar" "/Users/apple/Library/Application Support/Titanium/mobilesdk/osx/3.2.0.GA/android/nineoldandroids-appc-2.4.0.jar" "/Users/apple/Library/Application Support/Titanium/mobilesdk/osx/3.2.0.GA/android/modules/titanium-android.jar" "/Users/apple/Library/Application Support/Titanium/mobilesdk/osx/3.2.0.GA/android/android-support-v4.jar" "/Users/apple/Library/Application Support/Titanium/mobilesdk/osx/3.2.0.GA/android/modules/titanium-filesystem.jar" /var/folders/w2/khz8t6h10q51lx_hvw8ds9wr0000gn/T/mRMP1dUti/cleansharesdk/modules/android/com.baidao.sharesdk/0.1/cleansharesdk.jar /var/folders/w2/khz8t6h10q51lx_hvw8ds9wr0000gn/T/mRMP1dUti/cleansharesdk/modules/android/com.baidao.sharesdk/0.1/lib/mframework.jar /var/folders/w2/khz8t6h10q51lx_hvw8ds9wr0000gn/T/mRMP1dUti/cleansharesdk/modules/android/com.baidao.sharesdk/0.1/lib/ShareSDK-Core-2.3.1.jar "/Users/apple/Library/Application Support/Titanium/mobilesdk/osx/3.2.0.GA/android/lib/titanium-verify.jar" "/Users/apple/Library/Application Support/Titanium/mobilesdk/osx/3.2.0.GA/android/lib/titanium-debug.jar" "/Users/apple/Library/Application Support/Titanium/mobilesdk/osx/3.2.0.GA/android/lib/titanium-profiler.jar" "/Users/apple/Library/Application Support/Titanium/mobilesdk/osx/3.2.0.GA/android/modules/titanium-network.jar"
     [exec] [WARN] warning: Ignoring InnerClasses attribute for an anonymous inner class
     [exec] [ERROR] (cn.sharesdk.framework.a) that doesn't come with an
     [exec] [ERROR] associated EnclosingMethod attribute. This class was probably produced by a
     [exec] [ERROR] compiler that did not target the modern .class file format. The recommended
     [exec] [ERROR] solution is to recompile the class from source, using an up-to-date compiler
     [exec] [ERROR] and without specifying any "-target" type options. The consequence of ignoring
     [exec] [ERROR] this warning is that reflective operations on this class will incorrectly
     [exec] [ERROR] indicate that it is *not* an inner class.
     [exec] [WARN] warning: Ignoring InnerClasses attribute for an anonymous inner class
     [exec] [ERROR] (cn.sharesdk.framework.a.j) that doesn't come with an
     [exec] [ERROR] associated EnclosingMethod attribute. This class was probably produced by a
     [exec] [ERROR] compiler that did not target the modern .class file format. The recommended
     [exec] [ERROR] solution is to recompile the class from source, using an up-to-date compiler
     [exec] [ERROR] and without specifying any "-target" type options. The consequence of ignoring
     [exec] [ERROR] this warning is that reflective operations on this class will incorrectly
     [exec] [ERROR] indicate that it is *not* an inner class.
The official solution is using proGuard to keep class.(http://wiki.sharesdk.cn/Android_%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98) -keep class cn.sharesdk.**{*;} -keep class com.sina.**{*;} -keep class **.R$* {*;} -keep class **.R{*;} -dontwarn cn.sharesdk.** -dontwarn **.R$* -keep class m.framework.**{*;} I hope you could test shareSDK before publish proGuard feature. For example, create a module, add "mframework.jar" into lib , use "progarud-projext.txt" , build and install into a device. I can not upload attachment, so you should download it by http://sharesdk.cn/media/sdk/ShareSDK_for_Android_2.3.2.zip. Check the sample you can found "mframework.jar" and "progarud-projext.txt". Thank you.

Comments

  1. Ingo Muschenetz 2014-05-30

    Thoughts?
  2. Mauro Parra-Miranda 2014-07-14

JSON Source