I am trying to connect to pusher in android using pusher-java-client1.2.1 library and my code for connection is given below
if(Utils.isOnline(mcontext)) {
PusherOptions pOptions = new PusherOptions();
pOptions.setAuthorizer(new HttpAuthorizer(Constants.PUSHER_AUTH_SRC_URL + "/auth.php"));
pusher = new Pusher(Constants.PUSHER_KEY, pOptions);
pusher.connect();
channel = pusher.subscribe(Utils.getPref(mcontext, "channel_name", ""));
Utils.setPref(mcontext, "OtherUserId", "");
}else{
Utils.setCustomToast(mcontext,Constants.NO_INTERNET,false);
}
and my this code is working fine in android 5.0 and above versions but in android 4.4 application crashes with following logcat output
java.lang.NoClassDefFoundError: com.pusher.client.util.Factory
at com.pusher.client.Pusher.<init>(Pusher.java:83)
at com.driversafe.chat.MessageStatusApiCalling.pusherConnect(MessageStatusApiCalling.java:62)
at com.driversafe.chat.ApplicationLifeCycleHandler.onActivityCreated(ApplicationLifeCycleHandler.java:27)
at android.app.Application.dispatchActivityCreated(Application.java:189)
at android.app.Activity.onCreate(Activity.java:903)
at android.support.v4.app.BaseFragmentActivityDonut.onCreate(BaseFragmentActivityDonut.java:39)
at android.support.v4.app.FragmentActivity.onCreate(FragmentActivity.java:298)
at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:84)
at com.driversafe.SplashActivity.onCreate(SplashActivity.java:57)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
can any body suggest me the solution of this problem
The Problem was in dependencies i have used google-play-service google play service and pusher-java-client are confliction sor i resolved issue by using specific dependencies google-play-service-gcm
Related
I am trying to make an app based on Cordova that is able to send Notifications via FireBase Cloud Messaging
Here the MainActivity.java
public class MainActivity extends CordovaActivity
{
#Override
public void onCreate(Bundle savedInstanceState)
{
Intent i=new Intent(this,NotificationService.class);
startService(i);
super.onCreate(savedInstanceState);
// Set by <content src="index.html" /> in config.xml
Helper mhelper=new Helper(this,appView);
FirebaseMessaging.getInstance().subscribeToTopic("Testing");
Log.d("Message","Subscribed To Testing");
Log.d("Token",FirebaseInstanceId.getInstance().getToken());
loadUrl(launchUrl);
}
}
However I am getting a Illegal State Exception at Line 49:
FirebaseMessaging.getInstance().subscribeToTopic("Testing");
The rest Manifest.xml etc. are the same as the sample provided here
https://github.com/firebase/quickstart-android/tree/master/messaging
In the Logcat, the error it is showing is::
FATAL EXCEPTION: main
Process: careerage.jobseeker.app, PID: 5764
java.lang.RuntimeException: Unable to start activity ComponentInfo{careerage.jobseeker.app/careerage.jobseeker.app.MainActivity}: java.lang.IllegalStateException: FirebaseApp with name [DEFAULT] doesn't exist.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3738)
at android.app.ActivityThread.access$900(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1202)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalStateException: FirebaseApp with name [DEFAULT] doesn't exist.
at com.google.firebase.FirebaseApp.getInstance(Unknown Source)
at com.google.firebase.FirebaseApp.getInstance(Unknown Source)
at com.google.firebase.iid.FirebaseInstanceId.getInstance(Unknown Source)
at com.google.firebase.messaging.FirebaseMessaging.getInstance(Unknown Source)
at careerage.jobseeker.app.MainActivity$override.onCreate(MainActivity.java:49)
at careerage.jobseeker.app.MainActivity$override.access$dispatch(MainActivity.java)
at careerage.jobseeker.app.MainActivity.onCreate(MainActivity.java:0)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3738)
at android.app.ActivityThread.access$900(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1202)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
I tried java.lang.IllegalStateException: FirebaseApp with name [DEFAULT]
but still it doesn't recognize FirebaseDatabase Class
Try updating your dependency to:
compile 'com.google.firebase:firebase-messaging:9.0.2'
This bug was fixed in patches between 9.0.0 and 9.0.2
I think Fcm and Gcm take some time to get tokens.. If you try to do anything with cloud messaging without the token being assigned you will get error.
I am following Steps provided by IBM to build MobileFirst hybrid application for default Aurora store. I found the desired WCWorklight.zip at location
C:\{Installation dir}\components\store-enhancements\samples\Worklight\
On tutorial there were many js files that need to be replaced but those were not present in WCWorklight.zip e.g.
After building the apk when I ran it it is throwing error
Process: com.ibm.commerce.worklight.android, PID: 3001
java.lang.NoClassDefFoundError: com.worklight.location.internal.nativeImpl.AndroidWLDevice
at com.worklight.wlclient.api.WLClient.<init>(WLClient.java:177)
at com.worklight.wlclient.api.WLClient.createInstance(WLClient.java:229)
at com.worklight.common.Logger.setContext(Logger.java:549)
at com.worklight.androidgap.WLDroidGap.onCreate(WLDroidGap.java:43)
at com.ibm.commerce.worklight.android.WCHybrid.onCreate(WCHybrid.java:143)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
Please let me know if any one faced such issues.
Thanks in advance.
WebSphere Commerce specifically mentions that you need Worklight 6.0, where you are using 7.1.
You need to check if there is a version that is updated for 7.1.
7.1 is wholly different from 6.0 (by years of development).
Contact IBM WebSphere Commerce.
I have been using ChromeCast in my application before and it was working great. Recently I added Google Cloud Messaging in my application too, and for that I had to update dependency files to
'com.google.android.gms:play-services-cast:8.3.0' and 'com.google.android.gms:play-services-gcm:8.3.0'. But now when client disconnects chromecast we get the following fatal exceptions and the application crashes.
11-23 12:42:49.415 22117-22117/com.jadoo.jadooplus E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.jadoo.jadooplus, PID: 22117
android.view.InflateException: Binary XML file line #36: Error inflating class android.widget.ImageButton
at android.view.LayoutInflater.createView(LayoutInflater.java:620)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:315)
at android.app.Dialog.setContentView(Dialog.java:512)
at android.support.v7.app.MediaRouteControllerDialog.onCreate(MediaRouteControllerDialog.java:178)
at android.app.Dialog.dispatchOnCreate(Dialog.java:396)
at android.app.Dialog.show(Dialog.java:268)
at android.support.v4.app.DialogFragment.onStart(DialogFragment.java:399)
at android.support.v4.app.Fragment.performStart(Fragment.java:1813)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:989)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1138)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:740)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1501)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:458)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5105)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:608)
at dalvik.system.NativeStart.main(Native Method)
preceded by an InvocationTargetException and Resources$NotFoundException.
Even now when I change the version anywhere below 7.5.x the code works great. Any ideas why ImageButton is not drawable. I've spent a day at following the stacktrace and today surfing the web, no luck. I haven't found anything useful on the topic.
I applologize for not posting stacktrace from other exception' stacktrace but I can't add more in formatted code.
Edit 1: I can't seem to add any more code here so here's a snapshot:
Edit 2:
I have already tried disabling Proguard, with no effect. The issue persists on a LG G2 d802, a range of Samsung Tabs and Nexus 7. Also I am not using CastCompanionLibrary.
I am trying to integrate Flickr in android using the Flickr4Java library. Flickr4Java uses Log4j for logging. So when I try to create an instance of flickr, something like Flickr flickr = new Flickr(apiKey, sharedSecret, new REST()); I get the following stack trace
05-12 01:24:28.714 8449-8449/edu.sdsu.cs.sharepic E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: edu.sdsu.cs.sharepic, PID: 8449
java.lang.VerifyError: org/apache/log4j/config/PropertySetter
at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:805)
at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:768)
at org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigurator.java:648)
at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:514)
at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:580)
at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:526)
at org.apache.log4j.LogManager.<clinit>(LogManager.java:127)
at org.apache.log4j.Logger.getLogger(Logger.java:117)
at com.flickr4java.flickr.REST.<clinit>(REST.java:46)
at edu.sdsu.cs.sharepic.model.Flickr1.<init>(Flickr1.java:28)
at edu.sdsu.cs.sharepic.activity.SelectProfileActivity.init(SelectProfileActivity.java:75)
at edu.sdsu.cs.sharepic.activity.SelectProfileActivity.onCreate(SelectProfileActivity.java:41)
at android.app.Activity.performCreate(Activity.java:5248)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1110)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2162)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2257)
at android.app.ActivityThread.access$800(ActivityThread.java:139)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5086)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
I am guessing it has got something to do with configuration of the log4j library, but don't know how to solve the problem. Any help will be much appreciated.
Log4j uses apis from java.beans that is missing in android.
Try this library https://code.google.com/archive/p/android-logging-log4j/
I have yet to look at it tough
I've tried to import mupdf to my app, but when I open it, i got some weird error and it force closes. Why? I really don't understand.
this is my logcat:
10-10 15:34:17.802 8657-8657/com.tproductions.Openit E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.tproductions.Openit, PID: 8657
java.lang.UnsatisfiedLinkError: Native method not found: com.artifex.mupdfdemo.MuPDFCore.openFile:(Ljava/lang/String;)J
at com.artifex.mupdfdemo.MuPDFCore.openFile(Native Method)
at com.artifex.mupdfdemo.MuPDFCore.<init>(MuPDFCore.java:68)
at com.artifex.mupdfdemo.MuPDFActivity.openFile(MuPDFActivity.java:204)
at com.artifex.mupdfdemo.MuPDFActivity.onCreate(MuPDFActivity.java:303)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2201)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2286)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1246)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:212)
at android.app.ActivityThread.main(ActivityThread.java:5135)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:877)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693)
at dalvik.system.NativeStart.main(Native Method)
It looks like something has gone wrong in the native build.
It's probably best to retry that; there are instructions here:
http://www.mupdf.com/doc/how-to-build-mupdf-for-android
and here:
http://git.ghostscript.com/?p=mupdf.git;a=blob_plain;f=platform/android/ReadMe.txt;hb=HEAD
It's probably best to use the git code from master - the latest is 1.6, versions prior to 1.5 are unlikely to build cleanly with the current NDKs.