diff --git a/examples/android-proguard-example/AndroidManifest.xml b/examples/android-proguard-example/AndroidManifest.xml new file mode 100755 index 00000000..7e9b1d8b --- /dev/null +++ b/examples/android-proguard-example/AndroidManifest.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + diff --git a/examples/android-proguard-example/default.properties b/examples/android-proguard-example/default.properties new file mode 100644 index 00000000..7d4fed0b --- /dev/null +++ b/examples/android-proguard-example/default.properties @@ -0,0 +1,12 @@ +# 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 use, +# "build.properties", and override values to adapt the script to your +# project structure. + +# Project target. +target=android-3 +proguard.config=proguard.cfg \ No newline at end of file diff --git a/examples/android-proguard-example/pom.xml b/examples/android-proguard-example/pom.xml new file mode 100755 index 00000000..201cb26a --- /dev/null +++ b/examples/android-proguard-example/pom.xml @@ -0,0 +1,144 @@ + + + + 4.0.0 + com.google.code.gson + android-proguard-example + apk + 1.0-SNAPSHOT + android-proguard-example + http://code.google.com/p/google-gson/trunk/examples/android + An example illustrating using Gson and Progaurd in an Android application + + org.sonatype.oss + oss-parent + 5 + + + UTF-8 + ${env.ANDROID_HOME}/ + + + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + scm:svn:http://google-gson.googlecode.com/svn/trunk/examples/android + scm:svn:https://google-gson.googlecode.com/svn/trunk/examples/android + http://google-gson.codegoogle.com/trunk/examples/android + + + Google Code Issue Tracking + http://code.google.com/p/google-gson/issues/list + + + + com.google.android + android + 1.5_r4 + provided + + + com.google.code.gson + gson + 1.8-SNAPSHOT + provided + + + + + + + com.jayway.maven.plugins.android.generation2 + maven-android-plugin + 2.9.0-beta-4 + + + ${env.ANDROID_HOME}/ + 1.5 + + true + + true + + + org.apache.maven.plugins + maven-compiler-plugin + 2.3.2 + + 1.6 + 1.6 + + + + org.apache.maven.plugins + maven-eclipse-plugin + 2.8 + + true + true + ../../eclipse-ws + + file:///${basedir}/../lib/formatting-styles.xml + + + + + org.apache.maven.plugins + maven-jar-plugin + 2.3.1 + + + + test-jar + + + + + + org.apache.maven.plugins + maven-source-plugin + 2.1.2 + + + attach-sources + + jar + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.7 + + + attach-javadocs + + jar + + + + + + http://download.oracle.com/javase/1.5.0/docs/api/ + + true + public + + + + + + + Inderjeet Singh + + + diff --git a/examples/android-proguard-example/proguard.cfg b/examples/android-proguard-example/proguard.cfg new file mode 100644 index 00000000..b16d8aa4 --- /dev/null +++ b/examples/android-proguard-example/proguard.cfg @@ -0,0 +1,69 @@ +-optimizationpasses 5 +-dontusemixedcaseclassnames +-dontskipnonpubliclibraryclasses +-dontskipnonpubliclibraryclassmembers +-dontpreverify +-verbose +-dump class_files.txt +-printseeds seeds.txt +-printusage unused.txt +-printmapping mapping.txt +-optimizations !code/simplification/arithmetic,!field/*,!class/merging/* + +-allowaccessmodification +-keepattributes *Annotation* +-renamesourcefileattribute SourceFile +-keepattributes SourceFile,LineNumberTable + +-keep public class * extends android.app.Activity +-keep public class * extends android.app.Application +-keep public class * extends android.app.Service +-keep public class * extends android.content.BroadcastReceiver +-keep public class * extends android.content.ContentProvider +-keep public class * extends android.app.backup.BackupAgentHelper +-keep public class * extends android.preference.Preference +-keep public class com.android.vending.licensing.ILicensingService +-dontnote com.android.vending.licensing.ILicensingService + +# Explicitly preserve all serialization members. The Serializable interface +# is only a marker interface, so it wouldn't save them. +-keepclassmembers class * implements java.io.Serializable { + static final long serialVersionUID; + private static final java.io.ObjectStreamField[] serialPersistentFields; + private void writeObject(java.io.ObjectOutputStream); + private void readObject(java.io.ObjectInputStream); + java.lang.Object writeReplace(); + java.lang.Object readResolve(); +} + +# Preserve all native method names and the names of their classes. +-keepclasseswithmembernames class * { + native ; +} + +-keepclasseswithmembernames class * { + public (android.content.Context, android.util.AttributeSet); +} + +-keepclasseswithmembernames class * { + public (android.content.Context, android.util.AttributeSet, int); +} + +# Preserve static fields of inner classes of R classes that might be accessed +# through introspection. +-keepclassmembers class **.R$* { + public static ; +} + +# Preserve the special static methods that are required in all enumeration classes. +-keepclassmembers enum * { + public static **[] values(); + public static ** valueOf(java.lang.String); +} + +-keep class * implements android.os.Parcelable { + public static final android.os.Parcelable$Creator *; +} + +# Gson specific classes +-keep class sun.misc.Unsafe.** { *; } diff --git a/examples/android-proguard-example/res/drawable/icon.png b/examples/android-proguard-example/res/drawable/icon.png new file mode 100644 index 00000000..a07c69fa Binary files /dev/null and b/examples/android-proguard-example/res/drawable/icon.png differ diff --git a/examples/android-proguard-example/res/layout/main.xml b/examples/android-proguard-example/res/layout/main.xml new file mode 100644 index 00000000..0ac46e68 --- /dev/null +++ b/examples/android-proguard-example/res/layout/main.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/examples/android-proguard-example/res/values/strings.xml b/examples/android-proguard-example/res/values/strings.xml new file mode 100644 index 00000000..ba3be81e --- /dev/null +++ b/examples/android-proguard-example/res/values/strings.xml @@ -0,0 +1,5 @@ + + + Gson Proguard Example + + diff --git a/examples/android-proguard-example/src/com/google/gson/examples/android/GsonProguardExampleActivity.java b/examples/android-proguard-example/src/com/google/gson/examples/android/GsonProguardExampleActivity.java new file mode 100644 index 00000000..eaeb3bed --- /dev/null +++ b/examples/android-proguard-example/src/com/google/gson/examples/android/GsonProguardExampleActivity.java @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2011 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.gson.examples.android; + +import android.app.Activity; +import android.os.Bundle; +import android.widget.TextView; + +/** + * Activity class illustrating how to use proguard with Gson + * + * @author Inderjeet Singh + */ +public class GsonProguardExampleActivity extends Activity { + @Override + public void onCreate(Bundle icicle) { + super.onCreate(icicle); + setContentView(R.layout.main); + TextView tv = (TextView) findViewById(R.id.tv); + tv.setText("Hello World"); + tv.invalidate(); + } +}