본 포스팅은 DroidKaigi 2017 ~ 少し幸せにする技術 을 기본으로 번역하여 작성했습니다
제 일본어 실력으로 인하여 오역이나 오타가 발생할 수 있습니다.
DroidKaigi 2017 3/9 18:00 ~
Kameron
축! 첫 발표
자기소개
ClassMethod에 JOIN 했습니다 “めそ子” 입니다.
https://dev.classmethod.jp/etc/mesoko-joined-classmethod/
Android Studio편
public class CalcUtil {
public static int mod(int x, int y) {
if (y == 0) {
throw new IllegalArgumentException("y != 0");
}
return x % y;
}
}
public class CalcUtilTest {
@Test
public void 나머지_테스트() {
Assert.assertThat(3, Is.is(CalcUtil.mod(11, 4)));
// y가 0인 케이스가 빠져있다
}
}
Run ‘Test in …’ with Coverage 를 실행
Build.gradle편
// app/build.gradle
buildTypes { // Build Variants
release {}
debug {
applicationIdSuffix ".debug"
}
}
productFlavors { // Product Flavor
demo {
applicationIdSuffix ".demo"
}
full {
applicationIdSuffix ".full"
}
// {pkg}.{Flavor}.{BuildType}
// {pkg}.demo.debug
}
buildTypes { release { buildConfigField “String”, “ENDPOINT”, “"https://hoge.com" “ } debug { applicationIdSuffix “.debug” buildConfigField “String”, “ENDPOINT”, “"https://localhost" “ } }
productFlavors { demo { buildConfigField “boolean”, “DEMO”, “true” applicationIdSuffix “.demo” } full { buildConfigField “boolean”, “DEMO”, “false” applicationIdSuffix “.full” } }
// versionName 과 versionCode를 연동하도록 한다
def major = 1
def minor = 0
def patch = 0
def build = 0
// 개발자는 versionName 을 올리고 싶은 Google Play는 versionCode를 올리면 된다
android {
defaultConfig {
versionCode major * 10000 + minor * 1000 + patch * 100 + build
versionName "${major}.${minor}.${patch}"
}
}
signingConfigs {
release {
storeFile file("./filepath")
keyAlias "test"
storePassword "test"
keyPassword "test"
}
}
storePassword=myStorePassword
keyPassword=mykeyPassword
keyAlias=myKeyAlias
storeFile=myStoreFileLocation
signingConfigs {
debug {
def keystorePropertiesFile = rootProject.file("keystore.properties")
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
디버그편
if (BuildConfig.DEBUG) {
Timber.plant(Timber.DebugTree())
}
Timber.d("test", "test")
app/src/test/java/android/util/Log.java에 아래 코드를 둔다
public class Log {
public static int v(String tag, String msg) { return 0; }
public static int v(String tag, String msg, Throwable tr) { return 0; }
public static int d(String tag, String msg) { return 0; }
public static int d(String tag, String msg, Throwable tr) { return 0; }
public static int i(String tag, String msg) { return 0; }
public static int i(String tag, String msg, Throwable tr) { return 0; }
public static int w(String tag, String msg) { return 0; }
public static int w(String tag, String msg, Throwable tr) { return 0; }
public static int w(String tag, Throwable tr) { return 0; }
public static int e(String tag, String msg) { return 0; }
public static int e(String tag, String msg, Throwable tr) { return 0; }
}
ProGuard 편
public class MainActivity extends c {
private TextView m;
public MainActivity() {}
protected void onCreate(Bundle var1) {
super.onCreate(var1);
this.setContentView(2130968603);
this.m = (TextView)this.findViewById(2131427415);
this.m.setText("hello world");
}
}
buildTypes {
debug {
minifyEnabled true
useProguard false
proguardFiles getDefaultProguardFile('proguardandroid.txt'), 'proguard-rules.pro'
}
}
OS, 단말편
Google Paly Console 편
comments powered by Disqus
Subscribe to this blog via RSS.