【问题标题】:Android (Eclipse) cannot find google-play-services_lib.apk tried multiple solutionsAndroid(Eclipse)找不到google-play-services_lib.apk 尝试了多种解决方案
【发布时间】:2013-11-22 23:10:52
【问题描述】:

我正在创建一个基于 Google 地图 API 显示地图的 android 应用程序,它应该与 android 2.3 API 级别 10 兼容。

我已经尝试了所有可能遇到的解决方案,例如:

  1. 已将现有代码导入我的项目(选中复制到工作区及其目录 google-play-services-lib)
  2. 在我的 XML 中添加了正确的元等(见下文)
  3. 我尝试使用几种不同的设置设置模拟器

android 应用程序运行良好,但显示此页面时退出。

Manifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="dcs.aber.ac.uk.cs211.group02"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="10"
        android:targetSdkVersion="22" />

    <permission
        android:name="dcs.aber.ac.uk.cs211.group02.permission.MAPS_RECEIVE"
        android:protectionLevel="signature" />


    <!-- Accessing camera hardware -->
    <!-- putting android.hardware.camera prevents non-camera devices using this app -->
    <uses-feature android:name="android.hardware.camera" />
    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true" />
    <uses-permission android:name="dcs.aber.ac.uk.cs211.group02.permission.MAPS_RECEIVE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="dcs.aber.ac.uk.cs211.group02.providers.gsf.permission.READ_GSERVICES" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:logo="@drawable/ic_launcher"
        android:theme="@style/AppTheme" >
        <activity
            android:name="dcs.aber.ac.uk.cs211.group02.StartScreen"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="dcs.aber.ac.uk.cs211.group02.CreateWalkActivity"
            android:label="@string/title_activity_create_walk" >
        </activity>
        <activity
            android:name="dcs.aber.ac.uk.cs211.group02.HelpScreen"
            android:label="@string/title_activity_help_screen" >
        </activity>
        <activity
            android:name="dcs.aber.ac.uk.cs211.group02.WalkRecording"
            android:label="@string/title_activity_walk_recording" >
        </activity>
    </application>

    <meta-data android:name="dcs.aber.ac.uk.cs211.group02.API_KEY"
        android:value="AIzaSyBKYpKfU4zn-3IBkskKsLbwRsQ1-IqFldk"
        />

    <meta-data android:name="com.google.android.gms.version"
           android:value="@integer/google_play_services_version" />

</manifest> 

显示地图的xml:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/black"
    tools:context=".WalkRecording" >

    <fragment
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:map="http://schemas.android.com/apk/res-auto"
        android:id="@+id/mapView"
        android:name="com.google.android.gms.maps.SupportMapFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</RelativeLayout>

地图类的java代码

import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.Menu;

public class WalkRecording extends FragmentActivity {

    private GoogleMap map;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_walk_recording);

        map=((SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.mapView)).getMap();

        map.setMapType(GoogleMap.MAP_TYPE_NORMAL);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.walk_recording, menu);
        return true;
    }

}

日食痕迹:

[2013-11-22 23:03:07 - WalkingTours] ------------------------------
[2013-11-22 23:03:07 - WalkingTours] Android Launch!
[2013-11-22 23:03:07 - WalkingTours] adb is running normally.
[2013-11-22 23:03:07 - WalkingTours] Performing dcs.aber.ac.uk.cs211.group02.StartScreen activity launch
[2013-11-22 23:03:07 - WalkingTours] Automatic Target Mode: using existing emulator 'emulator-5554' running compatible AVD 'mapTestAPI16'
[2013-11-22 23:03:07 - WalkingTours] Uploading WalkingTours.apk onto device 'emulator-5554'
[2013-11-22 23:03:07 - WalkingTours] Installing WalkingTours.apk...
[2013-11-22 23:03:12 - WalkingTours] Success!
[2013-11-22 23:03:12 - google-play-services_lib] Could not find google-play-services_lib.apk!
[2013-11-22 23:03:12 - WalkingTours] Starting activity dcs.aber.ac.uk.cs211.group02.StartScreen on device emulator-5554
[2013-11-22 23:03:14 - WalkingTours] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=dcs.aber.ac.uk.cs211.group02/.StartScreen }

【问题讨论】:

  • 顺便说一句,API 级别 22 不存在。 Android 4.4 是 19。

标签: java android eclipse google-maps


【解决方案1】:

看到您的错误日志,link 中提供了一种解决方案。不要导入 google-play-services_lib APK,您应该在您的项目中将其作为 Android 库项目引用。

【讨论】:

  • 我已经这样做了,当我进入项目>属性>Android时它显示为已添加,但我仍然收到此错误
  • 我认为只是添加 jar 似乎已经奏效,但我有一个类 sno def found 错误,该类包含我必须首先整理的地图
【解决方案2】:

我遇到了同样的问题。 查看项目:Properties-> Java Build Path 下项目删除 google-play-services_lib。 没有必要也作为项目包含在构建中。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-05-21
    • 2022-08-03
    • 2014-08-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-07
    相关资源
    最近更新 更多