Skip to content

Commit

Permalink
Crash fixes
Browse files Browse the repository at this point in the history
+ migrated from minimum API 14 to API 19
+ replaced Firebase Bill-of-Materials with individual deps
+ fixed TTS Check crash
  • Loading branch information
AwaisKing committed Dec 19, 2021
1 parent a1037d3 commit 5e455fd
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 17 deletions.
27 changes: 14 additions & 13 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,17 @@ plugins {
id 'com.google.firebase.crashlytics'
}

def sdkVersion = 31 // todo change to 31 for building, 30 for sources
android {
compileSdk sdkVersion
compileSdk 31

defaultConfig {
applicationId 'awais.backworddictionary'

minSdk 16
targetSdk sdkVersion
minSdk 19
targetSdk 31

versionCode 119
versionName '11.9'
versionCode 120
versionName '12.0'

multiDexEnabled true

Expand Down Expand Up @@ -79,14 +78,16 @@ allprojects {

dependencies {
implementation('androidx.multidex:multidex:2.0.1@aar') { transitive true }
implementation('androidx.appcompat:appcompat:1.4.0-beta01@aar') { transitive true }
implementation('androidx.work:work-runtime:2.7.1@aar') { transitive true }
implementation('androidx.recyclerview:recyclerview:1.3.0-alpha01@aar') { transitive true }
implementation('com.google.android.material:material:1.5.0-alpha04@aar') { transitive true }
implementation('com.google.android.material:material:1.6.0-alpha01@aar') {
transitive true
exclude group: 'androidx.work', module: 'work-runtime'
}

implementation 'com.google.android.gms:play-services-ads:20.4.0'
implementation('com.google.android.gms:play-services-ads:20.5.0') { exclude group: 'androidx.work', module: 'work-runtime' }

implementation platform('com.google.firebase:firebase-bom:28.4.2')
implementation 'com.google.firebase:firebase-core'
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-crashlytics'
implementation('com.google.firebase:firebase-core:20.0.2') { exclude group: 'androidx.work', module: 'work-runtime' }
implementation('com.google.firebase:firebase-analytics:20.0.2') { exclude group: 'androidx.work', module: 'work-runtime' }
implementation('com.google.firebase:firebase-crashlytics:18.2.6') { exclude group: 'androidx.work', module: 'work-runtime' }
}
10 changes: 8 additions & 2 deletions app/src/main/java/awais/backworddictionary/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import android.view.Window;
import android.view.inputmethod.InputMethodManager;
import android.widget.TextView;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
Expand Down Expand Up @@ -145,8 +146,13 @@ protected void onCreate(final Bundle savedInstanceState) {
setSupportActionBar(mainBinding.toolbar);

// check for tts before initializing it
startActivityForResult(new Intent(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA),
TTS_DATA_CHECK_CODE);
try {
startActivityForResult(new Intent(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA),
TTS_DATA_CHECK_CODE);
} catch (final Throwable e) {
// tts check activity not found
Toast.makeText(Main.this, R.string.tts_act_not_found, Toast.LENGTH_SHORT).show();
}

final ViewGroup.LayoutParams fabParams = mainBinding.fabOptions.getLayoutParams();
mainBinding.fabOptions.setLongClickListener(v -> {
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
<string name="reset_tts">Reset TTS Settings</string>

<string name="tts_not_initialized">Text-to-Speech is not initialized…</string>
<string name="tts_act_not_found">Text-to-Speech check activity not found.\nSkipping TTS check…</string>
<string name="tts_data_not_found">Text-to-Speech voice data not found!\nDo you want to open settings to install voice data?</string>

<string name="save_tts">Save TTS Settings</string>
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ buildscript {

dependencies {
classpath 'com.google.gms:google-services:4.3.10'
classpath 'com.android.tools.build:gradle:7.1.0-alpha13'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1'
classpath 'com.android.tools.build:gradle:7.1.0-beta05'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
}
}

Expand Down

0 comments on commit 5e455fd

Please sign in to comment.