java.lang.NullPointerException error when trying to send SMS

850 views
Skip to first unread message

cirk...@gmail.com

unread,
Dec 27, 2015, 5:05:22 AM12/27/15
to Automate
Hi, I just discovered your App and i really like all the possibilities. Thank you for developing it!

I have a small problem, when i want to send a SMS without user input, with the "SMS send" block i get an error in the log.
The log looks like this: Flow beginning, SMS send and the comes the error.
The error reads: java.lang.NullPointerExeption: Attempt to read from field 'java.lang.String android.content.pm.PackageInfo.packageName' on a null object reference

I imagine it has something to do with not beeing able to get my default SMS app? I have chomp SMS as my default app set in the android settings.
To test it, I just created a new flow with the "Flow beginning" block and a "SMS send" block, nothing else.

When i am running the Tasker app, I can send SMS without user input without a problem.
I have all permissions installed and activated and give your app and its permission addons all rights in my android system.

When i want to send an SMS with user interaction with the "Compose SMS" block it is working perfectly. Chomp SMS opens with my predefinied message and i can send it.

I am running Android 5.1 on a Meizu M2 with Flyme OS 4.5.3.2C. The device is rooted.

Do you need any more infos?

Raliegh Fhang

unread,
Dec 27, 2015, 6:32:24 AM12/27/15
to automa...@googlegroups.com, cirk...@gmail.com
It sounds like you didn't put in any arguments. This might be a stupid question but did you place a phone number and message?

cirk...@gmail.com

unread,
Dec 27, 2015, 7:14:07 AM12/27/15
to Automate, cirk...@gmail.com
Hi, not a stupid question at all.
But i did input a phone number, message, subscription id and even set the multipart limit to 1, although it defaults to 1.

Seeing that another user has the same problem as i do, he just posted....

Lior Hadas

unread,
Dec 27, 2015, 1:15:32 PM12/27/15
to Automate, cirk...@gmail.com
sounds  very strange .
did you tried to create a flow that have just 1 block for testing the situation ? 

Henrik Lindqvist

unread,
Dec 27, 2015, 2:52:20 PM12/27/15
to Automate, cirk...@gmail.com
Please use the Help & feedback menu to send me a system log, then i may be able to see the cause.

cirk...@gmail.com

unread,
Dec 27, 2015, 3:07:47 PM12/27/15
to Automate, cirk...@gmail.com
@Lior Hadas: Yes, i created a flow with just the "beginning" block and the "send sms" block. Didnt work either.

@Henrik Lindqvist: Here is the syslog, i hope i did it right.
Link to pastebin

Thanks for looking into it!

Henrik Lindqvist

unread,
Dec 27, 2015, 3:10:23 PM12/27/15
to Automate, cirk...@gmail.com
Try using proceed "When sent" or "When delivered".

cirk...@gmail.com

unread,
Dec 27, 2015, 3:21:11 PM12/27/15
to Automate, cirk...@gmail.com
Nope, still getting the same error. Tried both options.

cirk...@gmail.com

unread,
Dec 27, 2015, 3:24:06 PM12/27/15
to Automate, cirk...@gmail.com
How should the phone number be formated?
I tried 0043680xxxxxxx, +43680xxxxxxx and 0680xxxxxxx
With both the function option and the stamp option. Sorry, dont know the proper names for these options

Henrik Lindqvist

unread,
Dec 27, 2015, 4:28:21 PM12/27/15
to Automate, cirk...@gmail.com
Any format will do.

This is a bug deep inside Android, it's likely trying to look up an app, and failing to do so.
Which is your default messaging app? Try "clear defaults" and revert back to the built-in one.

cirk...@gmail.com

unread,
Dec 28, 2015, 5:57:25 AM12/28/15
to Automate, cirk...@gmail.com
I am unfortunately getting the same error message when i am trying to send a SMS with my default SMS app.
I have tried three different ones, and am always getting the error.

In Tasker, sending SMS without user interaction is working with all three of the SMS apps.
But i would rather stay with you and your app...
I have included a debug log from tasker where i am sending a SMS. Maybe this can help you?!

Would an adb log help you out?

Debug Log from Tasker

Henrik Lindqvist

unread,
Dec 28, 2015, 7:14:14 PM12/28/15
to Automate, cirk...@gmail.com
Try leaving the Subscription id field empty.
I'll look at into the Android source trying find the cause.

cirk...@gmail.com

unread,
Dec 29, 2015, 2:51:50 AM12/29/15
to Automate, cirk...@gmail.com
Didnt work unfortunately.

Thanks for looking into the source, this is highly appreciated!!!
Just bought the Pro Version out of thankfullnes!

