Crash when trying to call "GooglePlayServicesUtil.isGooglePlayServicesAvailable" - android

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.

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

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;

unable to resolve static method: Lcom/google/android/gms/common/GooglePlayServicesUtil;.isGooglePlayServicesAvailable

ok...this is driving me nuts.
I've added and re-added the Google Play Services Lib multiple times (with and without copying to workspace) but when I try adding it as a reference to my project, it always shows as a red X next to it when I go back to the project properties as in this guy's screen captures:
Adding a reference to a library project
No errors print to the console. Anyone know why this would show up as a red X or how to debug this? I've added Android Bar Sherlock the same way w/o issues. It's just the Google Play Services library that's driving me up the wall :-P
I also tried creating a new project and following this quickstart and have the same issue. It's almost like my Eclipse is broken in some way but it's a fresh install :-P
https://docs.google.com/document/pub?id=19nQzvKP-CVLd7_VrpwnHfl-AE9fjbJySowONZZtNHzw
I can work around the compile time errors by adding the library in the project properties java build path, but this should not be the way to fix it. And if I try running the app on my SGS3 this way, it crashes w/ the error in the title. I can add the play library jar to my libraries, but then it crashes with an error about looking having problems looking up r$styled so that doesn't work either :-P
Figured it out finally. Got bit by this:
unable to resolve static method: Lcom/google/android/gms/common/GooglePlayServicesUtil;.isGooglePlayServicesAvailable
https://code.google.com/p/android/issues/detail?id=27199
Everything runs properly now.
Damned annoying bug. I remember being bit by it years ago and it's still not fixed :-P

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.

Unable to reference a Library project - Android

Well, I wanted to create a Library project from my existing sources so that it would help me re-use code for the paid app that I have in mind. When I saw the developer guide on how this was to be done, I thought it was very simple.
Just mark the project as a Library project and it should be converted to one.
But when I tried referencing one of the base classes in an application, the app force closes with the following exceptions
02-04 21:50:06.765: E/AndroidRuntime(699): java.lang.NoClassDefFoundError: in.my.package.name.R$layout
Let me give you some more info. I have referenced the Library project in the application and have also included the manifest entries with fully qualified activity names. I have a BaseActivity which has all the menu and re-usable code bits. The point where the above exception occurs is where I am trying to reference the layout file in this BaseActivity inside the library project.
setContentView(R.layout.apphome);
What is it that I am missing or doing wrongly?
PS: I am just noticing that When I right click on my application and go to the android tab, there is a red cross instead of a green tick in the place where the library project is referenced. But there are no visible errors on the console or in the code of the project.
Seems its a known issue.
Issue link here
Hope Google guys resolve this problem in their next SDK release.
So to be clear, the problem was that my libraries had custom styling capabilities and that was the problem.

Categories

Resources