【问题标题】:Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY for Android 2.2 API Level 8安装错误:Android 2.2 API 级别 8 的 INSTALL_FAILED_MISSING_SHARED_LIBRARY
【发布时间】:2012-03-29 23:47:11
【问题描述】:

我的 CS 课程有一个 Android GPS 项目。现在我正在通过教程(使用带有 ADT 插件的 Eclipse)来了解如何使用 Android 库,但在此过程中,我收到了安装错误:INSTALL_FAILED_MISSING_SHARED_LIBRARY

我检查了 LogCat,似乎错误从这一行开始:

03-29 23:05:14.721: E/PackageManager(72): Package virginia.edu.cs2110 requires   unavailable shared library android.location; failing!

我已经查找了这个问题,并做了我能找到的所有事情。我在清单文件中声明了 uses-library 字段:

<uses-library android:name="android.location" />
<uses-library android:name="com.google.android.maps" />

如果有人想知道,这是我的整个清单文件:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="virginia.edu.cs2110"
    android:versionCode="1"
    android:versionName="1.0" >
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-sdk android:minSdkVersion="8" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <activity
            android:name=".TrivialGPS"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <uses-library android:name="android.location" />
        <uses-library android:name="com.google.android.maps" />
    </application>

</manifest>

我还创建了一个目标名称为“Google API (Google Inc.)”的 Android 模拟器: http://i42.tinypic.com/2dj3vd5.jpg

另外,这是我想要运行的代码:

package virginia.edu.cs2110;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;

import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;


public class TrivialGPS extends MapActivity {

    private MapController mapController;
    private MapView mapView;
    private LocationManager locationManager;

    @Override
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);

        // create a map view
        mapView = new MapView(this, "C7:63:2F:C8:93:8B:E1:83:D6:4F:D3:5B:62:C1:75:90");
        mapController = mapView.getController();
        mapController.setZoom(22);
        setContentView(mapView);

        // get a hangle on the location manager
        locationManager =
        (LocationManager) getSystemService(Context.LOCATION_SERVICE);

        locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, 
        new LocationUpdateHandler());
    }

    @Override
    protected boolean isRouteDisplayed() {
        // TODO Auto-generated method stub
        return false;
    }

    public class LocationUpdateHandler implements LocationListener {

        @Override
        public void onLocationChanged(Location loc) {
            int lat = (int) (loc.getLatitude()*1E6);
            int lng = (int) (loc.getLongitude()*1E6);
            GeoPoint point = new GeoPoint(lat, lng);
            mapController.setCenter(point);
            setContentView(mapView);
        }

        @Override
        public void onProviderDisabled(String provider) {}

        @Override
        public void onProviderEnabled(String provider) {}

        @Override
        public void onStatusChanged(String provider, int status, Bundle extras) {}

    }
}

【问题讨论】:

    标签: java android


    【解决方案1】:

    删除&lt;uses-library android:name="android.location" /&gt;,因为没有这样的库。

    【讨论】:

      猜你喜欢
      • 2011-03-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多