Importing FacebookSDK to Unity Android project causes build to crash - android

I have a simple 2d mobile game that I'm working on and it was made in Unity. I want to have an option to share info on Facebook, however, when I add the FacebookSDK to the project, even if I'm not even using anything from it besides the Facebook Settings, the project's build stops working and crashes whenever I try to open it.
I checked the problem and it seems to be something related to the FacebookContentProvider, since I had this error showing up in my log:
java.lang.RuntimeException: Unable to get provider com.facebook.FacebookContentProvider: java.lang.ClassNotFoundException: Didn't find class "com.facebook.FacebookContentProvider" on path: ...
Did anyone have problems with this kind of thing before? I tried changing the AndroidManifest file and play a little with some of the settings in the Facebook Developer's page but nothing seems to work.
I'm using Unity 2019.1.14f1 and FacebookSDK 7.17.2, but I also tried with different versions of the FacebookSDK (7.15.1 and 7.16.1), but got the same problem.

Related

Vuforia SDK Examples Not Running - Android

I'm trying to run Vuforia SDK samples from here on Android:
I have already downloaded the main SDK and put those sample files in the sample folder. I have added the Vuforia.jar as a library and dependency to my project. The app runs on my Samsung S4 and shows the Menu but when I click Start on any of the examples it sends me back to the main menu rather than opening the camera. It doesn't show any crash error in the logs.
I'm wondering if anyone has experienced this problem and has managed to fix it?
I had the same issue and when looked at the log it had this message com.vuforia.samples.VuforiaSamples W/System.err: The library libVuforia.so could not be loaded
Then I followed the answer here https://developer.vuforia.com/forum/android/crash-start-button-sample
and that .jar file to the project. This solved the above issue.
Also I had to generate a license key for the app and set it in the last parameter in Vuforia.setInitParameters(mActivity, mVuforiaFlags, "") in the SampleApplicationSession class
try it:
add the Vuforia.jar lib in your project;
go to archive build.gradle (Module:app) and check if the variable 'VUFORIA_SDK_DIR' is correct (in my project it had the value "../../../" but i had to change to "../../"), the path has to lead to your Vuforia SDK dir;
finally, change the method Vuforia.setInitParameters in the archive SampleApplicationSession.java (line: 414), add your vuforia key in the third paramether;
it works to me

Hacker News Android Client: "Cannot resolve symbol 'MainActivity_'"

I'm currently working on a fork of the Hacker News Android client to implement a pull-down refresh feature for the news feed. However, after I imported the project from Github to Android Studio, I get the following error:
Cannot resolve symbol 'MainActivity_'
for not only MainActivity but also for several other activities used by the app. This error makes sense because if you look in the project directory, none of the activity names end in an underscore "_". However, these activities are referenced with the underscore in the Android Manifest. This leads me to think that I somehow imported the project into Android Studio incorrectly, but I'm really not sure.
Yesterday I was able to resolve this issue with Build > Clean Project, and then Build > Rebuild Project. However, today I reopened the project, the same issues arise, and these actions no longer fix the problem. Any ideas?
You should AndroidAnnotations library in the project.
For this configuration, please refer to here.

Adding google maps library to existing project creates confusing error

I am building an Android app that I want to open google maps with the click of a button. I want the app to find the current location of the user and give them directions to a predefined address. I started building the application before I realized there were special steps that you have to take to include this functionality. To add this feature to my project I followed the directions on these two sites:
https://developer.android.com/google/play-services/setup.html
https://developer.android.com/tools/projects/projects-eclipse.html#ReferencingLibraryProject
The problem is on the second site, when i added the library to my already existing project it caused all of my code that has findViewById(R.id.whatever) or setContentView(R.layout.whatever) to become errors. It is now telling me that i need to import the class R. If I do that it then gives me error messages on the names of all my xml files.
For example in my MainActivity it is telling me that i should change setContentView(R.layout.activity_main) to setContentView(R.layout.activity_list_item) and does this for all references to my xml files for the entire project.
I tried going back and removing the google play services library from the project and starting over but when I removed it the errors still persists. I also tried using the "fix project setup" option in Eclipse but it didn't fix the problem.
I'm wondering if anyone here has experienced this problem before? If so, how can I fix it? The application had no errors before I tried to include the google play services library. I am new to Android development so a lot of the information I have found has been either confusing to understand or doesn't seem to include enough details for me to figure it out. Thanks for your help!
Look at your imports, and check if you are importing the correct R.java from your application package, not from the android package.
Check also if your XMLs don't contain errors, otherwise R.java won't be generated.
In my case android-maps-library had to errors in two files (I have forgotten their names), I edited the two files removing errors my self. And finally I was able to used it quite nice.
i think you have correct yout Project build target, and this how:
right click on your project folder in the package explorer->propreties->Android
then porject build target and choose you Android target (Android x.xx)
but before that you need to remove import android.R;

Crash when trying to call "GooglePlayServicesUtil.isGooglePlayServicesAvailable"

So, I installed everything, linked the project folder and my app crashes when I try to check the services.
Any hoop I forgot to jump on this stupidly over-complicated system just to display a simple map with some markers on my app?
All I get is "07-06 20:01:43.132: E/AndroidRuntime(1348): Caused by: java.lang.NoClassDefFoundError: com.google.android.gms.common.GooglePlayServicesUtil", even if I try to execute it inside a try-catch, it will still crash the app.
I've seen an app crash the same way before, but it only did because the google-play-services folder was added to the project in the Properties - Java Build Path section instead of including it as an android library in Properties - Android section.
Finnaly made this P.O.S work. Instead of doing all dumb crap googles tells you, just add a variable that points to their google-play-services.jar. But I think doing things simple is too mainstream for those hipsters.

pubnub test application crashes: NoClassDefFound

this is a copy of my question on Pubnub support page:
Hi all, I tried running the PubnubTestApp that is downloadable with the Pubnub API from your git repo.
but when I try and start the test app i firstly get a build path error because apparently you (pubnub guys) have configured the project to look for 2 jar files that don't exist. (bcprov-jdk16-145.jar and commons-codec-1.2.jar).
after I removed those 2 references the project showed no error. but when I tried running it, it crashed again with this error:
"07-04 12:29:11.782: E/AndroidRuntime(754): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.fbt/com.fbt.PubNubTestActivity}: java.lang.ClassNotFoundException: com.fbt.PubNubTestActivity in loader dalvik.system.PathClassLoader[/data/app/com.fbt-1.apk"
after looking over the internet for the reasons for this crash, I noticed that in the manifest.xml file in the project there is a mistake in the name of the activity name. (it's named ".PubNubTestActivity" instead of ".PubnubTestActivity").
after changing the manifest, everything works and the app will install and run but there a a few problems still.
when pressing the "publish" button or the "history" button the app crashes and dies automatically. also it crashed without any clicking of anything (just like that).
here are the crash reports I got from the emulator.
http://pastie.org/private/pojnpnxmznvn9azdg7uyg
apparently the project doesn't recognize the "pubnub.crypto" jar file even though I (and you) added it to the build path and made sure it's in the project.
please let me know how to fix this so I can use (at last) pubnub in my app.
Have you tried the latest build? This should be fixed now.

Categories

Resources