Mercari-Jmfayard
Originally published on https://github.com/m-rec/c325017f9e66db9320f99fdced6ac3d66abc9212
Originally published on https://github.com/m-rec/c325017f9e66db9320f99fdced6ac3d66abc9212
Coroutines documents
# Open a new android project in Android Studio | |
# From Android Studio, run the gradle task ":properties" | |
# From the command-line, run | |
$ ./gradlew :properties | |
# Check if you see this message | |
Starting a Gradle Daemon, 1 incompatible could not be reused | |
# To debug the problem run this | |
$ ps auxw | grep GradleDaemon |
// buildSrc/src/main/kotlin/Config.kt | |
object Config { | |
const val ACTIVITY = "com.mautinoa.cardapp.MainActivity" | |
const val PACKAGE = "com.mautinoa.cardapp" | |
const val kotlinVersion = "1.2.71" | |
object SdkVersions { | |
val versionCode = 1 | |
val compile = 28 | |
val target = 26 |
// buildSrc/src/main/java/GooglePlay.kt | |
import java.io.File | |
object GooglePlay { | |
@JvmStatic | |
fun updateWhatsNew(projectDir: File, version: String) { | |
val files: List<File> = listOf( | |
"src/production/play/en-US/listing/whatsnew-alpha", |
fun app() = AppComponent.instance | |
interface AppComponent { | |
val context: Context | |
val retrofit: Retrofit | |
val okHttpClient: OkHttpClient | |
val catRepository: CatRepository | |
val catService: CatService | |
val mainThreadScheduler: Scheduler |
data class Producer<out T : Beverage>( | |
val beverage: T | |
) { | |
fun produce() : T = beverage | |
} | |
class Consumer<in T: Beverage> { | |
fun consume(t: T) = println("Thanks for the drink $t!") | |
} |
// https://medium.com/@garnop/safe-concise-text-parsing-with-regex-destructuring-in-kotlin-b8f77ef1e30c | |
fun parsePhoneNumber(input: String): PhoneNumber { | |
val invalids = input.filterNot { it in '0'..'9' || it == '-' } | |
require(invalids.isEmpty()) { "Input $input has invalid characters : $invalids" } | |
val (areaCode, prefix, lineNumber) = input.split("-").map(String::toInt) | |
return PhoneNumber(areaCode, prefix, lineNumber) | |
} | |
fun main(args: Array<String>) { |
lolcat() { | |
FILE="$HOME/.config/androidpackage.txt" | |
echo "Reading ${FILE}" | |
export PACKAGE=$( cat ${FILE} ) | |
adb devices | |
echo pidcat $1 $2 $PACKAGE | |
sleep 2 | |
pidcat $1 $2 $PACKAGE | |
} |
Add the printProperties
task to your build.gradle
Run from both the command-line and intellij the gradle task printProperties
> Task :printProperties
Detecting what could cause incompatible gradle daemons
Run './gradlew printProperties' from the command-line and the same task Android studio
See https://docs.gradle.org/4.5/userguide/build_environment.html
See https://docs.gradle.org/4.5/userguide/gradle_daemon.html#daemon_faq