app crashes when it queries to hosted parse server - android

I'm trying to migrate app to hosted parse server.App start but when it tries to query to hosted parse server it gets crashed.I had the issue with dependencies in the past now i fixed it.
If i use the parse service the app works fine.
Parse.enableLocalDatastore(this);
// Parse.initialize(this, "<key>", "<key>");
Parse.initialize(new Parse.Configuration.Builder(this)
.applicationId("appid")
.clientKey("<key>")
.server("http://192.168.1.177:1337/parse/") // '/' important after 'parse'
.build());
Dependencies:
dependencies {
compile 'com.parse.bolts:bolts-android:1.+'
compile 'com.parse:parse-android:1.+'
compile 'com.android.support:cardview-v7:+'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.google.android.gms:play-services:8.1.0'
}
Error:
04-03 12:44:28.409 2911-2911/com.app.nameapp E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.app.nameapp, PID: 2911
java.lang.IllegalStateException: Could not execute method of the activity
at android.view.View$1.onClick(View.java:3823)
at android.view.View.performClick(View.java:4438)
at android.view.View$PerformClick.run(View.java:18422)
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: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.reflect.InvocationTargetException
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at android.view.View$1.onClick(View.java:3818)
at android.view.View.performClick(View.java:4438)
at android.view.View$PerformClick.run(View.java:18422)
Caused by: java.lang.IllegalStateException: Method requires Local Datastore. Please refer to `Parse#enableLocalDatastore(Context)`.
at com.parse.ParseQuery.throwIfLDSEnabled(ParseQuery.java:292)
at com.parse.ParseQuery.throwIfLDSDisabled(ParseQuery.java:286)
at com.parse.ParseQuery.access$200(ParseQuery.java:90) 
Could not able to post entire error message as it was very long. I think there is something wrong with parse local data store. As far as i know when pointing my app to hosted parse server i just need to add those few lines(appid,clientkey,server address). Is there any more changes needed in the app?  
  

try the following:
Parse.initialize(new Parse.Configuration.Builder(this) .applicationId("yourappid") .clientKey("yourclientkey") .server("serverurl") .enableLocalDataStore() .build() );

It seems like you are trying to initialize Parse from an onClickListener, therefore the object this you are passing to Parse is the wrong one.
if you refer to this from on OnClickListener you get a reference to the interface even though it's an inline declaration in the activity.
you need to manually point to the correct Context and use it.
try changing your code to look like this:
Parse.enableLocalDatastore(MyActivity.this);
// Parse.initialize(this, "<key>", "<key>");
Parse.initialize(new Parse.Configuration.Builder(MyActivity.this)
.applicationId("appid")
.clientKey("<key>")
.server("http://192.168.X.XXX:1337/parse/") // '/' important after 'parse'
.build());

Related

Crosswalk crashes with AssertionFailedError

Crashlytics reports the following problem, that is affecting a good percentage of the users of my application:
Fatal Exception: junit.framework.AssertionFailedError: Cannot call
this method before xwalk is ready
at junit.framework.Assert.fail(Assert.java:50)
at org.xwalk.core.XWalkView.setZOrderOnTop(XWalkView.java:1271)
at org.crosswalk.engine.XWalkWebViewEngine.initWebViewSettings(XWalkWebViewEngine.java:193)
at org.crosswalk.engine.XWalkWebViewEngine.access$000(XWalkWebViewEngine.java:55)
at org.crosswalk.engine.XWalkWebViewEngine$2.run(XWalkWebViewEngine.java:90)
at org.xwalk.core.XWalkActivityDelegate.onActivateCompleted(XWalkActivityDelegate.java:179)
at org.xwalk.core.XWalkLibraryLoader$ActivateTask.onPostExecute(XWalkLibraryLoader.java:314)
at org.xwalk.core.XWalkLibraryLoader$ActivateTask.onPostExecute(XWalkLibraryLoader.java:277)
at android.os.AsyncTask.finish(AsyncTask.java:632)
at android.os.AsyncTask.access$600(AsyncTask.java:177)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:645)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5034)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
at dalvik.system.NativeStart.main(NativeStart.java)
I just added crosswalk as a plugin and I don't think I call any method explicitly (Cannot call this method before xwalk is ready). Any ideas? Thanks in advance!
I think you're doing something to the XWalkView while it's still in the not-ready state.
In the latest version of Crosswalk, there are some changes to the lib that the Crosswalk runtime isn't loaded yet when onCreate() is called. Therefore, if you want to initialize XWalkView or do something, wait until XWalkActivity.onXWalkReady() is called.
The solution is :
Extend the activity containing XWalkView from XWalkActivity
Override XWalkActivity's onXWalkReady() methods, and do necessary initialization stuff to the XWalkView there
As already stated here: https://crosswalk-project.org/apis/embeddingapidocs_v5/org/xwalk/core/XWalkActivity.html

