Collect all kinds of android programming exceptions and fault solutions.


How to use a custom layout as RadioButton label

I made a custom layout that I want to implement for a RadioButton.
The code for the android class is here :
public class MyRadioButton extends LinearLayout implements View.OnClickListener{
pr...


com.google.firebase.FirebaseException: An internal error has occurred. [ API key not valid. Please pass a valid API key. ]

I delete my old fire-base project and create a new project.
after that I got this error.
First The error was sha 1 that why I delete the old project and create new one.
import androidx.appcompat....


Apply style to Alert Dialogs

I decided to try material alert dialogs on android.
The problem I am having is when I try to apply some styles. Checking the docs, I found this:
<item name="materialAlertDialogTheme">@style/


Flutter, content padding for TextFormField not working as expected

Flutter app, android: I am trying to reduce the bottom padding of a TextFormField (I need to fit quite a few fields onto fairly small screens [mobile android data collectors]).
I have tried using ...


Current JDK version 1.8 has a bug that prevents Room from being incremental

We're trying to improve the build times of our multi-module Android app and we've reached the point where we tried to enable incremental KAPT annotation processing compilation.
Android Studio vers...


Detox build successful but detox test fails

Following the setup provided by Detox on adding Android, the command below that builds detox works fine with no problems
detox build -c android.emu.debug
Now for the setup on the Package.json fil...


Why is AnyChart returning Null Object Reference exception?

I've been trying several tutorials for creating a simple pie chart using AnyChart and MPAndroidChart:
Android Chart Example APP using MPAndroidChart
Pie-Chart-Tutorial
MPAndroidChart - all pieces ...


FragmentDirections was not generate by Safe Args plugin

When I trying to use Safe Args plugin to jump from one fragment to another, the compiler shows "Unresolved reference: VideoFragmentDirections".
I have already set the classpath and dependency for s...


how to fetch unique id for all devices in android programmatically

I'm developing an android application ,on click of login button ,im fetching the IMIE number.
I given runtime permission also but getting imei as null only for particular mobile .How is possible ?


Android EditText: only scroll horizontally

I have defined the 2 EditTexts in a LinearLayout:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weig...


Worker not working with Samsung S10 Android 9 on background and killed app

I want do a periodic process, show notifications every X min, with app closed, on background, etc.
I use worker manager, work fine on simulator Pixel 2 API 28, but on my Samsung Galaxy S10 API 28 ...


Failed to resolve: com.github.mancj:MaterialSearchBar:0.8.2

I'm building an android system with help of a youtube video and when I try to sync it to fire base, it shows the following error.
ERROR: Failed to resolve: com.github.mancj:MaterialSearchBar:0.8.2...


Can't get app context (Unresolved reference)

I am trying to get the context of the app to print a Toast message. The function that I use in Java is the following:
Toast.makeText(getApplicationContext(), "Hey! I'm working", Toast.LENGTH_LONG)...


Android bitmap tileModeY="repeat" with gravity="fill_horizontal" creates ugly edge

I want to create vertically repeating background for whole app that is adjusted to width of phone.
My bitmap is:
resources/drawable/repeating_bitmap.xml
<?xml version="1.0" encoding="utf-8"...


React native Task :app:bundleReleaseJsAndAssets FAILED

I try to generate apk with cmd "gradlew assembleRelease --stacktrace" but it fails & I always get the same error message :
> Task :app:bundleReleaseJsAndAssets
The filename, directory name,...


Flutter: Gradle build failed to produce an .apk file. It's likely that this file was generated under <app_root>\build, but the tool couldn't find it

I am trying to test drive an app. I keep getting a strange issue with this problem as app fail to debug/run. SDK version is 28 while the rest is below:
Flutter 1.13.9-pre.79 • channel master • htt...


How to debug a third party flutter plugin

I'm building a flutter app which uses a third party plugin.
The plugin has a bug in its android java code.
The problem is that I'm having trouble finding documentation on how to setup a developm...


How to save SeekBar thumb position after setting value to its progress?

I'm trying to get worked a segmented SeekBar for font site with step of 2.
It's working, but I can't keep thumb position, it is always on 0.
private fun fontSize() {
val view = LayoutInflater.


displaying my toolbar image as background to status bar effecting navigation bar in android

I want my toolbar to take the space of status bar and the image used for it be the background of the status bar and I successfully do that with this code inside my activity
// for using st...


Crash with email in EditText TextInput on Xiaomi devices running android 10

Recently I got crash in google play console.
java.lang.NullPointerException:
at android.widget.Editor$SelectionModifierCursorController.access$300 (Editor.java:6696)
at android.widget.Editor.


Prevent Swiping of ViewPager2 when onTouch of inner view

I have a ViewPager2 with a fragment inside,
in the fragment, I have a custom view with certain touch logic that involves moving the finger.
how do I prevent the ViewPager from swiping while the ...


Why does the Material FAB not change colors when disabled?

I am disabling the Material Floating Action button but the color does not change when disabled is set to true. I thought Material has a theme for FAB's and when disabled it should turn light grey. ...


Android phone as USB Keyboard/HID-Gadget/

I'm looking for a possibility to use Android Smartphones as a USB-Keyboard, same as I would be using Linux Gadget and a raspberry pi with OTG port.
So I imagine it like this:
Connect Android phon...


Which Flutter APK to use for installation from apk/release/ folder

When I build apk via command
flutter build apk --spli-per-abi
It generates 3 apk in: \build\app\outputs\apk\release directory
I want to know which of the APKs we will use for uploading on play ...


Floating Action Button is not showing an image in Android?

As title is saying, I don't know how to fix this issue. I read this problem but that was in 2018, I'm not very familiar with all those libraries and dependencies how it all works. But judging from my


Is there a startSearch() function equivalent that can be used in fragments

I am developing a map in a fragment using mapView. The fragment consists of a mapView and a searchBar(mancj.materialsearchbar). I tried using startSearch() in the OnSearchActionListener() but it isnt


java.lang.IllegalStateException: Fragment no longer exists for key f0: unique id

I am a beginner in android and I am not able to understand why I am getting error. When I am clicking on the home button(Bottom Navigation bar) then I am getting this error. I am using shared prefe...


OnTouchListener for ViewPager2

I recently changed the ViewPager in my application to a ViewPager2. I had set an onTouchListener to the viewPager object to detect gestures (onFling and onLongPress), as such:
mViewPager.


How to show an incoming call when screen is locked on react-native

I'm developing a video call app with react-native-webrtc and I'm stuck now on how to show the incoming call screen when the phone is locked. I'm working now on the android part and I already tried ...


How to change the shape of Chips component in android?

When I added ChipGroup and Chips to XML, first it gave me rendering issue which caused activity crash.
I solved it by changing the support library version in the gradle.app from implementation 'com.


App Center can't locate android project if it's not at root level

I've setup a few app center android projects but they usually have the android project at the same level as the git root.
Now I have another project that is one level deeper than the git root. In ...


Flutter How can i check Battery Health

I want to check device Battery Health using Flutter the plugin Battery and the documentation didn't give any in formation about battery health it only shows you the battery state charging or not and


Is it possible to set custom permission request using cordova

I am building a cordova application that requires permission to access location, camera, etc. I would like to show a custom message to the user when requesting permission to access the data. I thou...


Show Interstitial Ad after splash screen in react native

I am developing an application in react native one of the requirements of the application in showing an interstitial ad when starting the application before it loads any component, this due to the


Remove UI element checking if table is empty from the viewmodel

Ok, i'll try to keep it simple. I'm writing an app, and one of its fragments contains a recyclerview which displays the elements inside a Room table. When the table is empty, i should display a


video call acceptance screen with Agora flutter

I'm trying to build a video calling app with Agora,i need to show acceptance screen like whatsapp when user calling,if the app is exited i need to show calling screen when user is calling ,i tried ...


Android; Type com.google.gson.ExclusionStrategy is defined multiple times:

after importing a project library i get the error
C:\Users\Jordy\AndroidStudioProjects\Application\app\build\intermediates\external_libs_dex\debug\out\classes.dex
any ideas how to fix this?


Flutter app crashes when resuming to type

I have a very simple test app that only requires users to type some text in a text box.
However when the user types few words, closes the keyboard and then taps on the text box to resume typing, ...


Not able to load wordpress post content fully in webview in wordpress app on API Level 29. But it works fine on API Level 26

I'm developing WordPress app which fetches post from Wordpress site & loads it in webview. I'm using "WP REST API" (fetch post data in JSON) & retrofit library. In API 26 app is working fine


Set or Send GPS Location for Android-x86 VM

I've got Android X86 9.0r2 running in a VM. I'd like to test the effect of various locations from GPS on an app.
I've connected to it using Python's adb_shell from another VM:
>>> device...


Getting this error "Modules 'base' and 'moduleA' contain entry 'res/drawable/xyz.xml' with different content."

moduleA is a dynamic feature module with dependency which is an aar lib.
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':app')


Background Service Video Recorder in Android 10 (Q)

I am developing an application that works only by android services, with no user action.
I would like to create a background video recorder that only uses a service.
I found several projects but t...


JSON from Google Sheet to Android gives garbage

I get a list of data from a google sheet into my android app. The Google Script runs properly and the test run also provides the correct output. However, the JSON data received in the android app l...


systrace.py not able to download capture logs in Ubuntu

I am running the systrace.py code for just 5 seconds using all default parameters. Capturing started and finish successfully. However, systrace.py then fails while downloading the trace. Below are ...


Android sliders with fixed numbers

I'm trying to implement a discrete slider with fixed values, but the only thing I can set is the valueFrom, valueTo and stepSize.
Here is my code how I'm trying to do
<com.google.android.mater...


How do I switch to a specific track by index in Exoplayer?

I am creating a music player using Exoplayer. If the user clicks on a specific track from recyclerview I want to play all tracks but switch to clicked index.
I am using ConcatenatingMediaSource to...


What does "Compatible side by side NDK version was not found. Default is 20.0.5594570." mean?

While synchronizing I see such warning.
Do I've to update my sdk tools?
What should I do to solve it?
Kindly help me solve the problem.


Android Bluetooth StartDiscovery() always returns false

I am trying to discover bluetooth devices nearby, but startDiscovery() always returns false, as if it is not working. Therefore it is not able to find devices.
I saw that i have to include


getting notification payload without tapping the notification in system tray?

I know I have to save the data payload in intent.putExtra in order to read the notification data when the app is in the background or killed. However, it also requires the users to open the app by


Android Studio: R.jar: The process cannot access the file because it is being used by another process

After a new installation of Android Studio 3.6.3 (portable). When I try to build and run my project, I keep getting
app\build\intermediates\compile_and_runtime_not_namespaced_r_class_jar\debug\...


Next