Eclipse cannot import import com.google.android.maps.*? - android

I am trying the google maps api for android, but eclipse does not import the com.google.android.maps.* files.
Source:
MyMapActivity:
package org.madmax.map;
import android.app.Activity;
import android.os.Bundle;
import com.google.android.maps.*;
public class MyMapActivity extends MapActivity {
private MapView map;
private MapController controller;
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
in the Manifest file I have already declared:
<uses-library android:name="com.google.android.maps" />
How do I import the com.google.android.maps.* files?

It is not enough to just have the API SDK installed. From the android maps documentation,
http://code.google.com/android/add-ons/google-apis/maps-overview.html
If you want to add Maps to an existing application, right-click the project in Package Explorer, choose Properties > Android and then select a build target from the list displayed. You must choose the "Google APIs" build target.
(The standard Android packages don't include Google Maps)
Update, found a screenshot online, don't pick a Target with the name "Android x.x" pick the corresponding target that says "Google APIs" for the version of Android you want.

Make sure you have the Google APIs installed in your SDK. Open the SDK manager from the tools directory and use it to install the package.

Related

Kudan AR development key not working

I am using Kudan SDK 1.4.1 and Android studio 2.2.2
I have created an empty project named "ar" with a package 'eu.kudan.ar', added KudanAR.aar library and created a simple Activity:
package eu.kudan.ar;
import android.os.Bundle;
import eu.kudan.kudan.ARAPIKey;
import eu.kudan.kudan.ARActivity;
public class MainActivity extends ARActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
ARAPIKey key = ARAPIKey.getInstance();
key.setAPIKey("...api key from kudan wiki...");
System.out.println(key.licenseKeyIsValid());
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
I copied the long 1.4 License key from kudan wiki (also tried with other older keys). The app compiles and starts but immediately reports Your API key is not valid.. Tried on both, device and emulator.
What should I do to make the key working?
Kudan SDK 1.4.1 Api key has changed.
sVmoznmKZ+4nFEHD6HoslwpC26PNuBZGHrikUwyon2BKSvza1yu2CqbSrae+pHPr1NHjhsf5pHQOZn8IEqXlqXFodGsrOJhxJANbMOdvnRLUi9/QWGqyRL9FViDmyohw6e5R7U4Ex8H7d7spLLvhfp5HFv56DgLr8c8sC2ipDtv9g1IjOTaY7UGxata3eulG2A/UkIdRv2NcotZXqan01xQUWFAislEwlGguParEYiwu11T4mqtU3dQBbfxpvxbczjdYz493YG3rAO2RHgT+5M5TJShJsz2irkNo71JD2Fzqf4AR2b4+7t1c55zKjegXzGS6Xa/rpNn9yiXUn7rUYIHNvN3cEQa9HsZiVxAV4vJgxFS+T/AxfWqKrEg1uj6xF5MsodZ2EkZ8mqliYIsxZqnFz+Re2HeWG8wvrEob0ZwRIO0TxppAemZc3HChTAPLcNt5gzeBk0oRP4wnrFAFFBDi8XjDocwTSVw++hWZb1qNHzt6bKLsMDRT057UVuuZB6M8f7EOQD79Oah0Vrx/3DUK6e9BEV8oGFNHtk1wyYEkg0i6RLhVSokGx//Qj36A4gCz3h1OjtfB0OuukbNq7xI1L/FcNQLmGYNGZwszARjGr9ESw1gVAkbQMxaV27uo/KoIq4+nR7RL8iT7t7NAaXCFIi24RR+7WGjTvKqWYjA=
link: https://wiki.kudan.eu/Development_License_Keys

Google Map V2 Android, "error import com.google.android.gms.maps.model.LatLng"

I tried so hard to solve a problem.
I am using the Google Map V2 API and I followed all the steps from the google tutorial but there is a problem I don't understand :
I imported the "google-play-services_lib" in my workspace
I defined this project such as a "referencing library"
I added this library to my main project
I took care to define the same version for both of them (Google API 5.0.1)
The check is now green but in my main Activity from my main project, Eclipse can't import any class from "com.google.android.gms.maps"
Is there someone who have a solution please ?
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import com.example.moodwalk.R;
import com.google.android.gms.maps.model.LatLng;
public class GoogleResult extends FragmentActivity {
static final LatLng HAMBURG = new LatLng(53.558, 9.927);
static final LatLng KIEL = new LatLng(53.551, 9.993);
private GoogleMap map;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.login_accueil);
}
}
Make sure you've added both google play services and google util libraries as libs to your project, under the properties tab.
When you Select Android on the left selection which adding he library. See the above table and check the Android x.x not Google API. Once you do you should add the Google Play Services Library and then run the project. It wont throw that error anymore.
Ok, I found my error. For them who have the same problem, check if you don't have a different path for your androi-support-v4 in your project and library project.
I deleted the both jar and then added one in each libs project with the same path. It worked for me !

