NPE on TextView in Android Studio - android

if (android.os.Build.VERSION.SDK_INT > Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
ShimmerTextView mShimmerTextView = (ShimmerTextView) findViewById(R.id.shimmerMotion);
new Shimmer().start(mShimmerTextView);
}
As seen is the image there are only two layout files in the respective version folders. I am testing on API 22 device and so it should pick the layout from layout-v14 but instead it is inflating the layout-v10 file.
If I click holding control on the view then android studio opens v14 layout in studio as seen in image below.
v10 layout folder does not have that view.
Why is my device picking the v10 layout to inflate instead of v14 when my device is running on API22.
When I click on the TextView it should become a shimmer text and this was working for weeks until now. But today it is throwing NPE.
08-20 20:21:21.765 18635-18635/com.ralok.antitheftalarm E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.ralok.antitheftalarm, PID: 18635
java.lang.NullPointerException: Attempt to invoke interface method 'boolean com.romainpiel.shimmer.ShimmerViewBase.isSetUp()' on a null object reference
at com.romainpiel.shimmer.Shimmer.start(Shimmer.java:150)
at com.ralok.view.HomePage.startMotionModeDetection(HomePage.java:650)
at com.ralok.view.HomePage.onClick(HomePage.java:450)
at android.view.View.performClick(View.java:4780)
at android.view.View$PerformClick.run(View.java:19866)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)`enter code here`

Related

Android Oreo's downloadable fonts exceptions