Getting java.lang.VerifyError after upgrading to Android Studio 2.0

I upgraded Android Studio to 2.0.
Then when I run & debug the app, it works fine until I click a button and call a function, and java.lang.VerifyError is thrown. This is what I get from logcat:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.fronty.zt, PID: 18022
java.lang.VerifyError: com/fronty/zt/SilverCord$AjcClosure11
at com.fronty.zt.SilverCord.checkEmailExistence(SilverCord.java:407)
at com.fronty.zt.register.RegisterBasicActivity.onClick(RegisterBasicActivity.java:122)
at com.fronty.zt.register.RegisterBasicActivity$$ViewBinder$1.doClick(RegisterBasicActivity$$ViewBinder.java:26)
at butterknife.internal.DebouncingOnClickListener.onClick(DebouncingOnClickListener.java:22)
at android.view.View.performClick(View.java:4438)
at android.view.View$PerformClick.run(View.java:18422)
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: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)
This is checkEmailExistence():
#DebugLog
public void checkEmailExistence(StringPacket pack, final Response.Listener<ResponseBase> listener, Response.ErrorListener errorListener)
{
request("checkEmailExistence", ResponseBase.class, listener, errorListener, "/api/v0/check_email_existence", pack);
}
But when I set a breakpoint and follow, it actually goes deeper before it throws. checkEmailExistence() calls request() and the exception is thrown at the first line inside request()
if ( doLog )
Log.i( T, function );
I tried deleting build dir, rebuild, clean.. & etc with no effect.
However, changing gradle version fixes the problem:
classpath 'com.android.tools.build:gradle:2.0.0'
to
classpath 'com.android.tools.build:gradle:1.5.0'
But this will disable Instant Run, so I would like to stick to 2.0.0. Does anyone know the cause or how to go about this?
Thanks!
I get the same error.I think it is hugo lead to the problem . Don't use #DebugLog,I run my app without the problem

com.facebook.FacebookGraphObjectException: Factory can't proxy method: public abstract void com.facebook.model.GraphUser.setBirthday()

I have been editing the FriendPikcerSample provided by Facebook SDK for Android (latest version).
A couple of hours ago I successfully inserted a listview instead of a textview, so that when I select a name in the ListView, I can fetch more details of the user in the further activity
But Now, after restarting my PC, the app is behaving weird. When I launch it and click on "Pick Friends", it should be showing the list of friends who are using the app. Instead, now the app crashes and logcat shows this error.
12-30 07:35:15.820 2238-2238/com.facebook.samples.friendpicker E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.facebook.samples.friendpicker, PID: 2238
com.facebook.FacebookGraphObjectException: Factory can't proxy method: public abstract void com.facebook.model.GraphUser.setBirthday()
at com.facebook.model.GraphObject$Factory.verifyCanProxyClass(GraphObject.java:290)
at com.facebook.model.GraphObject$Factory.createGraphObjectProxy(GraphObject.java:216)
at com.facebook.model.GraphObject$Factory.coerceValueToExpectedType(GraphObject.java:340)
at com.facebook.model.GraphObject$Factory$GraphObjectListImpl.get(GraphObject.java:772)
at java.util.AbstractList$SimpleListIterator.next(AbstractList.java:55)
at java.util.AbstractCollection.toArrayList(AbstractCollection.java:349)
at java.util.AbstractCollection.toArray(AbstractCollection.java:339)
at java.util.ArrayList.addAll(ArrayList.java:188)
at com.facebook.widget.SimpleGraphObjectCursor.addGraphObjects(SimpleGraphObjectCursor.java:46)
at com.facebook.widget.GraphObjectPagingLoader.addResults(GraphObjectPagingLoader.java:203)
at com.facebook.widget.GraphObjectPagingLoader.requestCompleted(GraphObjectPagingLoader.java:186)
at com.facebook.widget.GraphObjectPagingLoader.access$000(GraphObjectPagingLoader.java:27)
at com.facebook.widget.GraphObjectPagingLoader$2.onCompleted(GraphObjectPagingLoader.java:134)
at com.facebook.Request$4.run(Request.java:1666)
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: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 anyone help me understand what's gone wrong?

Android Service Exchange always crashs