Henrik Lindqvist

unread,
Dec 31, 2015, 9:27:45 PM12/31/15
to Automate, cirk...@gmail.com
I'm finally able to reproduce the Android bug!
It only seem to happen when the device has multiple users.
I'll report it to Google and try to finding an workaround.

tihomir....@gmail.com

unread,
Jan 1, 2016, 5:47:10 AM1/1/16
to Automate
I have same problem but i don't have multiple users

cirk...@gmail.com

unread,
Jan 1, 2016, 6:37:07 AM1/1/16
to Automate, cirk...@gmail.com
That is great news! Thanks for taking the time and looking into it!

Afaik I either dont have multiple users set up. But anyways, fingers crossed for a fix :)

Happy new year to everyone

Henrik Lindqvist

unread,
Jan 1, 2016, 3:13:19 PM1/1/16
to Automate, cirk...@gmail.com
I spoke to soon, i managed to cause the error once by switching user. Now i can make it happen again, tried different versions for each user, etc..
I know where in the Android source the failure occurs and why, but not how it could get in that state, the app (its ActivityThread) isn't properly initialized.
Investigation continues.

cirk...@gmail.com

unread,
Jan 1, 2016, 3:30:39 PM1/1/16
to Automate, cirk...@gmail.com
Highly appreciated!

Go, go Inspector Gadget ;)

Adriano Marzano de Carvalho

unread,
Jan 1, 2016, 5:11:46 PM1/1/16
to Automate
Happy new year to all of you, guys!
I don't have this issue, but I follow all threads.

@Henrik, your devotion is unbelievable. You deserve a LOT of users, fans and followers. Your work is awesome, congratz!!

Chris

unread,
May 30, 2016, 2:05:19 PM5/30/16
to Automate
Hi all,

I have the same problem with my Doogee X5. I tried with the stock rom v18 and with several custom roms. Sending SMS leads to NullPointerException error!

Is there any workaround?

Henrik "The Developer" Lindqvist

unread,
May 31, 2016, 9:50:09 PM5/31/16
to Automate
Sadly no, not what i know of.

mszi...@gmail.com

unread,
Jun 3, 2016, 5:20:07 AM6/3/16
to Automate
Hello,
Similar to the experience for me. The rights that are installed on. I have been "warn" alert is sent when the log-in, but the SMS will be sent.
We somehow managed to solve it?
Thanks M.

mszi...@gmail.com

unread,
Jun 3, 2016, 12:48:39 PM6/3/16
to Automate, mszi...@gmail.com
I managed to try a different phone, and I noticed the difference that access is not the same. There are two kinds of requests:
Permissions:

1: "Potentially Costly"

It's ok

2: "Telephony"

Here's the difference.

The more the phone at which it works, there's Edit ( "SMS or MMS) is.
The other, which does not work, there is only mention of "Phone Status and ID reading".

It helps?

Henrik "The Developer" Lindqvist

unread,
Jun 3, 2016, 2:48:28 PM6/3/16
to Automate, mszi...@gmail.com
Thanks for reporting your findings.
Please post screenshots of "Manager permission" settings screen so i can see the permissions included in the "Potentially costly" and "Telephony" groups.
Maybe some permission are somehow missing on some devices.

mszi...@gmail.com

unread,
Jun 3, 2016, 3:29:57 PM6/3/16
to Automate, mszi...@gmail.com


I tried multiple machines tablet and phone.

For now, a tablet does not work properly, this does not work which is Android 4.4.2. That's all I can see the difference.

mszi...@gmail.com

unread,
Jun 3, 2016, 3:34:20 PM6/3/16
to Automate, mszi...@gmail.com
The "Telephony" is not the same, of course, also I tried installed.
Sorry about the "good" screenshots :)

mszi...@gmail.com

unread,
Jun 3, 2016, 3:57:34 PM6/3/16
to Automate, mszi...@gmail.com

mszi...@gmail.com

unread,
Jun 3, 2016, 3:58:09 PM6/3/16
to Automate, mszi...@gmail.com
The error is NOT in the post titled "Getting a java.lang.NullPointerException error When Trying to send SMS"


It just acts as if sending the SMS, but it is not actually sent. The sender works counter. For example, SMS 10 hours, but does not send any.

mszi...@gmail.com

unread,
Jun 3, 2016, 4:00:10 PM6/3/16
to Automate, mszi...@gmail.com

Henrik "The Developer" Lindqvist

unread,
Jun 4, 2016, 2:28:32 PM6/4/16
to Automate, mszi...@gmail.com
On the "does not work" device it seems you haven't installed the "Telephony" permission add-on, the button still say "Install permission".