Just uploaded a new version of my app to beta with the new Downloadable Fonts and Fonts in XML features and the pre-launch report from google is showing me crashes on some devices.
LG G6, Android 7.0:
FATAL EXCEPTION: ControllerMessenger
Process: com.example.mobile, PID: 11263
java.lang.NullPointerException: Attempt to invoke a virtual method on a null object reference
at android.support.v4.graphics.TypefaceCompatUtil.mmap(TypefaceCompatUtil.java:98)
at android.support.v4.graphics.TypefaceCompatApi24Impl.createFromFontInfo(TypefaceCompatApi24Impl.java:140)
at android.support.v4.graphics.TypefaceCompat.createFromFontInfo(TypefaceCompat.java:167)
at android.support.v4.provider.FontsContractCompat.getFontInternal(FontsContractCompat.java:190)
at android.support.v4.provider.FontsContractCompat.getFontSync(FontsContractCompat.java:244)
at android.support.v4.graphics.TypefaceCompat.createFromResourcesFamilyXml(TypefaceCompat.java:124)
at android.support.v4.content.res.ResourcesCompat.loadFont(ResourcesCompat.java:390)
at android.support.v4.content.res.ResourcesCompat.loadFont(ResourcesCompat.java:336)
at android.support.v4.content.res.ResourcesCompat.getFont(ResourcesCompat.java:205)
at com.example.libs.fragments.BaseFragment.onStart(BaseFragment.java:148)
at android.support.v4.app.Fragment.performStart(Fragment.java:2287)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1458)
at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1750)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1819)
at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:797)
at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2590)
at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2377)
at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2332)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2239)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:700)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.support.test.espresso.base.Interrogator.loopAndInterrogate(Interrogator.java:148)
at android.support.test.espresso.base.UiControllerImpl.loopUntil(UiControllerImpl.java:466)
at android.support.test.espresso.base.UiControllerImpl.loopUntil(UiControllerImpl.java:420)
at android.support.test.espresso.base.UiControllerImpl.injectMotionEvent(UiControllerImpl.java:234)
at android.support.test.espresso.action.MotionEvents.sendUp(MotionEvents.java:140)
at android.support.test.espresso.action.MotionEvents.sendUp(MotionEvents.java:123)
at android.support.test.espresso.action.Tap.sendSingleTap(Tap.java:170)
at android.support.test.espresso.action.Tap.access$100(Tap.java:31)
at android.support.test.espresso.action.Tap$1.sendTap(Tap.java:46)
at android.support.test.espresso.action.GeneralClickAction.perform(GeneralClickAction.java:136)
at android.support.test.espresso.ViewInteraction$SingleExecutionViewAction.perform(ViewInteraction.java:355)
at android.support.test.espresso.ViewInteraction.doPerform(ViewInteraction.java:242)
at android.support.test.espresso.ViewInteraction.access$100(ViewInteraction.java:62)
at android.support.test.espresso.ViewInteraction$1.call(ViewInteraction.java:149)
at android.support.test.espresso.ViewInteraction$1.call(ViewInteraction.java:146)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
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:6316)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:872)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762)
Moto G4 Play, Android 6.0:
FATAL EXCEPTION: main
Process: com.example.mobile, PID: 13208
java.lang.NullPointerException: Attempt to read from field 'int android.support.v4.provider.FontsContractCompat$TypefaceResult.mResult' on a null object reference
at android.support.v4.provider.FontsContractCompat$2.onReply(FontsContractCompat.java:277)
at android.support.v4.provider.FontsContractCompat$2.onReply(FontsContractCompat.java:274)
at android.support.v4.provider.FontsContractCompat$3.onReply(FontsContractCompat.java:312)
at android.support.v4.provider.FontsContractCompat$3.onReply(FontsContractCompat.java:300)
at android.support.v4.provider.SelfDestructiveThread$2$1.run(SelfDestructiveThread.java:149)
at android.os.Handler.handleCallback(Handler.java:746)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5459)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
P8 Lite, Android 5.0:
FATAL EXCEPTION: main
Process: com.example.mobile, PID: 19646
android.view.InflateException: Binary XML file line #145: Error inflating class
at android.view.LayoutInflater.createView(LayoutInflater.java:652)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:762)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:825)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:828)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:828)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:828)
at android.view.LayoutInflater.inflate(LayoutInflater.java:523)
at android.view.LayoutInflater.inflate(LayoutInflater.java:425)
at com.example.libs.fragments.BasicBaseFragment.initView(BasicBaseFragment.java:46)
at com.example.libs.fragments.BasicBaseFragment.onCreateView(BasicBaseFragment.java:73)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:2261)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1419)
at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1750)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1819)
at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:797)
at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2590)
at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2377)
at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2332)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2239)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:700)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5538)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
at android.view.LayoutInflater.createView(LayoutInflater.java:626)
... 27 more
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.os.ParcelFileDescriptor.getFd()' on a null object reference
at android.support.v4.graphics.TypefaceCompatApi21Impl.getFile(TypefaceCompatApi21Impl.java:50)
at android.support.v4.graphics.TypefaceCompatApi21Impl.createFromFontInfo(TypefaceCompatApi21Impl.java:72)
at android.support.v4.graphics.TypefaceCompat.createFromFontInfo(TypefaceCompat.java:167)
at android.support.v4.provider.FontsContractCompat.getFontInternal(FontsContractCompat.java:190)
at android.support.v4.provider.FontsContractCompat.getFontSync(FontsContractCompat.java:244)
at android.support.v4.graphics.TypefaceCompat.createFromResourcesFamilyXml(TypefaceCompat.java:124)
at android.support.v4.content.res.ResourcesCompat.loadFont(ResourcesCompat.java:390)
at android.support.v4.content.res.ResourcesCompat.loadFont(ResourcesCompat.java:336)
at android.support.v4.content.res.ResourcesCompat.getFont(ResourcesCompat.java:205)
at com.example.libs.widget.view.MandatoryEditTextView.initialize(MandatoryEditTextView.java:179)
at com.example.libs.widget.view.MandatoryEditTextView.init(MandatoryEditTextView.java:120)
at com.example.libs.widget.view.MandatoryEditTextView.(MandatoryEditTextView.java:98)
... 30 more
I noticed in the report videos that those crashes are occurring in the first screens of the app but when i run the app myself on an emulator or a real device (Oreo or pre Oreo) this crashes dont happen.
Also, as a side note, but i think its related, i've been trying to use
<meta-data android:name="preloaded_fonts"
android:resource="#array/preloaded_fonts" />
in AndroidManifest.xml but it doesnt seem to work at all. when trying to access a font, either via xml or by code, the app crashes because the font isnt being recognized. So i decided eventually to remove this meta-data.
Help is appreciated.

How to fix Developer Console testing failure, without reference to the own code?

The Google Play Developer Console shows me the following Pre-Launch-Report, for the Galaxy S6, after uploading the APK. The other nine devices, which Google uses to test the APK, have no error.
The provided stacktrace shows none of my code lines. How can I figure out, whether this is a real problem, and how can I fix it, if it is not based on my code?
Developer Console output:
Problem: java.lang.NullPointerException: Attempt to read from field 'java.lang.String android.accounts.Account.type' on a null object reference
FATAL EXCEPTION: main
Process: com.google.android.videos, PID: 28537
java.lang.NullPointerException: Attempt to read from field 'java.lang.String android.accounts.Account.type' on a null object reference
at android.os.Parcel.readException(Parcel.java:1552)
at android.os.Parcel.readException(Parcel.java:1499)
at com.android.vending.contentfilters.IContentFiltersService$Stub$Proxy.getContentFiltersAndIntent(SourceFile:139)
at com.google.android.videos.contentfiltering.ContentFiltersManager.saveContentFiltersToPreference(SourceFile:438)
at com.google.android.videos.contentfiltering.ContentFiltersManager.access$100(SourceFile:81)
at com.google.android.videos.contentfiltering.ContentFiltersManager$1.onServiceConnected(SourceFile:423)
at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1314)
at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1331)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6837)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
Is this normal? Why do I get this error only for the Galaxy S6?