I'm getting a crash always when I install or uninstall an app that use Sync Service, like Facebook, whatsup, etc.
"Unfortunately, Exchange Services has stopped."
I don't know why, but it just happens for some devices, in my case all of then are Android 4.4.2.
First I thought it's my app's fault, but it doesn't make sense once I uninstall my app and the problem continues happening for others apps.
Do you know something about it?
Thank you.
02-07 14:31:49.864 3015-3015/? E/ActivityThread﹕ Failed to find provider info for com.google.android.email.provider
02-07 14:31:49.864 3015-3015/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.google.android.exchange, PID: 3015
java.lang.RuntimeException: Unable to create application com.android.exchange.Exchange: java.lang.IllegalArgumentException: Unknown URI content://com.google.android.email.provider
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4347)
at android.app.ActivityThread.access$1500(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
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.IllegalArgumentException: Unknown URI content://com.google.android.email.provider
at android.content.ContentResolver.call(ContentResolver.java:1352)
at com.android.exchange.Exchange.onCreate(Exchange.java:34)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4344)
at android.app.ActivityThread.access$1500(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
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 found what was happening!
The problem occurs by device when there are sync accounts registered, but the Exchange Service cannot find any application to answer the URI, in my case it was "content://com.google.android.email.provider", to fix it I checked my disable applications and there was it, my default email application was disable. I just enable it again and the problem never occurs again.
Go to Settings > Apps > ALL> Exchange Services > Clear Cache and try opening it. When it opens, check once.
I had that problem. now I’m using a good app called Mailwise. it’s a free email app, very convenient for businesses, you can easily set up multiple email accounts, and it works great with Exchange.
https://play.google.com/store/apps/details?id=com.syntomo.email&hl=en

Added GMS to Android App For Location Services Now It Crashes

I just added GMS to my app to use the LocationClient and now my app is crashing upon startup. Looks like my main activity can no longer find my service which is where the location logic is handled.
I added the below line to my gradle dependencies in order to pull in gms.
compile 'com.google.android.gms:play-services:4.0.30'
This is the error I am getting.
28 22:10:39.761 2885-2885/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.nathan.allgood, PID: 2885
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/myname/appname/services/ActivityService;
Also have this in my manifest:
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
Any Ideas?
Thanks,
Nathan
EDIT: Added LogCat and Method where error happens
/**
* Bind this Activity to MyService
*/
private void doBindService() {
getActivity().bindService(new Intent(getActivity(), ActivityService.class), mConnection, Context.BIND_AUTO_CREATE);
mIsBound = true;
}
11-28 22:53:59.502 2278-2278/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.myname.appname, PID: 2278
java.lang.NoClassDefFoundError: com.myname.appname.services.ActivityService
at com.myname.appname.Activity1$OneFragment.automaticBind(Activity1.java:119)
at com.myname.appname.Activity1$OneFragment.onResume(Activity1.java:105)
at android.app.Fragment.performResume(Fragment.java:1743)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:924)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1062)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1044)
at android.app.FragmentManagerImpl.dispatchResume(FragmentManager.java:1863)
at android.app.Activity.performResume(Activity.java:5332)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2779)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2818)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2251)
at android.app.ActivityThread.access$700(ActivityThread.java:145)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1407)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5062)
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)
11-28 23:33:12.336 6335-6335/com.myname.appname E/dalvikvm﹕ Could not find class 'com.myname.appname.services.ActivityService', referenced from method com.myname.appname.Activity1$OneFragment.doBindService
11-28 23:33:12.386 6335-6335/com.myname.appname E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.myname.appname, PID: 6335
java.lang.NoClassDefFoundError: com.myname.appname.services.ActivityService
at com.myname.appname.Activity1$OneFragment.automaticBind(Activity1.java:119)
at com.myname.appname.Activity1$OneFragment.onResume(Activity1.java:105)
at android.app.Fragment.performResume(Fragment.java:1743)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:924)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1062)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1044)
at android.app.FragmentManagerImpl.dispatchResume(FragmentManager.java:1863)
at android.app.Activity.performResume(Activity.java:5332)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2779)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2818)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2251)
at android.app.ActivityThread.access$700(ActivityThread.java:145)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1407)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5062)
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)
Edit 2:
I should also mention I am using Android Studio
SOLUTION!!!
Edit 3:
Following some advice from another stackoverflow post I did a
gradlew clean and then gradlew build which seems to have fixed the problem!
Because you have not post your code, look for "Caused by" in your logcat. Tell me why you use AsyncTask to get your Location?

Categories

Resources