mszi...@gmail.com

unread,
Jun 5, 2016, 1:55:03 AM6/5/16
to Automate, mszi...@gmail.com

Unfortunately, you still can not send a message. I tried another "SIM" card.


mszil...@gmail.com

unread,
Jul 4, 2016, 3:54:28 PM7/4/16
to Automate, mszi...@gmail.com

mszil...@gmail.com

unread,
Jul 4, 2016, 3:55:13 PM7/4/16
to Automate, mszi...@gmail.com, mszil...@gmail.com
I think there is some softvare or adjustment due.

madees...@gmail.com

unread,
Jul 19, 2016, 2:41:50 PM7/19/16
to Automate
Hello,
I'm having the same problem with a P8000 phone on Android 6, it was working great on 5.1
Still no solution ?

Florian HubSpace

unread,
Jul 19, 2016, 3:17:26 PM7/19/16
to automa...@googlegroups.com, madees...@gmail.com
It is remaining on the known issues-list.
Line 3: High - Need Info - VM:Block - SMS send: no error but doesn't send messages, NullPointerException for PackageInfo.packageName on some devices

I never had any problems with the sms block.

Henrik "The Developer" Lindqvist

unread,
Jul 19, 2016, 3:42:39 PM7/19/16
to automa...@googlegroups.com, madees...@gmail.com
Here's the same issue in another app:
https://github.com/WhisperSystems/Signal-Android/issues/5151

Stack overflow:
http://stackoverflow.com/questions/4580952/why-do-i-get-nullpointerexception-when-sending-an-sms-on-an-htc-desire-or-what

Does the device have multiple users, is Automate running as the "primary user"?

madees...@gmail.com

unread,
Jul 19, 2016, 3:55:04 PM7/19/16
to Automate
I have only one user on my phone.
I found a way, I use Locale Sens SMS plugin (I have not installed Locale app) and it works

madees...@gmail.com

unread,
Jul 20, 2016, 1:31:47 AM7/20/16
to Automate

mszil...@gmail.com

unread,
Aug 8, 2016, 3:28:03 PM8/8/16
to Automate, madees...@gmail.com
Hi, 
It was not my device, but I have used.
I could not figure out why you did it, it was a lot of software users, and two were on it. Some of the security settings were strictly used.
I think it was a mistake due to some software.

totally...@gmail.com

unread,
Aug 25, 2016, 3:56:22 AM8/25/16
to Automate
Hey. Same problem with Philips Xenium v377 any ideas?

Henrik "The Developer" Lindqvist

unread,
Aug 25, 2016, 2:37:29 PM8/25/16
to Automate, cirk...@gmail.com
Anyone willing to test nightly builds with possible workarounds, e-mail me at in...@llamalab.com

fullv...@gmail.com

unread,
Sep 20, 2016, 1:55:37 PM9/20/16
to Automate
Has a resolution been found? I can test nightlys

Henrik "The Developer" Lindqvist

unread,
Sep 20, 2016, 2:23:46 PM9/20/16
to Automate, fullv...@gmail.com
Please email me at in...@llamalab.com so i can send you the APK.

Henrik "The Developer" Lindqvist

unread,
Sep 21, 2016, 2:31:34 PM9/21/16
to Automate, fullv...@gmail.com
Thanks for helping me tests a couple of possible workarounds.
Conclusion so far:
It's not caused by sending from a background (non-main) thread.
It's not caused by the SEND_SMS permission being in the separate add-on app.
Only remaining cause i can think of is Automate's use of sharedUserId, multiple apps sharing the same process.


 
On Tuesday, September 20, 2016 at 7:55:37 PM UTC+2, fullvoidftw wrote:

josh beaker

unread,
Sep 21, 2016, 2:34:03 PM9/21/16
to Henrik "The Developer" Lindqvist, Automate

Your dedication on this is a testament to this app

saffl...@gmail.com

unread,
Dec 21, 2016, 8:05:56 PM12/21/16
to Automate, madees...@gmail.com
But thats for another app isn't it? - So how did you get it to work with automate please?

Henrik "The Developer" Lindqvist

unread,
Dec 21, 2016, 8:20:04 PM12/21/16
to Automate, madees...@gmail.com, saffl...@gmail.com
Using the Plug-in action block.

saffl...@gmail.com

unread,
Dec 21, 2016, 8:52:33 PM12/21/16
to Automate, madees...@gmail.com, saffl...@gmail.com
Ok tried that... disappointing.

