SDKBOX Facebook android bug

SDKBOX Facebook android bug
0.0 0

#1

Hello! I’m trying to integrate facebook plugin with SDKBOX but I got this error:

07-27 14:38:20.691 26561-26561/com.highlights.apps.highlightsshapes E/AndroidRuntime: FATAL EXCEPTION: main
                                                                                          Process: com.highlights.apps.highlightsshapes, PID: 26561
                                                                                          java.lang.RuntimeException: Unable to get provider com.facebook.FacebookContentProvider: java.lang.ClassNotFoundException: Didn't find class "com.facebook.FacebookContentProvider" on path: DexPathList[[zip file "/data/app/com.highlights.apps.highlightsshapes-3.apk"],nativeLibraryDirectories=[/data/app-lib/com.highlights.apps.highlightsshapes-3, /vendor/lib, /system/lib]]
                                                                                              at android.app.ActivityThread.installProvider(ActivityThread.java:5236)
                                                                                              at android.app.ActivityThread.installContentProviders(ActivityThread.java:4827)
                                                                                              at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4710)
                                                                                              at android.app.ActivityThread.access$1600(ActivityThread.java:174)
                                                                                              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1367)
                                                                                              at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                              at android.os.Looper.loop(Looper.java:146)
                                                                                              at android.app.ActivityThread.main(ActivityThread.java:5593)
                                                                                              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:1283)
                                                                                              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
                                                                                              at dalvik.system.NativeStart.main(Native Method)
                                                                                           Caused by: java.lang.ClassNotFoundException: Didn't find class "com.facebook.FacebookContentProvider" on path: DexPathList[[zip file "/data/app/com.highlights.apps.highlightsshapes-3.apk"],nativeLibraryDirectories=[/data/app-lib/com.highlights.apps.highlightsshapes-3, /vendor/lib, /system/lib]]
                                                                                              at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:67)
                                                                                              at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
                                                                                              at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
                                                                                              at android.app.ActivityThread.installProvider(ActivityThread.java:5221)
                                                                                              at android.app.ActivityThread.installContentProviders(ActivityThread.java:4827) 
                                                                                              at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4710) 
                                                                                              at android.app.ActivityThread.access$1600(ActivityThread.java:174) 
                                                                                              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1367) 
                                                                                              at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                                              at android.os.Looper.loop(Looper.java:146) 
                                                                                              at android.app.ActivityThread.main(ActivityThread.java:5593) 
                                                                                              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:1283) 
                                                                                              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099) 
                                                                                              at dalvik.system.NativeStart.main(Native Method) 


It installed correctly automatically, but it cannot find

android:name="com.facebook.FacebookActivity"

and

android:name="com.facebook.FacebookContentProvider"

are red.

As you can see facebook_lib/java contains only a .keepme file, is that correct?
Please help, this is a nightmare


#2

There should be three jar files in facebook_lib/libs:

ls android/libs/facebook_lib/libs/
android-support-v4.jar      bolts-android-1.1.2.jar     facebook-android-4.12.1.jar

#3

Yes, they are there, I checked it.

What could be the problem then?


#4

Did you find a solution?


#5

Are you using android studio?


#6

Yes.
It came down to the .\cocos2d\cocs\platform\android\libcocos2dx\build.gradle file. I replaced:

dependencis{
    compile fileTree(dir: '../java/libs', include: ['*.jar'], exclude: ['twitter.jar', 'fabric.jar']) 
}

with:

dependencies{
    compile project(':facebook_lib') 
    compile project(':gps') 
    compile fileTree(dir: '../java/libs', include: ['*.jar']).exclude(['twitter.jar', 'fabric.jar']).exclude(['android-support-v4.jar', 'android_support_v7/appcompat/libs/android-support-v4.jar']) 
} 

I didn’t use android studio untill the project got big enough to need multidex. I believe the root cause of the problem was upgrading cocos after installing SDKBOX.