Skip to content

Instantly share code, notes, and snippets.

@faultier
Created January 10, 2011 09:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save faultier/772563 to your computer and use it in GitHub Desktop.
Save faultier/772563 to your computer and use it in GitHub Desktop.
.classpath
tags
bin
target
.settings
seed.txt
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.livedoor.android.sample"
android:versionCode="1"
android:versionName="1.0">
<application android:label="@string/app_name" android:icon="@drawable/icon">
<activity android:name="MainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
<?xml version="1.0" encoding="utf-8"?>
<!-- package name must be unique so suffix with "tests" so package loader doesn't ignore us -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.livedoor.android.sample.tests"
android:versionCode="1"
android:versionName="1.0">
<!-- We add an application tag here just so that we can indicate that
this package needs to link against the android.test library,
which is needed when building test cases. -->
<application>
<uses-library android:name="android.test.runner" />
</application>
<!--
This declares that this application uses the instrumentation test runner targeting
the package of com.livedoor.android.sample. To run the tests use the command:
"adb shell am instrument -w com.livedoor.android.sample.tests/android.test.InstrumentationTestRunner"
-->
<instrumentation android:name="android.test.InstrumentationTestRunner"
android:targetPackage="com.livedoor.android.sample"
android:label="Tests for com.livedoor.android.sample"/>
</manifest>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Hello World, MainActivity"
/>
</LinearLayout>
package com.livedoor.android.sample;
import android.app.Activity;
import android.os.Bundle;
public class MainActivity extends Activity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
package com.livedoor.android.sample;
import android.test.ActivityInstrumentationTestCase2;
/**
* This is a simple framework for a test of an Application. See
* {@link android.test.ApplicationTestCase ApplicationTestCase} for more information on
* how to write and extend Application tests.
* <p/>
* To run this test, you can type:
* adb shell am instrument -w \
* -e class com.livedoor.android.sample.MainActivityTest \
* com.livedoor.android.sample.tests/android.test.InstrumentationTestRunner
*/
public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActivity> {
public MainActivityTest() {
super("com.livedoor.android.sample", MainActivity.class);
}
}
<?xml version="1.0" encoding="utf-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.livedoor.android.sample</groupId>
<artifactId>sample</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Android sample</name>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>2.1_r1</version>
</dependency>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android-test</artifactId>
<version>2.1_r1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.4</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>maven-android-plugin</artifactId>
<version>2.8.3</version>
<configuration>
<sdk>
<platform>7</platform>
</sdk>
<emulator>
<avd>Google7</avd>
<options>-netdelay umts -netspeed umts</options>
</emulator>
<deleteConflictingFiles>true</deleteConflictingFiles>
<undeployBeforeDeploy>true</undeployBeforeDeploy>
</configuration>
<extensions>true</extensions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3</version>
</plugin>
</plugins>
</pluginManagement>
</build>
<profiles>
<profile>
<id>test</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<defaultGoal>install</defaultGoal>
</build>
<modules>
<module>sample-app</module>
<module>sample-test</module>
</modules>
</profile>
<profile>
<id>distribution</id>
<build>
<defaultGoal>package</defaultGoal>
</build>
<modules>
<module>sample-app</module>
</modules>
</profile>
</profiles>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.livedoor.android.sample</groupId>
<artifactId>sample</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<groupId>com.livedoor.android.sample</groupId>
<artifactId>sample-app</artifactId>
<version>1.0-SNAPSHOT</version>
<name>Android sample - App</name>
<packaging>apk</packaging>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>maven-android-plugin</artifactId>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<profiles>
<profile>
<id>test</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>maven-android-plugin</artifactId>
<inherited>true</inherited>
<executions>
<execution>
<id>startemulator</id>
<phase>initialize</phase>
<goals>
<goal>emulator-start</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>distribution</id>
<build>
<plugins>
<!-- 公開用のapkを署名する際はここに設定を書く。省略するとDebug用に署名される。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<id>signing</id>
<goals>
<goal>sign</goal>
</goals>
<phase>package</phase>
<inherited>true</inherited>
<configuration>
<archiveDirectory></archiveDirectory>
<includes>
<include>target/*.apk</include>
</includes>
<keystore>キーストアのパス</keystore>
<storepass>キーストアのパスワード</storepass>
<keypass>キーのパスワード</keypass>
<alias>エイリアス</alias>
</configuration>
</execution>
</executions>
</plugin>
-->
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>maven-android-plugin</artifactId>
<inherited>true</inherited>
<configuration>
<sign>
<debug>false</debug>
</sign>
</configuration>
</plugin>
<!-- ProGuardを使って最適化する場合はこのプラグインを使う。
難読化してしまうとテストプロジェクトがビルドできないので、公開用のプロファイルでのみ有効にしておけばいい。
一部のクラスはクラス名が変更されてしまうとAndroidManifestと整合性が取れなくなるので、
オプションで-keepを指定してやる必要がある(自動生成されたproguard.cfgを設定ファイルとして指定してやればいい)。
なお、MacOSXには${java.home}/lib.rt.jarが存在しないので、
ProGuard pluginのサンプルには
/System/Library/Java/JavaVM.framework/Classes/classes.jarに
シンボリックリンクを張るようにと書いてありました。
-->
<plugin>
<groupId>com.pyx4me</groupId>
<artifactId>proguard-maven-plugin</artifactId>
<version>2.0.4</version>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>proguard</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>net.sf.proguard</groupId>
<artifactId>proguard</artifactId>
<version>4.4</version>
<scope>runtime</scope>
</dependency>
</dependencies>
<configuration>
<proguardVersion>4.4</proguardVersion>
<injar>android-classes</injar>
<proguardInclude>${basedir}/proguard.cfg</proguardInclude>
<libs>
<lib>${java.home}/lib/rt.jar</lib>
</libs>
<obfuscate>true</obfuscate>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
<?xml version="1.0" encoding="utf-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.livedoor.android.sample</groupId>
<artifactId>sample</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<groupId>com.livedoor.android.sample</groupId>
<artifactId>sample-test</artifactId>
<version>1.0-SNAPSHOT</version>
<name>Android sample - Test</name>
<packaging>apk</packaging>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>maven-android-plugin</artifactId>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android-test</artifactId>
<scope>provided</scope>
</dependency>
<!-- これを設定しておくことで、テストの実行前にアプリのapkファイルが生成されて、一緒にインストールされる -->
<dependency>
<groupId>com.livedoor.android.sample</groupId>
<artifactId>sample-app</artifactId>
<version>${project.version}</version>
<type>apk</type>
</dependency>
<!-- テストプロジェクトのコンパイルの際にアプリのクラスが必要になるので、jarもdependencyに入れておく -->
<dependency>
<groupId>com.livedoor.android.sample</groupId>
<artifactId>sample-app</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
<type>jar</type>
</dependency>
</dependencies>
</project>
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-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 com.android.vending.licensing.ILicensingService
-keepclasseswithmembernames class * {
native <methods>;
}
-keepclasseswithmembernames class * {
public <init>(android.content.Context, android.util.AttributeSet);
}
-keepclasseswithmembernames class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">MainActivity</string>
</resources>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment