[Android-development] proguard
maitai
maitai at virtual-winds.org
Tue Mar 3 14:34:44 CET 2015
Finally got it working as far as I can tell, after much sweat.
For those interested my proguard file is:
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-keep class org.qtproject.** {*;}
-keep interface org.qtproject.** {*;}
-keep enum org.qtproject.** {*;}
-keepclassmembers,allowoptimization enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
Any comments welcomed, but this seems the way to go.
Philippe Lelong.
Le 02-03-2015 20:08, Philippe Lelong a écrit :
> Hello again
>
> Back on that one..
>
> Finally got to have proguard running during qtcreator build. But as
> expected I have now problems at runtime, with messages such as
>
> W/System.err( 7534): java.lang.NoSuchMethodException: loadApplication
> [class android.app.Activity, class java.lang.ClassLoader, class
> android.os.Bundle]
>
> I tried to guess what classes I should exclude in proguard-project.txt
> but no luck so far.
>
> Anyone has an idea of proguard configuration needed for a qt-app to
> run?
>
> Thanks
> Philippe Lelong
>
> Le 18-02-2015 08:26, Harri Pasanen a écrit :
>> It probably cannot obfuscate everything because it needs it for
>> reflection to find the methods at runtime.
>> In particular, I would not expect anything in .so to be obfuscated.
>>
>> ... educated guessing from my part continues...
>>
>> Harri
>>
>> On 18/02/2015 06:39, maitai at virtual-winds.org wrote:
>>> Thanks Harri for replying
>>>
>>> I can see in the .so from the apk that all labels, class names etc
>>> are
>>> not obfuscated, so proguard is not called.
>>>
>>> Do you know if project.properties is generated through a template or
>>> something similar I could modify?
>>>
>>> Philippe.
>>>
>>> Le 17-02-2015 21:47, Harri Pasanen a écrit :
>>>> If you look at compile output in Qt creator, I think you'll see some
>>>> proguard commands go by...
>>>> This is from memory, so I could be wrong.
>>>>
>>>> But obviously proguard only touches the java parts.
>>>>
>>>> If you explode the generated .apk and run strings on select pieces,
>>>> you
>>>> should see either proguard mangled strings or something familiar.
>>>>
>>>> My fast 2 cents without actually trying any of the above...
>>>>
>>>> Harri
>>>>
>>>> On 17/02/2015 19:08, maitai at virtual-winds.org wrote:
>>>>> Hi,
>>>>>
>>>>> Back on this after many hours of research... still no solution...
>>>>>
>>>>> I can see that project.properties in android build directory ask to
>>>>> uncomment a line to activate proguard obfuscating but since this
>>>>> file
>>>>> is
>>>>> regenerated at each build (by qmake as it seems?), the cbanges are
>>>>> lost
>>>>> of course.
>>>>>
>>>>> Is there a master file somewhere I am missing or an option for
>>>>> that?
>>>>>
>>>>> Any tip welcomed..
>>>>>
>>>>> Thanks
>>>>> Philippe
>>>>>
>>>>> Le 16-02-2015 16:38, maitai at virtual-winds.org a écrit :
>>>>>> Hello again,
>>>>>>
>>>>>> If I want to obfuscate and/or optimize apk with proguard, is it
>>>>>> something I can configure from qt-creator somehow? Or maybe it's
>>>>>> done
>>>>>> already automatically from the SDK?
>>>>>>
>>>>>> At build time in creator I can see:
>>>>>>
>>>>>> ...
>>>>>> -release-obfuscation-check:
>>>>>> [echo] proguard.config is ${proguard.config}
>>>>>>
>>>>>> -pre-build:
>>>>>>
>>>>>> -check-env:
>>>>>> [checkenv] Android SDK Tools Revision 24.0.2
>>>>>> ...
>>>>>>
>>>>>> But it's not clear to me if proguard is actually called or not,
>>>>>> and
>>>>>> eventually how if I can change options.
>>>>>>
>>>>>> Thanks
>>>>>> Philippe Lelong
>>>>>> _______________________________________________
>>>>>> Android-development mailing list
>>>>>> Android-development at qt-project.org
>>>>>> http://lists.qt-project.org/mailman/listinfo/android-development
>>>>> _______________________________________________
>>>>> Android-development mailing list
>>>>> Android-development at qt-project.org
>>>>> http://lists.qt-project.org/mailman/listinfo/android-development
>>>> _______________________________________________
>>>> Android-development mailing list
>>>> Android-development at qt-project.org
>>>> http://lists.qt-project.org/mailman/listinfo/android-development
>>> _______________________________________________
>>> Android-development mailing list
>>> Android-development at qt-project.org
>>> http://lists.qt-project.org/mailman/listinfo/android-development
>>
>> _______________________________________________
>> Android-development mailing list
>> Android-development at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/android-development
> _______________________________________________
> Android-development mailing list
> Android-development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/android-development
More information about the Android-development
mailing list