Android Question Help Interpret Error on MotoG5 Plus

canalrun

Well-Known Member
Licensed User
Longtime User
Hello,
I got an error report from Google Play. The person is using a Motorola Moto G Plus (5th Gen), 2048MB RAM, Android 7.0.

The user claims the app crashes as soon as he presses on a TextInput field to enter text.

The app doesn't crash on the half a dozen phones and tablets I have tested on (mostly Samsung and LG although one Chinese Android 7.0 phone)

The crash report I received from Google Play is:
B4X:
android.content.res.Resources$NotFoundException:
  at android.content.res.ResourcesImpl.getValue (ResourcesImpl.java:190)
  at android.content.res.Resources.loadXmlResourceParser (Resources.java:2094)
  at android.content.res.Resources.getLayout (Resources.java:1111)
  at android.view.LayoutInflater.inflate (LayoutInflater.java:424)
  at android.view.LayoutInflater.inflate (LayoutInflater.java:377)
  at android.widget.Editor$SuggestionsPopupWindow.initContentView (Editor.java:3358)
  at android.widget.Editor$PinnedPopupWindow.<init> (Editor.java:3040)
  at android.widget.Editor$SuggestionsPopupWindow.<init> (Editor.java:3324)
  at android.widget.Editor.replace (Editor.java:356)
  at android.widget.Editor$3.run (Editor.java:2129)
  at android.os.Handler.handleCallback (Handler.java:751)
  at android.os.Handler.dispatchMessage (Handler.java:95)
  at android.os.Looper.loop (Looper.java:154)
  at android.app.ActivityThread.main (ActivityThread.java:6123)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:867)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:757)

To me this looks like it is looking for a specific resource in an XML file.

Can anyone explain, at a glance, what causes this error. This is the only phone for which I have received a crash report.

Thanks,
Barry.
 

DonManfred

Expert
Licensed User
Longtime User
Hiding the code used is a great help for us to help.
 
Upvote 0

canalrun

Well-Known Member
Licensed User
Longtime User
Hiding the code used is a great help for us to help.

Thanks, but there is no code!

The user reports that simply tapping on an EditText control within my single Activity, single layout app causes the app to crash. In the Google Play error report I get the error shown above. This only happens with the Motorola model phone shown above.

None of my code is executing when this error occurs. It is caused entirely by the user tapping the EditText control.

My guess:
Tapping on the EditText control causes the soft keyboard to open. The soft keyboard requires a resource that is not available causing the error. This is only a guess. I am hoping someone will offer the correct reason (or maybe something that confirms my guess).


Thanks,
Barry.
 
Last edited:
Upvote 0

canalrun

Well-Known Member
Licensed User
Longtime User
What is the targetSdkVersion of your app ?

Thanks. I just realized I forgot to update the Manifest. This is an app that I originally wrote five or six years ago.

I recently updated it to remove ads and update the UI a little bit. It's a free app. I am not overly concerned that it crashes on a certain phone.

But, I see that Admob stuff is still in the Manifest.

I did not use Target SDK Version. The Min SDK Version is 4.

AddManifestText(
<uses-sdk android:minSdkVersion="4" />
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.

'AdMob
AddApplicationText(
<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation"/>
)
AddPermission(android.permission.INTERNET)
AddPermission(android.permission.ACCESS_NETWORK_STATE)
'End of AdMob

Thanks,
Barry.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
You are not setting targetSdkVersion (don't ignore the warnings...). This means that your app uses the old Android 2.x theme.
Some devices no longer support it properly.

You should start with setting it to 19 and as DonManfred just wrote, we will soon be forced to set it to 26 (https://www.b4x.com/search?query=targetSdkVersion)
 
Upvote 0

canalrun

Well-Known Member
Licensed User
Longtime User
Thanks all.

I'm sure you uncovered the problem.

The error sounds a lot like the specific phone does not support the Android 2.x theme.

I will update the manifest and get rid of the unnecessary Admob stuff also.

I'm hoping to update any apps before August so I don't have to worry about 26 :D.

Barry.
 
Upvote 0

canalrun

Well-Known Member
Licensed User
Longtime User
I modified the manifest setting Target SDK to 19 and removed the unnecessary Admob stuff.

The user reports that it now works on his Moto G - no error when the soft keyboard opens.

Thanks,
Barry.
 
Upvote 0
Top