Android应用程序无法安装

时间:2013-03-18 22:46:17

标签: android-4.2-jelly-bean

我从控制台收到消息,说明应用程序无法安装在模拟器上(在设备'emulator-5554上)。我有来自MapView Tutorial的代码:

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
public class MainActivity extends MapActivity {


@Override
protected boolean isRouteDisplayed() {
    return false;
}

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
      MapView mapView = (MapView) findViewById(R.id.mapview);
        mapView.setBuiltInZoomControls(true);
}

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

activity_main.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:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >

<com.google.android.maps.MapView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:apiKey="KEY"
android:clickable="true" >
</com.google.android.maps.MapView>

</RelativeLayout>

和清单文件:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="diplomska.proketi.prv"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.INTERNET"/>    
<uses-sdk
    android:minSdkVersion="17"
    android:targetSdkVersion="17" /> 
<uses-feature
    android:glEsVersion="0x00020000"
    android:required="true" /> 
  <application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >        
   <uses-library android:name="com.google.android.maps"/>        
    <activity
        android:name="diplomska.proketi.prv.MainActivity"
        android:label="@string/app_name" > 
<intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>        
 <meta-data
android:name="com.google.android.maps.v2.API_KEY"
        android:value="KEY" />       
</application>
</manifest>

1 个答案:

答案 0 :(得分:0)

下面的代码一切都很好。问题是,使用v2密钥,您必须使用物理设备测试您的应用程序。