问题
So, I have this app and several activitys do querys an external database via Asynk Task and with the results it populates the layout.
So far so good, it all worked fine until I exported the app. After I sign exported the app it started crashing at this activity that uses the facebook sdk ( and it's the only one who does ). from the json String it gets a name and with the facebook sdk it posts a link on facebook that in the description has that name. ( I don't know if the problem is here but shouldn't be ) so, I decided to run log cat on the exported apk while she was runnning ( I made her debuggable on the manifest ) and retrieved this log that made me even more confused:
11-04 16:01:19.877: E/AndroidRuntime(11372): FATAL EXCEPTION: main
11-04 16:01:19.877: E/AndroidRuntime(11372): com.facebook.ae: com.facebook.c.g got an unexpected method signature: public abstract org.json.JSONObject com.facebook.c.d.q()
11-04 16:01:19.877: E/AndroidRuntime(11372): at com.facebook.c.i.a(Unknown Source)
11-04 16:01:19.877: E/AndroidRuntime(11372): at com.facebook.c.g.invoke(Unknown Source)
11-04 16:01:19.877: E/AndroidRuntime(11372): at $Proxy0.q(Native Method)
11-04 16:01:19.877: E/AndroidRuntime(11372): at com.facebook.b.aM.onPostExecute(Unknown Source)
11-04 16:01:19.877: E/AndroidRuntime(11372): at android.os.AsyncTask.finish(AsyncTask.java:631)
11-04 16:01:19.877: E/AndroidRuntime(11372): at android.os.AsyncTask.access$600(AsyncTask.java:177)
11-04 16:01:19.877: E/AndroidRuntime(11372): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644)
11-04 16:01:19.877: E/AndroidRuntime(11372): at android.os.Handler.dispatchMessage(Handler.java:107)
11-04 16:01:19.877: E/AndroidRuntime(11372): at android.os.Looper.loop(Looper.java:194)
11-04 16:01:19.877: E/AndroidRuntime(11372): at android.app.ActivityThread.main(ActivityThread.java:5422)
11-04 16:01:19.877: E/AndroidRuntime(11372): at java.lang.reflect.Method.invokeNative(Native Method)
11-04 16:01:19.877: E/AndroidRuntime(11372): at java.lang.reflect.Method.invoke(Method.java:525)
11-04 16:01:19.877: E/AndroidRuntime(11372): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:837)
11-04 16:01:19.877: E/AndroidRuntime(11372): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:604)
11-04 16:01:19.877: E/AndroidRuntime(11372): at dalvik.system.NativeStart.main(Native Method)
11-04 16:01:19.911: I/System.out(11372): [socket][/192.168.0.14:33448] connected
Anyone has a clue of what might be wrong?
I can post the code if you want but this activity is huge.
回答1:
So, it seems that the problem was on the proguard-project.txt.
I totally forgot to add this line:
-keep class com.facebook.** {*;}
Well, here is the answer, proguard can be a pain in the butt so it might help other people that have theyr apk crashing and don't having a clue why.
From now on every library I'll add to my project I'm checking the proguard txt.
来源:https://stackoverflow.com/questions/26748716/error-on-exported-apk-facebooksdk