Java Question Unable to instantiate receiver error

dealsmonkey

Active Member
Licensed User
Longtime User
Hi,

I am writing a library to wrap around the Xtify SDK. I am able to connect and receive standard messages no problem, however when I try and use my own reciever, i am getting the error :


java.lang.RuntimeException: Unable to instantiate receiver com.exg.xtify.myReceiver: java.lang.ClassNotFoundException: com.exg.xtify.myReceiver in loader dalvik.system.PathClassLoader[/mnt/asec/com.exg.xtify-2/pkg.apk]


In my library, I have my main class, then the myReceiver class which extends the Broadcast Receiver on a new page.

Any thoughts please ? I have checked the complied jar and both classes are in the package.

Neil
 
Last edited:

dealsmonkey

Active Member
Licensed User
Longtime User
Maybe a different class is missing which is referenced by the receiver class?

Remove com.exg.xtify.myReceiver from the jar file and see if you get the same error message.

Thanks for the advice, I'll try that. I have been playing with the Google Cloud as well and am getting the same error when trying to initiate a receiver.

Anyways, I'll try with the class not in the jar.

Edit : Removed the class, but still same error

Neil
 
Last edited:

dealsmonkey

Active Member
Licensed User
Longtime User
Can you upload your jar file?

Here you go. One is my jar and the other is the SDK

Also this is added to the manifest.xml to override the standard receiver for the custom one.

B4X:
<receiver android:name="com.nejo.xtify.Neoreceiver">
       <intent-filter android:priority="9999">
             <action android:name="com.xtify.android.sdk.SHOW_NOTIFICATION" />
             <!-- KEEP THE FORWARD SLASH IN FRONT OF THE APP KEY ON THE LINE BELOW -->
             <data android:scheme="notif" android:host="notification.xtify.com" 
 android:pathPrefix="/my-api-key-goes-here" />
       </intent-filter>
 </receiver>





Neil
 
Last edited:

dealsmonkey

Active Member
Licensed User
Longtime User
I don't see a class named com.exg.xtify.myReceiver in the jar file.

com.exg.xtify is the name of my b4a package, so does the package name in my library have to match that ??


EDIT : Changed the package name in the library to match the b4a package name and now it works ! Does this mean then the library could not be used in any other B4a package ? :sign0104:


Neil
 
Last edited:

dealsmonkey

Active Member
Licensed User
Longtime User
The package name in Basic4android is not relevant here. You should create a myReceiver class in your library.

I think I uploaded the package with the class Neoreceiver by mistake, i was trying different names ! :sign0013:

Now I have seen the light. I have renamed the manifest XML to match the library package name and noe it works fine.

Thanks for taking the time to have a look Erel, I know understand the packaging ideals !! :BangHead:


Now, I just need to work out how to get the values passed to this class back to B4A !!

Neil
 
Last edited:

walterf25

Expert
Licensed User
Longtime User
Same Problem

Hi Erel, i'm having the same issue for about a few weeks now, and can not figure out how to solve it, and it is driving me crazy.
I have created a wrapper for a push notification ads sdk, everything works fine as far as receiving the ads and the icon drop, i have also created a BootReceiver class which extends BroadcastReceiver, and i have added this to my xml file
when i reboot my device, i get the error below



i have also created a BootReceiver service in my Basic4Android app, but i still get the same error, can you please help me with this Erel, i'm running out of hair to pull from,

your help will be greatly appreciated as always Erel.

thanks,
Walter
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…