Meshtastic-Android/app/build.gradle
geeksville 38b4bc255c 0.7.90 read on if you want to see the stories of bluetooth trauma #76
So I'm trying to get an old version of bluetooth on Sony phones to work
In the process I realized I've always been doing something dumb which
bastically works fine, but is an ugly hack I also did to support old
devices.  Due to an accident of history there were two different layers
of the app which were trying to manage bluetooth connections, which was
dumb.  Always only one layer of an app should worry about such things.

/**
     * Should we automatically try to reconnect when we lose our connection?
     *
     * Originally this was true, but over time (now that clients are smarter and need to build
     * up more state) I see this was a mistake.  Now if the connection drops we just call
     * the lostConnection callback and the client of this API is responsible for reconnecting.
     * This also prevents nasty races when sometimes both the upperlayer and this layer decide to reconnect
     * simultaneously.
     */
2020-07-04 17:40:44 -07:00

160 lines
5.8 KiB
Groovy

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlinx-serialization'
apply plugin: 'com.google.gms.google-services'
// Apply the Crashlytics Gradle plugin
apply plugin: 'com.google.firebase.crashlytics'
// protobuf
apply plugin: 'com.google.protobuf'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.geeksville.mesh"
minSdkVersion 21 // The oldest emulator image I have tried is 22 (though 21 probably works)
targetSdkVersion 29
versionCode 10790 // format is Mmmss (where M is 1+the numeric major number
versionName "0.7.90"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
pseudoLocalesEnabled true
}
}
defaultConfig {
// We have to list all translated languages here, because some of our libs have bogus languages that google play
// doesn't like and we need to strip them (gr)
resConfigs "cs", "de", "en", "es", "fi", "fr", "ga", "it", "ja", "nl", "ru", "sk", "sl", "sv", "tr", "zh"
// Needed to make mapbox work inside the firebase testlab - FIXME, alas, still doesn't work
ndk {
// abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
}
}
buildFeatures {
// Enables Jetpack Compose for this module
// compose true // NOTE, if true main app crashes if you use regular view layout functions
}
// Set both the Java and Kotlin compilers to target Java 8.
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
composeOptions {
//kotlinCompilerVersion "1.3.61-dev-withExperimentalGoogleExtensions-20200129"
//kotlinCompilerExtensionVersion "$compose_version"
}
}
androidExtensions {
experimental = true
}
// per protobuf-gradle-plugin docs, this is recommended for android
protobuf {
protoc {
artifact = 'com.google.protobuf:protoc:3.9.0'
}
generateProtoTasks {
all().each { task ->
task.builtins {
java {
// use the smaller android version of the library
option "lite"
}
}
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.3.0'
implementation 'androidx.fragment:fragment-ktx:1.2.5'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta7'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.viewpager2:viewpager2:1.0.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.2.0'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
// kotlin serialization
implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime:0.20.0"
// rate this app
implementation "com.vorlonsoft:androidrate:1.2.1"
// Coroutines
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
// You need to depend on the lite runtime library, not protobuf-java
// For now I'm not using javalite, because I want JSON printing
//implementation 'com.google.protobuf:protobuf-java:3.11.1'
//implementation 'com.google.protobuf:protobuf-java-util:3.11.1'
implementation 'com.google.protobuf:protobuf-javalite:3.12.2'
// For UART access
// implementation 'com.google.android.things:androidthings:1.0'
implementation 'com.github.mik3y:usb-serial-for-android:v2.2.2'
// mapbox
implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:9.1.0'
// mapbox specifies a really old version of okhttp3 which causes lots of API warnings. trying a newer version
implementation 'com.squareup.okhttp3:okhttp:4.7.2'
// location services
implementation 'com.google.android.gms:play-services-location:17.0.0'
// For Google Sign-In (owner name accesss)
implementation 'com.google.android.gms:play-services-auth:18.0.0'
// Add the Firebase SDK for Crashlytics.
implementation 'com.google.firebase:firebase-crashlytics:17.1.0'
// alas implementation bug deep in the bowels when I tried it for my SyncBluetoothDevice class
// implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.3"
// add SDKs for any other desired Firebase products
// https://firebase.google.com/docs/android/setup#available-libraries
// barcode support
// per https://github.com/journeyapps/zxing-android-embedded for support of android version 22
implementation('com.journeyapps:zxing-android-embedded:4.1.0') { transitive = false }
implementation 'com.google.zxing:core:3.4.0'
def work_version = "2.3.4"
// Work Request - used to delay boot event handling
// implementation "androidx.work:work-runtime:$work_version"
implementation "androidx.work:work-runtime-ktx:$work_version"
implementation project(':geeksville-androidlib')
}