Skip to content

Instantly share code, notes, and snippets.

View ivangarzab's full-sized avatar

Iván Garza Bermea ivangarzab

View GitHub Profile
dependencies {
// ...
// Declare the dependency for the Firebase Crashlytics NDK library.
// If you previously declared Firebase Crashlytics dependency, replace it.
implementation 'com.google.firebase:firebase-crashlytics-ndk:VERSION_NUMBER'
}
android {
// ...
buildTypes {
release {
>./gradlew app:assembleBUILD_VARIANT\
app:uploadCrashlyticsSymbolFileBUILD_VARIANT
android {
...
}
tasks.whenTaskAdded { task ->
if (task.name.startsWith('assemble') && task.name != "assembleReleaseAndroidTest" && task.name != "assembleDebugAndroidTest") {
task.finalizedBy "uploadCrashlyticsSymbolFile" + task.name.substring('assemble'.length())
}
}
@ivangarzab
ivangarzab / icon-Manifest.xml
Created September 3, 2022 00:26
Example Manifest file using an icon attr.
<application
...
android:name=".app.MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
...>
</application>
@ivangarzab
ivangarzab / roundIcon-Manifest.xml
Created September 3, 2022 00:29
Example Manifest file using an icon & roundIcon attrs.
<application
...
android:name=".app.MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
...>
</application>
@ivangarzab
ivangarzab / ic_launcher.xml
Created September 3, 2022 00:32
Example of an Adaptive Icon XML file.
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@mipmap/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
<monochrome android:drawable="@drawable/ic_launcher_monochrome"/>
</adaptive-icon>
@ivangarzab
ivangarzab / CustomViewExtension.kt
Created September 7, 2022 01:36
Example on how to create a "custom object" in Android using Data Binding + Kotlin Extensions
fun ExampleViewBinding.bind(
resources: Resources,
onAction: (Any) -> Unit
) {
this.title = resources.getString(R.string.title)
this.setSaveClickListener {
this.subtitle = when (someData) {
true -> R.string.subtitle1
false -> R.string.subtitle2
}
@ivangarzab
ivangarzab / get-theme-attr.kt
Created September 12, 2022 22:53
Get a theme attribute programmatically
val typedValue = TypedValue()
theme.resolveAttribute(android.R.attr.textColor, typedValue, true)
val color = typedValue.data()
@ivangarzab
ivangarzab / error-play:core-duplicate-classes.kt
Last active October 2, 2022 15:46
Duplicate classes error for outdated play:core dependency.
Duplicate class com.google.android.play.core.common.IntentSenderForResultStarter found in modules jetified-core-1.10.3-runtime (com.google.android.play:core:1.10.3) and jetified-core-common-2.0.0-runtime (com.google.android.play:core-common:2.0.0)
Duplicate class com.google.android.play.core.common.LocalTestingException found in modules jetified-core-1.10.3-runtime (com.google.android.play:core:1.10.3) and jetified-core-common-2.0.0-runtime (com.google.android.play:core-common:2.0.0)
Duplicate class com.google.android.play.core.common.PlayCoreDialogWrapperActivity found in modules jetified-core-1.10.3-runtime (com.google.android.play:core:1.10.3) and jetified-core-common-2.0.0-runtime (com.google.android.play:core-common:2.0.0)
Duplicate class com.google.android.play.core.listener.StateUpdatedListener found in modules jetified-core-1.10.3-runtime (com.google.android.play:core:1.10.3) and jetified-core-common-2.0.0-runtime (com.google.android.play:core-common:2.0.0)
Duplicate class com.google.android.play.core
@ivangarzab
ivangarzab / play-asset-delivery.kt
Created October 2, 2022 15:59
Integrate Google Play Store's Asset Delivery dependency
dependencies {
...
implementation 'com.google.android.play:asset-delivery:2.0.0'
// Kotlin users may also add the Kotlin extensions library
implementation 'com.google.android.play:asset-delivery-ktx:2.0.0'
...
}