freshplanet / ANE-Facebook

Air Native Extension (iOS and Android) for the Facebook mobile SDK
Apache License 2.0
221 stars 123 forks source link

Android "Unfortunately, [app_name] has stopped" #194

Closed YeeshaYe closed 7 years ago

YeeshaYe commented 9 years ago

When I am trying to fb login this message appears: "Unfortunately, [app_name] has stopped". Latest ANE ver. Please help me to solve this problem. Thank you!

My manifest:

``` !-- Local notification -->
YeeshaYe commented 9 years ago

With example from sample folder same thing...any thoughts?

phpandroid commented 9 years ago

i also got this message with latest ANE version on Android device. Please fix it help me.

vlook commented 9 years ago

Have you checked the system log for the cause of the crash?

I have the exact same issue, and according to the log a missing resource causes the crashing on openSessionWithReadPermissions.

E/AndroidRuntime(30971): Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x7f070013 E/AndroidRuntime(30971): at android.content.res.Resources.getText(Resources.java:1123) E/AndroidRuntime(30971): at android.content.res.Resources.getString(Resources.java:1217) E/AndroidRuntime(30971): at android.content.Context.getString(Context.java:362) E/AndroidRuntime(30971): at com.facebook.widget.WebDialog.onCreate(Unknown Source) E/AndroidRuntime(30971): at android.app.Dialog.dispatchOnCreate(Dialog.java:363) E/AndroidRuntime(30971): at android.app.Dialog.show(Dialog.java:264) E/AndroidRuntime(30971): at com.facebook.AuthorizationClient$WebViewAuthHandler.tryAuthorize(Unknown Source) E/AndroidRuntime(30971): at com.facebook.AuthorizationClient.tryCurrentHandler(Unknown Source) E/AndroidRuntime(30971): at com.facebook.AuthorizationClient.tryNextHandler(Unknown Source) E/AndroidRuntime(30971): at com.facebook.AuthorizationClient.authorize(Unknown Source) E/AndroidRuntime(30971): at com.facebook.AuthorizationClient.startOrContinueAuth(Unknown Source) E/AndroidRuntime(30971): at com.facebook.LoginActivity.onResume(Unknown Source) E/AndroidRuntime(30971): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1210) E/AndroidRuntime(30971): at android.app.Activity.performResume(Activity.java:5468) E/AndroidRuntime(30971): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2906)

EDIT: I had the another missing resource related issue (https://github.com/freshplanet/ANE-Facebook/issues/175) with an older build, but had no luck with the solution provided there.

phpandroid commented 9 years ago

Hi vlook, could you tell me how to read the error log?

DamboRam commented 9 years ago

Have the same problem , please any solution ?

vlook commented 9 years ago

phpandroid, I'm just using logcat to collect the log dumps from the device.

adb logcat -d > androidlog.txt

mattmurton commented 9 years ago

If this is the same issue I experienced I've fixed it in my pull request #200 . A re-built ane binary is included in my latest commit. Let me know if it fixes your problems.

mparrett commented 9 years ago

@mattmurton Thanks for your help and info about java 1.6 (that was baffling me!). We just tried your ANE and still have the problem "Unfortunately, [App Name] has stopped." upon trying to call init(). Any ideas? Here's my log dump:

http://vpaste.net/0g0oC

jonnyleeharris commented 9 years ago

I was experiencing the same problem upon calling do login with read permissions until I used @mattmurton 's change.

I still get the same error after the login process has completed though.

jonnyleeharris commented 9 years ago

E/AndroidRuntime(28585): java.lang.RuntimeException: Unable to pause activity {air.com.app/com.facebook.LoginActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.setVisibility(int)' on a null object reference E/AndroidRuntime(28585): at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3225) E/AndroidRuntime(28585): at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3184) E/AndroidRuntime(28585): at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:3159) E/AndroidRuntime(28585): at android.app.ActivityThread.access$1000(ActivityThread.java:144) E/AndroidRuntime(28585): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1296) E/AndroidRuntime(28585): at android.os.Handler.dispatchMessage(Handler.java:102) E/AndroidRuntime(28585): at android.os.Looper.loop(Looper.java:135) E/AndroidRuntime(28585): at android.app.ActivityThread.main(ActivityThread.java:5221) E/AndroidRuntime(28585): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime(28585): at java.lang.reflect.Method.invoke(Method.java:372) E/AndroidRuntime(28585): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899) E/AndroidRuntime(28585): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694) E/AndroidRuntime(28585): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.setVisibility(int)' on a null object reference E/AndroidRuntime(28585): at com.facebook.LoginActivity.onPause(Unknown Source) E/AndroidRuntime(28585): at android.app.Activity.performPause(Activity.java:6044) E/AndroidRuntime(28585): at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1294) E/AndroidRuntime(28585): at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3211) E/AndroidRuntime(28585): ... 11 more

BadViking commented 9 years ago

I just wanted to chime in and say that we're having the same problem. Has anyone been able to get this working yet? @mattmurton that solution didn't seem to make any difference for me. Same problem after calling openSessionWithReadPermissions, the app crashes with the "Unfortunately, [app_name] has stopped" error.

mparrett commented 9 years ago

@BadViking - we reverted back to the working commit 1e6a221 for our Android project due to time constraints.

wastedabuser commented 9 years ago

It seems the latest commit contains all of the R.* resource calls and the ANE is built with them. This is causing the problem. The author stated in the README:

This sdk is using staticaly linked elements. We had to modify all the calls to the com.facebook.android.R package by a custom function that is doing the linking at runtime: import com.freshplanet.ane.AirFacebook.AirFacebookExtension and use AirFacebookExtension.getResourceId("nameOfTheRessource") or AirFacebookExtension.getResourceIds("nameOfTheRessource")

After doing as he said the java.lang.NullPointerException is resolved. If somebody is interested i can fork and push my changes. Unfortunately i am unable to build the ANE for iOS as i am building the entire thing on Windows (i currently don't care about iOS anyway)

hmark commented 9 years ago

@wastedabuser Is it possible to fork/push your solution with Android ANE please? I think it will help all with the same problem.

wastedabuser commented 9 years ago

@hlavko i did, check it out here: https://github.com/wastedabuser/ANE-Facebook

CrazyFlasher commented 9 years ago

Same thing...

UmberFunk commented 9 years ago

@wastedabuser's version works for me, but sadly it's only for Android.

Minor issues:

  1. Avoid clearing tokens twice. Calling openSessionWithReadPermissions after this crashes app.
  2. Calling openSessionWithReadPermissions, canceling it and calling again causes an "already connected" error.
stigmawall commented 9 years ago

I have the exactly same problem like everyone else with the Facebook ANE from freshplanet, change it to the @wastedabuser ANE fixs it.

UmberFunk commented 9 years ago

Keep in mind that wastedabuser's ANE works only with Android.

I had struggled a lot with this, found many versions witch supported both platforms and at last made one work, but when I integrated it into our game it failed again. So I switched to commetcial ane and am happy with this decision.

Thanks to Freshplanet for providing opensource extension, but I should let you know that you might lose a lot of time making it work and it can fail anyway.

shintiger commented 9 years ago

@wastedabuser Thanks for support! I've heard that the Exception is the SDK problem then I spend whole day for Update freshplanet android source to facebook SDK 4.7, finally I stuck when many error cause java sdk1.6...

Anyway, I simply unpack your ANE and repack it with iOS part (nothing change) , I can use it smoothly either iOS or Android now. :+1: