Using maps from Google - java

I'm trying to develop an application using Google's maps and I can't get this application to work. I have done all what is described in the tutorial of the "MapView" sample code, including getting a map key associated to the MD5 signature of my "debug.keystore" file but the emulator definitively says that the application has stopped unexpectedly.
This error message appears when I try to process the setContentView line of code.
The only point where I am not sure of doing what must be done is about the signature of my application : as far as I have understood the signing process of an application, in debug mode, there is nothing to do. Is it correct?
I develop in Java using the Netbeans IDE.
Thanks for the time you will spend trying to help me.

First off, I'd recommend you very much to switch to Eclipse where the official Android plugin is available which will actually give you the LogCat (that's phone-side console) and you will always know what's wrong when something doesn't work. I'm not so sure that the plugin for NetBeans works equally well.
Secondly, regarding your crash, it has nothing to do with the API Key (if the key was wrong, you would see an empty map). Two things here from the top of my mind:
the Android version you need is the
"Google APIs", not vanilla "Android"
you didn't mention that Map library in the Manifest
So make sure that the library used with your project is "Google APIs" (of desired version, I'd stick with 2.1 or 2.2) and that there's this line in the Manifest file
<application ...>
...
<uses-library android:name="com.google.android.maps" />
</application>
Other than that, would be awesome to see some stack trace to be 100% sure.

Related

Adding a service to Android manifest with difficult package structure (LibGDX) / Referencing packages in Android Manifest

We are programming with LibGDX and our package Structure looks as follows:
I've an own Android Service in the server package that I want to add to my Android Manifest - but the server package is not known to the editor. Android Studio searches in the core package but not in the java package.
As you can see circled in blue our package in the manifest is com.mxgdx.game
In the image's bottom you can see that I can access the class Hud in core -> java -> com.mygdx.game.Scenes (this class isn't a Service) but I can't access the server package where my Service is in. I've also tried accessing it by
"java.server." (server was already unknown)
"android.java." (java was already unknown)
"android.server" (server was already unknown)
This is for a university project, we are pretty new the android and an explanation would be welcome. I guess it's a really easy problem, but I tried googling for pretty long and just can't think of any new search terms. My basic problem is that my onBind() doesn't run and I came here because of CommonsWare's answer to this question: onBind() is never called in a service - so if there is another possibility without adding my service to the manifest, would be great as well, but the official documentation seems to make clear that is not possible https://developer.android.com/guide/topics/manifest/service-element
Ok, so I tried looking on the file structure of my project on hard disk level and I don't know why but I never thought of just trying to begin with "server.MyService" - that finally worked. Maybe this helps somebody one time - otherwise sorry for spamming haha

How can I show GoogleMap v2 on Android

I tried to show GoogleMap v2 in my Android application,but it failed.
Application didn't exit but I can't see GoogleMap on display as following image.
I got API key and set it in Android Manifest, and I did other settings for using GoogleMap v2.
For example, I added 7 permissions, 1 users-feature, 2 meta-data in Manifest.
Now I did nothing in MainActivity.java.(Just try to show main view.)
Is something missing for using it?
Is there anyone who has experience like this?
Please teach me how.
And I compiled it by Google API[Android 4.2.2]
Image URL : https://dl.dropboxusercontent.com/u/88565794/2014-02-07%2023.15.21.png
Have a look at this blog post, that describes almost the same problem:
http://android-er.blogspot.nl/2012/12/google-maps-android-api-v2-with-blank.html
If you use Google Maps Android API v2, but with a blank (gray) map displayed, and "E/Google Maps Android API(12676): Authorization failure" reported in LogCat; may be caused by a wrong API Key assigned.
In order to use Maps Android API, you have to assign a API Key in AndroidManifest.xml.
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="your API Key here"/>
But there are many more sources availble that describe a similar problem: https://www.google.co.uk/search?q=google+maps+v2+blank+map&client=safari
Ofcourse I can't tell you what you did wrong, but I would suggest you take a tutorail like this one:
http://www.androidhive.info/2013/08/android-working-with-google-maps-v2/ It even provides some how-to's on customization.
Or have a look at the documentation: https://developers.google.com/maps/documentation/android/start
Are you installing the app to your device from a different computer than the one you generated the debug key from? If so, you would need to add that debug key as well to you developer console settings.
I had this issue, maybe you're having the same issue.

