More Related Content Similar to 少し幸せになる技術 (20) 少し幸せになる技術11. IDE
• Android Studio
Find Action
• Mac: ⌘ ⇧ A
• Windows: Ctrl Shift A
•
• Keymap
15. public class CalcUtil {
public static int mod(int x, int y) {
if (y == 0) {
throw new
IllegalArgumentException("y != 0");
}
return x % y;
}
}
21. buildTypes {
release {}
debug {
applicationIdSuffix ".debug"
}
}
productFlavors {
demo {
applicationIdSuffix ".demo"
}
full {
applicationIdSuffix ".full"
}
}
23. 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"
}
}
24. 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"
}
}
28. def major = 1
def minor = 0
def patch = 0
def build = 0
android {
defaultConfig {
versionCode major * 10000 + minor * 1000 + patch
* 100 + build
versionName "${major}.${minor}.${patch}"
}
}
32. • build.gradle
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']
}
}
40. Log Unit Test
• Log ClassLoader Log
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; }
}
42. 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");
}
}