Posts

Showing posts with the label Android Upgrade

Error : One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts

To fix the error: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts As discussed at Google I/O 2023, registering receivers with intention using the RECEIVER_EXPORTED / RECEIVER_NOT_EXPORTED flag was introduced as: Solution Outline: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { registerReceiver (broadcastReceiver, intentFilter, RECEIVER_EXPORTED) }else { registerReceiver (broadcastReceiver, intentFilter) } Exact Code: if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . TIRAMISU ) { registerReceiver( onDownloadComplete , new IntentFilter( DownloadManager . ACTION_DOWNLOAD_COMPLETE ), RECEIVER_EXPORTED ); } else { registerReceiver( onDownloadComplete , new IntentFilter( DownloadManager . ACTION_DOWNLOAD_COMPLETE )); } Ref: StackOverflow

How to Send Crash Report to Email / Mobile Device in Android Java

Thread . setDefaultUncaughtExceptionHandler ( new Thread . UncaughtExceptionHandler () { @Override public void uncaughtException ( Thread thread, Throwable throwable) { // Handle uncaught exception sendCrashReport(throwable); } });   private void sendCrashReport ( Throwable throwable) { // Collect crash information StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter( sw ); throwable.printStackTrace( pw ); String crashReport = sw .toString(); // Compose email Intent emailIntent = new Intent( Intent . ACTION_SEND ); emailIntent .setType( "message/rfc822" ); emailIntent .putExtra( Intent . EXTRA_EMAIL , new String[]{ "sidbehala@gmail.com" }); emailIntent .putExtra( Intent . EXTRA_SUBJECT , "Crash Report" ); emailIntent .putExtra( Intent . EXTRA_TEXT , crashReport ); // Launch email intent startActivity( Intent . createChooser ( emailIntent , "Send crash rep...

How to fix error : Task :app:processDebugGoogleServices FAILED Execution failed for task ':app:processDebugGoogleServices'. > No matching client found for package name 'com.example.appname'

PROBLEM: Task :app:processDebugGoogleServices FAILED Execution failed for task ':app:processDebugGoogleServices'. > No matching client found for package name 'com.example.appname'  Solution: In my case: Google Services JSON file : Step: 1 => Go to https://console.firebase.google.com/  Create New Project / Choose existing project. Click on the Android icon to add a new app to your Firebase project. Enter your Android app's package name. Also Enter App Name (Nick Name) Click Register Button. Now, google-services.json file is ready for download. Step: 2 => Download the google-services.json file from the Google Developer Console Step: 3 => Place it in the app directory of your Android project

Errors while building APK. You can find the errors in the 'Messages' view.

Go to build.gradle (:app) - App Level Add following repositories   repositories { // jcenter() mavenCentral() maven { url 'https://jitpack.io' } google() } Update all dependencies. Now you should be able to build apk.

Problems To Upgrade Android Gradle Plugin from 4.1.3 to 8.1.2 and solutions

Upgrade Android Gradle Plugin from 4.1.3  to 8.1.2  Key Challenges Installing App in my Device through USB Generate Build APK Generate Signed Bundle I faced myriads of problems while upgrading from 4.1.3  to 8.1.2. (This is my personal diary. But if anyone else finds it helpful, that will be my two cents) PROBLEMS FACED AND WAYS TO RESOLVE:  Problem: Updates available To take advantage of the latest features, improvements and fixes, we recommend that you upgrade this project's Android Gradle Plugin from 4.1.3 to 4.2.2.  Solution: In build.gradle - Project Level Set classpath "com.android.tools.build:gradle:4.2.2"  Problem: To take advantage of the latest features, improvements and fixes, we recommend that you upgrade this project's Android Gradle Plugin from 4.2.2 to 7.4.2. IIn build.gradle - Project Level Solution: classpath "com.android.tools.build:gradle:7.4.2"  Problem: Minimum supported Gradle version is 7.5. Current version is 7.2. Plea...