NoSuchMethodError while using setCustomInsertionActionModeCallback for API<23

I am using Nexus 6 (API 22) . I want to add some more options when user long press on Edittext. Normally when we long press on Edittext, paste popup menu will appear and I want to add some more features in addtion to paste menu.
Android documentation says, when we implement setCustomInsertionActionModeCallback we can override the behaviour but in my case it is not working. But in Nexus 6P (API 23) it is working fine.Any help will be appreciated.
This is the error I've got while implementing setCustomInsertionActionModeCallback
java.lang.NoSuchMethodError: No virtual method setCustomInsertionActionModeCallback(Landroid/view/ActionMode$Callback;)V in class L/view/WriterEditText; or its super classes (declaration of 'view.WriterEditText' appears in /data/app/-1/base.apk)
at .EditorViewManager.createEditText(EditorViewManager.java:79)
at render.EditorViewManager.createViewAtIndex(EditorViewManager.java:207)
at render.Renderer.renderContent1(Renderer.java:158)
at render.Renderer.renderContent(Renderer.java:135)
at .render.Renderer.reloadDocument(Renderer.java:704)
at EditorActivity.onCreate(EditorActivity.java:89)
at android.app.Activity.performCreate(Activity.java:5990)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
That method was added in API Level 23. You cannot use it on older devices. You are welcome to wrap your call in a Build version check:
if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.M) {
// call that method
}

Android: null pointer exception inside in SmsManager sendTextMessage

Got crash from user's device (could not reproduce by myself) during sending SMS via smsManager.sendTextMessage
User's device is Sony Xperia Z2, Android 5.1.1
Fatal Exception: java.lang.NullPointerException: Attempt to read from field 'java.lang.String android.content.pm.PackageInfo.packageName' on a null object reference
at android.os.Parcel.readException(Parcel.java:1562)
at android.os.Parcel.readException(Parcel.java:1505)
at com.android.internal.telephony.ISms$Stub$Proxy.sendTextForSubscriber(ISms.java:1306)
at android.telephony.SmsManager.sendTextMessage(SmsManager.java:270)
at com.xabber.android.ui.sms.SmsVerificationManager.requestPhoneNumberVerification(SmsVerificationManager.java:80)
at com.xabber.android.ui.RegistrationFragment1PhoneAndName.onNextPressed(RegistrationFragment1PhoneAndName.java:193)
at com.xabber.android.ui.RegistrationActivity.onClick(RegistrationActivity.java:122)
at android.view.View.performClick(View.java:4856)
at android.view.View$PerformClick.run(View.java:19956)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:211)
at android.app.ActivityThread.main(ActivityThread.java:5373)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1020)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:815)
SMS sending works excellent on my device and several others. Seems, that it is Android bug.
I could not find anything similar except for https://groups.google.com/forum/#!topic/automate-user/8gyfmMvPYDY
but they didn't solve it.

My App got errors in a galaxy tab 8 android 5

this my first post, I did an app in eclipse using google maps api v2. the app works fine in android 4.2.2 y 4.3 but in android 5.0 the app crashed with this error:
java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.android.gms.maps.GoogleMap com.google.android.gms.maps.MapFragment.getMap()' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2790)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2855)
at android.app.ActivityThread.access$900(ActivityThread.java:181)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1474)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6117)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.android.gms.maps.GoogleMap com.google.android.gms.maps.MapFragment.getMap()' on a null object reference
at com.alezanper.reporter.F_map.MapInit(F_map.java:97)
at com.alezanper.reporter.F_map.onCreateView(F_map.java:65)
at android.app.Fragment.performCreateView(Fragment.java:2114)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:904)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1082)
at android.app.BackStackRecord.run(BackStackRecord.java:833)
at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1467)
at android.app.Activity.performStart(Activity.java:6411)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2753)
... 10 more
It seems that your map is not correctly initialized. You should debug it with Android Studio by placing a breakpoint when you initialize your map to see what happen.

Categories

Resources