Facebook SDK crashes google-play-services-lib if imported as existing Android source code

I have an extremely strange problem to which finding solution seems to be very tricky. Here's the story:
The application I'm working on uses both Facebook SDK and Google Maps v2. Team mate was working on Google Maps and I was working on Facebook part. When we combine his and mine code it appears that just having FacebookSDK as an imported project in the workspace (not even referenced in Properties|Android|Library section of our app) , straight away makes the app not see the Google Maps library. The work around is to add Google Maps into Java build path, however the application still crashes when we try to access the activity based on Google Maps. Not having Facebook SDK in the workspace makes the Google Maps work. When the app is ran with Google Maps added to the Java build Path, when trying to access the Google Maps activity LogCat shows NoClassDefFoundError exception.
Hope I explained the problem well. If not then let me know what more is required to get closer to fixing this strange problem. Thanks :)
SOLUTION: It seems that adding Java Build Path reference to android_sdk\extras\google\google_play_services\libproject\google-play-services_lib\libs\google_play_services.jar file fixed the issue. Crysis averted. ;)

How do Online App Creator work? Is there any example source code to look?

There are a lot of solutions for creating an app online like http://www.theappbuilder.com.
How do they build these apps? Is there any example source code to look at cause these tools are all over the internet?
This app builder uses Webview, set to full screen what shows HTML5 page that you can make with this tool. I think it might be possible to see some code. These kinds of tools are helpful for some easy apps, if you want full control and make something more complicated you will need to use Android-sdk or some other hybrid sdk-s(appcelerator, corona-sdk, adobe flash buider and so on).
You can use Ionic for that, i have similar project that i am working on right now since ionic is built in top of angular and html and produce /www folder for you and you can simply use command ionic cordova build android to convert to the apk, if you want it to run on server you can call those command using php exec() command.
In a comment above, you ask about open source alternatives. Take a look at something like PhoneGap. It is close enough that it should give you an understanding of the general approach.

Android: Installing Wikitude on Android Emulator

I'm trying to write some apps using wikitude, and I'm having some problems running even the example.
I've put the sample ( BasicOpenARDemo ) that comes with the SDK inside eclipse and tried to run it, where I encountered the next error: "wikitude was not found on the system. Please press the ok-button to access the Android market and download wikitude."
First question- I don't understand- Why am I approached to download the utility when I have a standalone sample inside my eclipse? Doesn't the core files behind Wikitude come with the SDK or the sample itself?
The next question will be - after some googling, I've found that in order to install this "Android market" I need to follow the manual that comes in the 9th message in the next thread (the message that was written by ronni.rasmussen) -
http://forum.xda-developers.com/archive/index.php/t-529170.html
Well, I've followed it, and now when I try to press the OK button that comes after the "wikitude was not found on the system..." message, I get redirected to the Android market, where I find Wikitude, but when I try to download it- I get a "Download was unsuccessful. Please try again" error message. How do I fix that?
One more thing that I don't understand- How come it's written in this offline Android market that the available wikitude version is for android 1.5 and no longer maintained?
As you can see- I'm quite baffled here. Hope someone could clear this up for me.
I was with the exact same problem. The problem was that installing Wikitude from the market (following the link you provided) does not guarantee to have the system requirements supported in the virtual device, therefore it gives an error when you run the BasicOpenARDemo, if it let you install it at all.
The solution was creating an AVD with an GoogleAPI (it includes maps support, I used the level 10 API for Android 2.3.3, it didn't work for the level 8 API), adding the camera, accelerometer, compass, GPS, etc., support to the virtual device (I did this via Eclipse). Then I downloaded the .apk for Wikitude and installed it via command line (.adb).

Categories

Resources