GoogleApiClient.ConnectionCallbacks error compile time

should I use google drive bat I can't compile this activity
package com.google.android.gms.drive.sample.demo;
import android.app.Activity;
import android.content.Intent;
import android.content.IntentSender.SendIntentException;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;
/**
* An abstract activity that handles authorization and connection to the Drive
* services.
*/
public abstract class BaseDemoActivity extends Activity implements
GoogleApiClient.ConnectionCallbacks,
GoogleApiClient.OnConnectionFailedListener {
...
I use Google Plugin for Eclipse to install the library and google APIs
but since compile error
GoogleApiClient cannot be resolved to a type
Follow the Google+ Platform Quickstart for Android in order to install Google Play Services as a library project.
In particular see step 5:
5. Import the Google Play Services library project.
Select File > Import > Android > Existing Android Code Into Workspace and click Next.
Select Browse.... Enter <android-sdk-folder>/extras/google/google_play_services/.
Select google-play-services_lib. Click Finish to import.

Getting Started with the facebook sdk for android

I have been finished step 3 of "Getting Started with the Facebook SDK for Android" from facebook developers support and this is code from the Sample directory :
package com.facebook.samples.profilepicture;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
public class ProfilePictureSampleActivity extends FragmentActivity {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_profile_picture_sample);
}
}
When I try to run ProfilePictureSample there are some errors like this :
"The import android.os.Bundle cannot be resolved"
"The type android.app.Activity cannot be resolved. It is indirectly
referenced from required .class files"
"The hierarchy of the type ProfilePictureSampleActivity is
inconsistent"
So how can I fix them ? It's strange because if I build a simple activity project with android.os.Bundle works fine.
Probably the problem is the holder api version that the application of this code request because I suppose that android.os.Bundle is for api 17 of android sdk. So it can be resolved by go to "android sdk Manager" and download the version of requested api.

android - how to import com.google.android.maps.MapActivity?

I am trying to get google maps to work in my android project. I have already got the md5 key and signed up with google to get the api key, but now when i am trying to display the map, I get an error when importing it. "com.google" has the sqiqly red line under it.
Can anyone help?
Thanks
this is my xml file: (note: i replaced the key with 'my_key' since i didnt want to make it public)
<com.google.android.maps.MapView
android:id="my_map"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:enabled="true"
android:clickable="true"
android:apiKey="my_key"/>
and for the java file:
package com.escortme.basic;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import com.google.android.maps.MapActivity; // ERROR
import com.google.android.maps.MapView; // ERROR
import android.os.Bundle;
public class Police_ViewActivity extends Activity {
#Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.pol_view);
}
public void quit_button_action(View view){
finish();
}
}
It sounds like you don't have the Google APIs referenced by your project. Assuming you're using Eclipse, view the properties of your project and select Android and check that Google APIs is checked rather than simply an Android version.
You may need to download the Google APIs if you haven't already. You can do this through the Android SDK Manager.

Categories

Resources