im new to android programming and im trying to create an android app that loads google maps v2.
I got api key, my code is working with no errors, i'v used some guide to write the code
But here's the problem : if im using min Sdk Version 8 my app crash and not even starts.
if im trying higher Sdk Version i cant test it because i dont have any device besides galaxy s2 and google maps v2 cant load in the emulator.
I will be glad to hear some advices.
Use SupportMapFragment from a FragmentActivity, instead of MapFragment from an Activity. To use fragments on devices older than API Level 11, you need to use the Android Support package's backport of fragments (where FragmentActivity comes from).
http://android-er.blogspot.de/2012/12/using-supportmapfragment.html
Also Please check below step..
check if the "libs" folder containing the "android-support-v4.jar" exists in your project.
"android-support-v4.jar" is located in "/extras/android/compatibility/v4/android-support-v4.jar" under your "android-sdk" drectory.
Before running your project, you must set your project Build target to "Google APIs", not Android x.x. version : Select your project and click Project > Properties > Project Build Target in Eclipse and select any "Google APIs ", and then run your project on your phone. If you use the emulator, also MUST set the AVD of the emulator to the any "Google APIs ".
Once more, you don't need to create the new Google Maps API key in order to test your project, Just use the default provided API key, which is shown as "Key for browser apps (with referers) "in your Google APIs Console.
Finally, the most important is to add Google Play services as an Android library project as follows:
Select File > Import > Android > Existing Android Code Into Workspace and click Next. Select Browse..., enter /extras/google/google_play_services/libproject/google-play-services_lib, and click Finish.
https://developers.google.com/maps/documentation/android/start
reference link
Google maps v2 on android devices with minSDK below 11
Google has stop supporting android api version below 9, So if you are building new app set your min sdk level to 9.
And to test the google map you can use emulator just open sdk manager and install android latest version 4.4, build new emulator configured with android 4.4 and you can run google map in it. Hope this will help you
Related
I have downloaded SDK tools and installed Google API's Intal x86 Atom image, however when I want to create my AVD it sais there is no system images installed for this target. BUT I have downloaded everything. I am using Ubuntu, on Windows machine same configuration works perfect, also for my colleagues same configuration works just fine.
If I select as target Android API 23, not Google API's it's okay, but I don't need Android API, since it's not working for me. I saw lots of reported defect, but none of them could help me.
Anyone has any idea that's going on there?
I had the same problem myself today and I found a bug report:
https://code.google.com/p/android/issues/detail?id=210223
To quote the solution:
There seems to be some underlining refactoring which means the configuration now required is:
Target = Android X.X - API Level XX
CPU/ABI = Google APIs Intel Atom (x86)
So, to create a new AVD with Google APIs support, just don't pick Google APIs as the Target. Pick generic Android with desired API level as the Target and then pick your desired Google APIs version in CPU/ABI. It works just fine, you will get Google Maps etc. on the AVD.
About that "but I don't need Android API, since it's not working for me" - I'm not sure what do you mean. You can't have Google APIs without using Android APIs, because Google APIs are running on Android device.
I wrote a simple code which implements MapView using Eclipse and ADT plug-in updated today. in order to test it I created a new emulator based on Galaxy Nexus device and target for Google APIs level 17. The emulator has been created without errors and starts properly.
I set project properties for targeting Google APIs. I compiled the project and I tried to run in on my emulator, but I got a warning message: No compatible targets were found, Do you wish to add a new Android Virtual Device?
Independently on the button I click, a new avd windows appear and my new emulator is highlighted by a red cross instead of the green check sign.
I can choose to ignore the warning and continue with my emulator, but my application blocks before reaching main activity onCreate() method I am sure because I have placed a breakpoint inside the method which is never reached.
I added internet permission tag to manifest ans API keycode I got from Google.
Is anyone able to explain me what is the problem with my project?
Thank you very much.
If you used Google APIs level 17 as the target of your project, make sure your emulator's API level is also 17.
You could have possibly created an emulator using Google API but the API level is different.
To check the emulator's API level, open your AVD, then confirm if target name is Google APIs(Google Inc.) and API level is 17.
I am reading Teach Yourself Android Application Development in 24 Hours, in Hour 6, it asks me to create a new Android Project with:
Build target: Android 2.1 + Google APIs
However, I can only select Android 2.1 OR Google APIs, not both, under the list of build targets, when I hover above Google APIs, it says Android + Google APIs, does it mean if I select Google APIs as build target, it will include Android (which version?)? But what if I want to use, say, "Real3D Add-On" as well as "Google APIs", as there is no way to select multiple targets?
Thanks!
You can only select one target in eclipse.
If you select Google APIS it will be for the Android API version for the Google API listed (and below). If you want the LG Real3D Addon target (I'm guessing it's LG) then it will be for whatever API version it shows.
Am running a project on android using eclipse IDE , on trying to run the map view i could do that enabling the google map view and using the uses library . But when it comes to the AVD it shows an error. saying the target API is not ssupporting maps (I did try creating a new AVD). Please help me out
Please make your target as "Google APIs" corresponding to ur version which u want to use.
From the name of your emulator.. I guess you will be using an app which has maps. If yes, you need to create the AVD using Google API with the right API Level (and not normal AVD). If you can't find Google API within your "Android SDK & AVD Manager", you need to install from the "Available Packages" option
When creating a new android project, the build target has two choices:
Android 2.2, Android Open Source Project
AND
Google API's, Google Inc.
Both show Platform as 2.2 and API level 8
Which to choose (and why)?
The AVD with Google API's contains google Api's like GoogleMaps.
For example:
If you application uses GoogleMaps, then you will have to use an AVD with Google API's.