shivao-projeto/mobile/android/app/build.gradle
PontualTech / Karlão 70b123735e
Some checks are pending
Build Android (APK + AAB) / build-android (push) Waiting to run
fix(ble): remove wake-up do path Capacitor (crashava plugin) v1.10.17
Karlão reportou que toda vez que tenta parear no APK, o app fecha
sem alert popup = crash nativo do plugin BLE Java.

Hipótese: as chamadas extras que adicionei (ble.read no notify char +
ble.write/writeWithoutResponse com 0x5A x4 wake bytes) crashavam o
plugin v6 em algum estado inválido.

Fix: remover wake-up sequence do path Capacitor. Mínimo viável:
1. ble.connect
2. ble.getServices
3. ble.startNotifications
4. delay 800ms
5. write JBD-0x03 com wnr forçado

A descoberta no PC (Web Bluetooth) confirmou que JBD-0x03 direto
(sem wake) já é suficiente — BMS responde com 41 bytes em 3 chunks.

startNotifications agora também envolto em try/catch que retorna
false se falhar (em vez de propagar exception nativa).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 14:44:16 -03:00

63 lines
2.4 KiB
Groovy

apply plugin: 'com.android.application'
android {
namespace "br.com.pontualtech.shivao"
compileSdk rootProject.ext.compileSdkVersion
defaultConfig {
applicationId "br.com.pontualtech.shivao"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 30
versionName "1.10.17"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
// Default: https://android.googlesource.com/platform/frameworks/base/+/282e181b58cf72b6ca770dc7ca5f91f135444502/tools/aapt/AaptAssets.cpp#61
ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~'
}
}
signingConfigs {
release {
storeFile file('shivao-release.keystore')
storePassword 'ShivaoKeystore2026!'
keyAlias 'shivao'
keyPassword 'ShivaoKeystore2026!'
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
}
repositories {
flatDir{
dirs '../capacitor-cordova-android-plugins/src/main/libs', 'libs'
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
implementation "androidx.coordinatorlayout:coordinatorlayout:$androidxCoordinatorLayoutVersion"
implementation "androidx.core:core-splashscreen:$coreSplashScreenVersion"
implementation project(':capacitor-android')
testImplementation "junit:junit:$junitVersion"
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
implementation project(':capacitor-cordova-android-plugins')
}
apply from: 'capacitor.build.gradle'
try {
def servicesJSON = file('google-services.json')
if (servicesJSON.text) {
apply plugin: 'com.google.gms.google-services'
}
} catch(Exception e) {
logger.info("google-services.json not found, google-services plugin not applied. Push Notifications won't work")
}