UPDATE: A UI bug was preventing me from importing google-play-services_lib. I had to click immediately below the SDK list to be able to scroll to see the Library box. See the image in the accepted answer for more info.
I am using Android IDE to get a Hello World map app, which I have named Intactless2. The files are all named correctly, android-support-v4.jar in /libs, I have a valid API key, etc.
I followed Google's Android Maps guide, copying and pasting the Java and activity_main.xml verbatim:
I correctly added everything there to my manifest. I got an error on <meta-data android:name="com.google.android.gms.version"
... 's value being incorrect, so I hardcoded the integer from the version.xml file so that it's android:value="4030500"
. Otherwise my manifest is unchanged.
I tried all of the solutions in the top Google hits for the error messages I'm getting and it still won't run. Normally, this would indicate an idiosyncratic bug that I haven't thought about that might even be unrelated to Google Play Services, but I rebuilt it exactly as Google's guide suggests and redid all of the recommendations in those posts and still can't use Google Play Services.
I am running a 4.4 emulator and 4.4 is the minimum version my project will build to. I have tried the following to be able to use google-play-services/google-play-services_lib in my app:
1) Made an Eclipse project for Google Play Services and added it to my project. Right-click on my project -> Properties -> Java Build Path -> Projects Add -> google-play-services_lib. a) Checked google-play-services_lib in Order & Export b) Unchecked oogle-play-services_lib in Order and Export 2) Copy-pasted google-play-services, google-play-services_lib, and google-play-services.properties from my Android SDK directory to my /libs directory in my project.
1) Properties -> Android -> Target Build Path -> Android 4.4 2) Properties -> Android -> Target Build Path -> Google APIs (the one directly below "Android 4.4)
That's a lot of combinations including the solutions people on StackOverflow have suggested.
Also, if I add <uses-library android:name="com.google.android.gms.maps" />
(or remove the gms as some guides advise) to my manifest, I get this LogCat error:
11-13 00:57:18.890: E/PackageManager(938): Package com.example.intactless2 requires unavailable shared library com.google.android.gms.maps; failing!
Importing google-play-services/google-play-services_lib as an Eclipse project:
Screenshot of google-play-services_lib Eclipse project: http://postimg.org/image/ukbqjk9lp/
Screenshot of my hello world Maps project in Package Explorer: http://postimg.org/image/589t2137h/
Console output:
...
[2013-11-12 21:57:13 - Intactless2] Installing Intactless2.apk...
[2013-11-12 21:57:19 - Intactless2] Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY
[2013-11-12 21:57:19 - Intactless2] Please check logcat output for more details.
[2013-11-12 21:57:19 - Intactless2] Launch canceled!
LogCat:
11-13 01:03:44.870: E/AndroidRuntime(1886): FATAL EXCEPTION: main
11-13 01:03:44.870: E/AndroidRuntime(1886): Process: com.example.intactless2, PID: 1886
11-13 01:03:44.870: E/AndroidRuntime(1886): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.intactless2/com.example.intactless2.MainActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
11-13 01:03:44.870: E/AndroidRuntime(1886): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2176)
11-13 01:03:44.870: E/AndroidRuntime(1886): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2226)
11-13 01:03:44.870: E/AndroidRuntime(1886): at android.app.ActivityThread.access$700(ActivityThread.java:135)
...
Putting google-play-services.jar, google-play-services_lib.jar, and google-play-services.jar.properties directly into my project's /libs directory
Screenshot of my hello world Maps project in Package Explorer: http://postimg.org/image/l68z4crl7/
Console output:
...
[2013-11-12 22:15:20 - Intactless2] Uploading Intactless2.apk onto device 'emulator-5554'
[2013-11-12 22:15:20 - Intactless2] Installing Intactless2.apk...
[2013-11-12 22:15:37 - Intactless2] Success!
[2013-11-12 22:15:37 - Intactless2] Starting activity com.example.intactless2.MainActivity on device emulator-5554
[2013-11-12 22:15:41 - Intactless2] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.intactless2/.MainActivity }
LogCat:
11-13 01:15:43.990: E/AndroidRuntime(1959): FATAL EXCEPTION: main
11-13 01:15:43.990: E/AndroidRuntime(1959): Process: com.example.intactless2, PID: 1959
11-13 01:15:43.990: E/AndroidRuntime(1959): java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable
11-13 01:15:43.990: E/AndroidRuntime(1959): at com.google.android.gms.maps.GoogleMapOptions.createFromAttributes(Unknown Source)
11-13 01:15:43.990: E/AndroidRuntime(1959): at com.google.android.gms.maps.MapFragment.onInflate(Unknown Source)
11-13 01:15:43.990: E/AndroidRuntime(1959): at android.app.Activity.onCreateView(Activity.java:4784)
11-13 01:15:43.990: E/AndroidRuntime(1959): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:689)
11-13 01:15:43.990: E/AndroidRuntime(1959): at android.view.LayoutInflater.inflate(LayoutInflater.java:469)
11-13 01:15:43.990: E/AndroidRuntime(1959): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
11-13 01:15:43.990: E/AndroidRuntime(1959): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
11-13 01:15:43.990: E/AndroidRuntime(1959): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
11-13 01:15:43.990: E/AndroidRuntime(1959): at android.app.Activity.setContentView(Activity.java:1928)
11-13 01:15:43.990: E/AndroidRuntime(1959): at com.example.intactless2.MainActivity.onCreate(MainActivity.java:11)
11-13 01:15:43.990: E/AndroidRuntime(1959): at android.app.Activity.performCreate(Activity.java:5243)
Thank you in advance! Any help is appreciated. :)