Skip to content

Android

mitochondrion edited this page Jul 5, 2017 · 16 revisions

Declare Proguard rules for library

android {
    ...
    defaultConfig {
        ...
        consumerProguardFiles 'proguard-rules.pro'
    }
}

Manually build

./gradlew clean assembleDebug

Manually install apk

  • ~/Library/Android/sdk/platform-tools/adb
  • adb install [path to .apk]

Manually launch emulator

  • ~/Library/Android/sdk/tools/emulator -avd Nexus_6_API_23 -netspeed full -netdelay none -http-proxy http://127.0.0.1:8888 -port 5554

Push to JCenter

Setup

Create local.properties at top level:

sdk.dir=/Users/alex/Library/Android/sdk
bintray.user=username
bintray.apikey=apikey
bintray.gpg.password=password

JCenter repo: https://bintray.com/[user]/maven/[repo name]

Push:

Test:

Install the new version of the library from JCenter in a new app and test that Gradle can sync and that everything works.

  • Make sure the JCenter repo is configured in the new project's build.gradle:
allprojects {
    repositories {
        ...
        maven {
            ...
            url 'https://dl.bintray.com/[username]/maven/'
        }
    }
}
  • Make sure the package is configured in the new project's app/build.gradle:
dependencies {
    ...
    compile '[package]:[artifact]:[version, e.g. 0.1.2]'
}

Clean gradle cache

  • rm -rf ~/.gradle/caches
  • rm -rf [ProjectRoot]/.gradle
  • [ProjectRoot]/gradlew assemble

Fixing Logcat in Android Studio

  • Restart logcat (button on sidebar of Android Studio debugger panel)
  • Change the log level to Debug (or anything else) and back to Verbose.
  • Unplugging and plugging back in the device
  • Running adb kill-server && adb start-server
  • Close Android Studio and launch ddms on the command line.
  • Restart Android Studio
Clone this wiki locally