There is no way to set the message or phone number dynamically from within the flow :*(

How is Tasker surviving this bug? - I have Tasker setup to auto reply to missed callers and even let them turn up my ring volume (which it then acknowledges). It works flawlessly... so what is the author of Tasker doing differently?

It's the same phone, same OS, same android permission.... but a different author... and it works.

If I may make a suggestion, I think you need to make contact and ask them  - or decompile their app to find out lol. Alternatively SMS scheduler works well too so that may be another source of information.

Jay

Henrik "The Developer" Lindqvist

unread,
Dec 21, 2016, 9:13:09 PM12/21/16
to Automate, madees...@gmail.com, saffl...@gmail.com
For what the test concluded, the only possible difference would be that Automate uses a sharedUserId to facilitate run-time permissions, i.e the extension.
This is a bug in some manufacturer Android builds, not Automate. However i'd certainly like to work around it, but i haven't found away to do it yet.
I'll see if i can make a few more test.

saffl...@gmail.com

unread,
Dec 21, 2016, 9:22:02 PM12/21/16
to Automate, madees...@gmail.com, saffl...@gmail.com
With respect, I've seen you mention this being a bug in android previously yet I have two other apps installed (Tasker and SMS Scheduler) that both send SMS with no problem. This leads me to conclude that you are either missing something or have gone about things in a way that doesn't work properly for android. It's the only possible explanation.

Also when I search for that exception via google, it keeps turning up threads relating to Automate. When I add the word Tasker into the search nothing turns up - but Automate results still show up so it IS pretty much an Automate-only problem.

I don't know if you need to include an extra binary or call a different lower level function (instead of the default sms function) or what... but there is *SOMETHING* that android is not happy about with your code for some reason.

If this were written in php or object pascal I'd nail it for you. Unfortunately despite having android studio installed I'd have no idea where to start on this as i've never actually got around to trying it or java so i'm afraid you're on your own still.

But keep investigating... you CAN solve this!

Jay

Henrik "The Developer" Lindqvist

unread,
Dec 22, 2016, 2:48:42 PM12/22/16
to Automate, madees...@gmail.com, saffl...@gmail.com
Sending SMS works on most devices using the exact same (very simple) code, so it's not an Automate bug. I'm aware that other less complex apps have no issue sending SMS!
It's some totally unrelated issue that's preventing Automate for sending. It's not caused by sending from another "non-main" thread, neither is it declaring the required permission in an external plugin app, using a "share process" may be it, but it's not easily tested nor fixed since it's a core system feature that Automate currently relies on.

I'll make and share some additional test build/apps.

saffl...@gmail.com

unread,
Dec 22, 2016, 4:44:00 PM12/22/16
to Automate, madees...@gmail.com, saffl...@gmail.com
Well if it is the share process thing then i would class that as an automate bug.

Whatever it is, it is unique to automate so I do not class this as an android glitch - sorry if that causes any bad feeling but you need to be realistic about this. Other apps work, yours doesn't. There is a reason for that.

Let me know when you have test apps ready, if i get chance i'll help test them.

Henrik "The Developer" Lindqvist

unread,
Dec 23, 2016, 2:41:14 PM12/23/16
to Automate, madees...@gmail.com, saffl...@gmail.com
No, the "shared process" feature is core Android feature, which seems to cause issues on some devices, that's likely the reason.
Automate is just relying on a sometimes buggy system feature that few other apps use.

brai...@gmail.com

unread,
Dec 29, 2016, 7:54:17 AM12/29/16
to Automate, madees...@gmail.com, saffl...@gmail.com
On Thursday, December 22, 2016 at 4:13:09 AM UTC+2, Henrik "The Developer" Lindqvist wrote:
For what the test concluded, the only possible difference would be that Automate uses a sharedUserId to facilitate run-time permissions, i.e the extension.
This is a bug in some manufacturer Android builds, not Automate. However i'd certainly like to work around it, but i haven't found away to do it yet.
I'll see if i can make a few more test.

Send SMS without user interaction does not work also for me: Android 6.0 on Lenovo A7000 ! 
Same error, tried different parameters, subscription id's, anything!
java.lang.NullPointerException: Attempt to read from field 'java.lang.String android.content.pm.PackageInfo.packageName' on a null object reference

Teo
 

Henrik "The Developer" Lindqvist

unread,
Jan 2, 2017, 8:23:48 PM1/2/17
to Automate, cirk...@gmail.com

aman.v...@gmail.com

unread,
Dec 19, 2018, 10:50:23 AM12/19/18
to Automate
Happened to my Application too. The device is Xiaomi Redmi 5A android 7.1.2
Reply all
Reply to author
Forward
0 new messages